diff --git "a/test.jsonl" "b/test.jsonl" new file mode 100644--- /dev/null +++ "b/test.jsonl" @@ -0,0 +1,2475 @@ +{"id": "Atraci/Atraci:coffee/-Settings.class.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Settings =\n get: (variable) ->\n localStorage['settings_' + variable]\n set: (variable, newValue) ->\n localStorage.setItem 'settings_' + variable, newValue\n\n init: ->\n @set('updateUrl', 'http://getatraci.net/update.json') if not @get('updateUrl')\n\n\nSettings.init()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Atraci/Atraci", "path": "coffee/-Settings.class.coffee", "license": "MIT", "commit": "d4b7f952575352efeff69f232ab345bac48fe586", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/-Settings.class.coffee", "line_start": 1, "line_end": 11} +{"id": "Atraci/Atraci:coffee/-Settings.class.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSettings =\n get: (variable) ->\n localStorage['settings_' + variable]\n set: (variable, newValue) ->\n localStorage.setItem 'settings_' + variable, newValue\n\n init: ->\n @set('updateUrl', 'http://getatraci.net/update.json') if not @get('updateUrl')\n\n\nSettings.init()\n```", "response": "var Settings;\n\nSettings = {\n get: function(variable) {\n return localStorage['settings_' + variable];\n },\n set: function(variable, newValue) {\n return localStorage.setItem('settings_' + variable, newValue);\n },\n init: function() {\n if (!this.get('updateUrl')) {\n return this.set('updateUrl', 'http://getatraci.net/update.json');\n }\n }\n};\n\nSettings.init();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Atraci/Atraci", "path": "coffee/-Settings.class.coffee", "license": "MIT", "commit": "d4b7f952575352efeff69f232ab345bac48fe586", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/-Settings.class.coffee", "line_start": 1, "line_end": 11} +{"id": "Atraci/Atraci:coffee/-Settings.class.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Settings;\n\nSettings = {\n get: function(variable) {\n return localStorage['settings_' + variable];\n },\n set: function(variable, newValue) {\n return localStorage.setItem('settings_' + variable, newValue);\n },\n init: function() {\n if (!this.get('updateUrl')) {\n return this.set('updateUrl', 'http://getatraci.net/update.json');\n }\n }\n};\n\nSettings.init();\n```", "response": "Settings =\n get: (variable) ->\n localStorage['settings_' + variable]\n set: (variable, newValue) ->\n localStorage.setItem 'settings_' + variable, newValue\n\n init: ->\n @set('updateUrl', 'http://getatraci.net/update.json') if not @get('updateUrl')\n\n\nSettings.init()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Atraci/Atraci", "path": "coffee/-Settings.class.coffee", "license": "MIT", "commit": "d4b7f952575352efeff69f232ab345bac48fe586", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/-Settings.class.coffee", "line_start": 1, "line_end": 11} +{"id": "Atraci/Atraci:coffee/-Settings.class.coffee:1:completion", "type": "completion", "prompt": "Settings =\n get: (variable) ->\n localStorage['settings_' + variable]\n set: (variable, newValue) ->\n localStorage.setItem 'settings_' + variable, newValue", "response": "init: ->\n @set('updateUrl', 'http://getatraci.net/update.json') if not @get('updateUrl')\n\n\nSettings.init()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Atraci/Atraci", "path": "coffee/-Settings.class.coffee", "license": "MIT", "commit": "d4b7f952575352efeff69f232ab345bac48fe586", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/-Settings.class.coffee", "line_start": 1, "line_end": 11} +{"id": "buttercoin/buttercoin:test/datastore/order_spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Order = require('../../lib/datastore/order')\n\ndescribe 'Order', ->\n beforeEach ->\n @account = {}\n @order = new Order({}, 'USD', 1, 'BTC', 10)\n\n it 'should be clonable', ->\n @order.clone.should.exist\n order2 = @order.clone()\n\n order2.account.should.equal(@order.account)\n @order.account = null\n order2.account.should.not.equal(@order.account)\n\n order2.offered_currency.should.equal(@order.offered_currency)\n @order.offered_currency = null\n order2.offered_currency.should.not.equal(@order.offered_currency)\n\n order2.offered_amount.should.equal(@order.offered_amount)\n @order.offered_amount = null\n order2.offered_amount.should.not.equal(@order.offered_amount)\n\n order2.received_currency.should.equal(@order.received_currency)\n @order.received_currency = null\n order2.received_currency.should.not.equal(@order.received_currency)\n\n order2.received_amount.should.equal(@order.received_amount)\n @order.received_amount = null\n order2.received_amount.should.not.equal(@order.received_amount)\n\n it 'should be able to produce a mirrored copy', ->\n order2 = @order.clone(true)\n order2.account.should.equal(@order.account)\n order2.offered_currency.should.equal(@order.received_currency)\n order2.offered_amount.should.equal(@order.received_amount)\n order2.received_currency.should.equal(@order.offered_currency)\n order2.received_amount.should.equal(@order.offered_amount)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "test/datastore/order_spec.coffee", "license": "MIT", "commit": "52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/test/datastore/order_spec.coffee", "line_start": 1, "line_end": 38} +{"id": "buttercoin/buttercoin:test/datastore/order_spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nOrder = require('../../lib/datastore/order')\n\ndescribe 'Order', ->\n beforeEach ->\n @account = {}\n @order = new Order({}, 'USD', 1, 'BTC', 10)\n\n it 'should be clonable', ->\n @order.clone.should.exist\n order2 = @order.clone()\n\n order2.account.should.equal(@order.account)\n @order.account = null\n order2.account.should.not.equal(@order.account)\n\n order2.offered_currency.should.equal(@order.offered_currency)\n @order.offered_currency = null\n order2.offered_currency.should.not.equal(@order.offered_currency)\n\n order2.offered_amount.should.equal(@order.offered_amount)\n @order.offered_amount = null\n order2.offered_amount.should.not.equal(@order.offered_amount)\n\n order2.received_currency.should.equal(@order.received_currency)\n @order.received_currency = null\n order2.received_currency.should.not.equal(@order.received_currency)\n\n order2.received_amount.should.equal(@order.received_amount)\n @order.received_amount = null\n order2.received_amount.should.not.equal(@order.received_amount)\n\n it 'should be able to produce a mirrored copy', ->\n order2 = @order.clone(true)\n order2.account.should.equal(@order.account)\n order2.offered_currency.should.equal(@order.received_currency)\n order2.offered_amount.should.equal(@order.received_amount)\n order2.received_currency.should.equal(@order.offered_currency)\n order2.received_amount.should.equal(@order.offered_amount)\n```", "response": "var Order;\n\nOrder = require('../../lib/datastore/order');\n\ndescribe('Order', function() {\n beforeEach(function() {\n this.account = {};\n return this.order = new Order({}, 'USD', 1, 'BTC', 10);\n });\n it('should be clonable', function() {\n var order2;\n this.order.clone.should.exist;\n order2 = this.order.clone();\n order2.account.should.equal(this.order.account);\n this.order.account = null;\n order2.account.should.not.equal(this.order.account);\n order2.offered_currency.should.equal(this.order.offered_currency);\n this.order.offered_currency = null;\n order2.offered_currency.should.not.equal(this.order.offered_currency);\n order2.offered_amount.should.equal(this.order.offered_amount);\n this.order.offered_amount = null;\n order2.offered_amount.should.not.equal(this.order.offered_amount);\n order2.received_currency.should.equal(this.order.received_currency);\n this.order.received_currency = null;\n order2.received_currency.should.not.equal(this.order.received_currency);\n order2.received_amount.should.equal(this.order.received_amount);\n this.order.received_amount = null;\n return order2.received_amount.should.not.equal(this.order.received_amount);\n });\n return it('should be able to produce a mirrored copy', function() {\n var order2;\n order2 = this.order.clone(true);\n order2.account.should.equal(this.order.account);\n order2.offered_currency.should.equal(this.order.received_currency);\n order2.offered_amount.should.equal(this.order.received_amount);\n order2.received_currency.should.equal(this.order.offered_currency);\n return order2.received_amount.should.equal(this.order.offered_amount);\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "test/datastore/order_spec.coffee", "license": "MIT", "commit": "52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/test/datastore/order_spec.coffee", "line_start": 1, "line_end": 38} +{"id": "buttercoin/buttercoin:test/datastore/order_spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Order;\n\nOrder = require('../../lib/datastore/order');\n\ndescribe('Order', function() {\n beforeEach(function() {\n this.account = {};\n return this.order = new Order({}, 'USD', 1, 'BTC', 10);\n });\n it('should be clonable', function() {\n var order2;\n this.order.clone.should.exist;\n order2 = this.order.clone();\n order2.account.should.equal(this.order.account);\n this.order.account = null;\n order2.account.should.not.equal(this.order.account);\n order2.offered_currency.should.equal(this.order.offered_currency);\n this.order.offered_currency = null;\n order2.offered_currency.should.not.equal(this.order.offered_currency);\n order2.offered_amount.should.equal(this.order.offered_amount);\n this.order.offered_amount = null;\n order2.offered_amount.should.not.equal(this.order.offered_amount);\n order2.received_currency.should.equal(this.order.received_currency);\n this.order.received_currency = null;\n order2.received_currency.should.not.equal(this.order.received_currency);\n order2.received_amount.should.equal(this.order.received_amount);\n this.order.received_amount = null;\n return order2.received_amount.should.not.equal(this.order.received_amount);\n });\n return it('should be able to produce a mirrored copy', function() {\n var order2;\n order2 = this.order.clone(true);\n order2.account.should.equal(this.order.account);\n order2.offered_currency.should.equal(this.order.received_currency);\n order2.offered_amount.should.equal(this.order.received_amount);\n order2.received_currency.should.equal(this.order.offered_currency);\n return order2.received_amount.should.equal(this.order.offered_amount);\n });\n});\n```", "response": "Order = require('../../lib/datastore/order')\n\ndescribe 'Order', ->\n beforeEach ->\n @account = {}\n @order = new Order({}, 'USD', 1, 'BTC', 10)\n\n it 'should be clonable', ->\n @order.clone.should.exist\n order2 = @order.clone()\n\n order2.account.should.equal(@order.account)\n @order.account = null\n order2.account.should.not.equal(@order.account)\n\n order2.offered_currency.should.equal(@order.offered_currency)\n @order.offered_currency = null\n order2.offered_currency.should.not.equal(@order.offered_currency)\n\n order2.offered_amount.should.equal(@order.offered_amount)\n @order.offered_amount = null\n order2.offered_amount.should.not.equal(@order.offered_amount)\n\n order2.received_currency.should.equal(@order.received_currency)\n @order.received_currency = null\n order2.received_currency.should.not.equal(@order.received_currency)\n\n order2.received_amount.should.equal(@order.received_amount)\n @order.received_amount = null\n order2.received_amount.should.not.equal(@order.received_amount)\n\n it 'should be able to produce a mirrored copy', ->\n order2 = @order.clone(true)\n order2.account.should.equal(@order.account)\n order2.offered_currency.should.equal(@order.received_currency)\n order2.offered_amount.should.equal(@order.received_amount)\n order2.received_currency.should.equal(@order.offered_currency)\n order2.received_amount.should.equal(@order.offered_amount)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "test/datastore/order_spec.coffee", "license": "MIT", "commit": "52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/test/datastore/order_spec.coffee", "line_start": 1, "line_end": 38} +{"id": "buttercoin/buttercoin:test/datastore/order_spec.coffee:1:completion", "type": "completion", "prompt": "Order = require('../../lib/datastore/order')\n\ndescribe 'Order', ->\n beforeEach ->\n @account = {}\n @order = new Order({}, 'USD', 1, 'BTC', 10)\n\n it 'should be clonable', ->\n @order.clone.should.exist\n order2 = @order.clone()\n\n order2.account.should.equal(@order.account)\n @order.account = null\n order2.account.should.not.equal(@order.account)\n\n order2.offered_currency.should.equal(@order.offered_currency)\n @order.offered_currency = null\n order2.offered_currency.should.not.equal(@order.offered_currency)", "response": "order2.offered_amount.should.equal(@order.offered_amount)\n @order.offered_amount = null\n order2.offered_amount.should.not.equal(@order.offered_amount)\n\n order2.received_currency.should.equal(@order.received_currency)\n @order.received_currency = null\n order2.received_currency.should.not.equal(@order.received_currency)\n\n order2.received_amount.should.equal(@order.received_amount)\n @order.received_amount = null\n order2.received_amount.should.not.equal(@order.received_amount)\n\n it 'should be able to produce a mirrored copy', ->\n order2 = @order.clone(true)\n order2.account.should.equal(@order.account)\n order2.offered_currency.should.equal(@order.received_currency)\n order2.offered_amount.should.equal(@order.received_amount)\n order2.received_currency.should.equal(@order.offered_currency)\n order2.received_amount.should.equal(@order.offered_amount)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "test/datastore/order_spec.coffee", "license": "MIT", "commit": "52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/test/datastore/order_spec.coffee", "line_start": 1, "line_end": 38} +{"id": "jianliaoim/talk-os:talk-api2x/mshells/append-has-tag.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "messages = db.messages.find({hasTag: null}, {tags: 1})\n\nnum = 0\n\nmessages.forEach (message) ->\n num += 1\n print \"Scan num\", num unless num % 10000\n hasTag = if message.tags?.length then true else false\n db.messages.update({_id: message._id}, {$set: {hasTag: hasTag}})\n\nprint \"Finish num\", num", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/append-has-tag.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/append-has-tag.coffee", "line_start": 1, "line_end": 11} +{"id": "jianliaoim/talk-os:talk-api2x/mshells/append-has-tag.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmessages = db.messages.find({hasTag: null}, {tags: 1})\n\nnum = 0\n\nmessages.forEach (message) ->\n num += 1\n print \"Scan num\", num unless num % 10000\n hasTag = if message.tags?.length then true else false\n db.messages.update({_id: message._id}, {$set: {hasTag: hasTag}})\n\nprint \"Finish num\", num\n```", "response": "var messages, num;\n\nmessages = db.messages.find({\n hasTag: null\n}, {\n tags: 1\n});\n\nnum = 0;\n\nmessages.forEach(function(message) {\n var hasTag, ref;\n num += 1;\n if (!(num % 10000)) {\n print(\"Scan num\", num);\n }\n hasTag = ((ref = message.tags) != null ? ref.length : void 0) ? true : false;\n return db.messages.update({\n _id: message._id\n }, {\n $set: {\n hasTag: hasTag\n }\n });\n});\n\nprint(\"Finish num\", num);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/append-has-tag.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/append-has-tag.coffee", "line_start": 1, "line_end": 11} +{"id": "jianliaoim/talk-os:talk-api2x/mshells/append-has-tag.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar messages, num;\n\nmessages = db.messages.find({\n hasTag: null\n}, {\n tags: 1\n});\n\nnum = 0;\n\nmessages.forEach(function(message) {\n var hasTag, ref;\n num += 1;\n if (!(num % 10000)) {\n print(\"Scan num\", num);\n }\n hasTag = ((ref = message.tags) != null ? ref.length : void 0) ? true : false;\n return db.messages.update({\n _id: message._id\n }, {\n $set: {\n hasTag: hasTag\n }\n });\n});\n\nprint(\"Finish num\", num);\n```", "response": "messages = db.messages.find({hasTag: null}, {tags: 1})\n\nnum = 0\n\nmessages.forEach (message) ->\n num += 1\n print \"Scan num\", num unless num % 10000\n hasTag = if message.tags?.length then true else false\n db.messages.update({_id: message._id}, {$set: {hasTag: hasTag}})\n\nprint \"Finish num\", num", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/append-has-tag.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/append-has-tag.coffee", "line_start": 1, "line_end": 11} +{"id": "jianliaoim/talk-os:talk-api2x/mshells/append-has-tag.coffee:1:completion", "type": "completion", "prompt": "messages = db.messages.find({hasTag: null}, {tags: 1})\n\nnum = 0\n\nmessages.forEach (message) ->", "response": "num += 1\n print \"Scan num\", num unless num % 10000\n hasTag = if message.tags?.length then true else false\n db.messages.update({_id: message._id}, {$set: {hasTag: hasTag}})\n\nprint \"Finish num\", num", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/append-has-tag.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/append-has-tag.coffee", "line_start": 1, "line_end": 11} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")\n```", "response": "/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, FortranBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = FortranBeautifier = (function() {\n class FortranBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_path, emacs_script_path, tempFile;\n this.debug('fortran-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\");\n }\n this.debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'f90-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\");\n }\n }\n\n };\n\n FortranBeautifier.prototype.name = \"Fortran Beautifier\";\n\n FortranBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n FortranBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n FortranBeautifier.prototype.options = {\n Fortran: true\n };\n\n return FortranBeautifier;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, FortranBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = FortranBeautifier = (function() {\n class FortranBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_path, emacs_script_path, tempFile;\n this.debug('fortran-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\");\n }\n this.debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'f90-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\");\n }\n }\n\n };\n\n FortranBeautifier.prototype.name = \"Fortran Beautifier\";\n\n FortranBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n FortranBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n FortranBeautifier.prototype.options = {\n Fortran: true\n };\n\n return FortranBeautifier;\n\n}).call(this);\n```", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:completion", "type": "completion", "prompt": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true", "response": "}\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@run(emacs_path, args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )\n else\n emacs.run(args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 51, "line_end": 59} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:2:completion", "type": "completion", "prompt": "@run(emacs_path, args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )", "response": "else\n emacs.run(args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 51, "line_end": 59} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecate(\"The \\\"emacs_path\\\" has been deprecated. Please switch to using the config with path \\\"Executables - Emacs - Path\\\" in Atom-Beautify package settings now.\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "bee7b2573a5cdf4fdf2c93f76533d00a13336f42", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/bee7b2573a5cdf4fdf2c93f76533d00a13336f42/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecate(\"The \\\"emacs_path\\\" has been deprecated. Please switch to using the config with path \\\"Executables - Emacs - Path\\\" in Atom-Beautify package settings now.\")\n```", "response": "/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, FortranBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = FortranBeautifier = (function() {\n class FortranBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_path, emacs_script_path, tempFile;\n this.debug('fortran-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\");\n }\n this.debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'f90-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.deprecate(\"The \\\"emacs_path\\\" has been deprecated. Please switch to using the config with path \\\"Executables - Emacs - Path\\\" in Atom-Beautify package settings now.\");\n }\n }\n\n };\n\n FortranBeautifier.prototype.name = \"Fortran Beautifier\";\n\n FortranBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n FortranBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n FortranBeautifier.prototype.options = {\n Fortran: true\n };\n\n return FortranBeautifier;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "bee7b2573a5cdf4fdf2c93f76533d00a13336f42", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/bee7b2573a5cdf4fdf2c93f76533d00a13336f42/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, FortranBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = FortranBeautifier = (function() {\n class FortranBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_path, emacs_script_path, tempFile;\n this.debug('fortran-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\");\n }\n this.debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'f90-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.deprecate(\"The \\\"emacs_path\\\" has been deprecated. Please switch to using the config with path \\\"Executables - Emacs - Path\\\" in Atom-Beautify package settings now.\");\n }\n }\n\n };\n\n FortranBeautifier.prototype.name = \"Fortran Beautifier\";\n\n FortranBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n FortranBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n FortranBeautifier.prototype.options = {\n Fortran: true\n };\n\n return FortranBeautifier;\n\n}).call(this);\n```", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecate(\"The \\\"emacs_path\\\" has been deprecated. Please switch to using the config with path \\\"Executables - Emacs - Path\\\" in Atom-Beautify package settings now.\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "bee7b2573a5cdf4fdf2c93f76533d00a13336f42", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/bee7b2573a5cdf4fdf2c93f76533d00a13336f42/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:completion", "type": "completion", "prompt": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Fortran: true", "response": "}\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecate(\"The \\\"emacs_path\\\" has been deprecated. Please switch to using the config with path \\\"Executables - Emacs - Path\\\" in Atom-Beautify package settings now.\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "bee7b2573a5cdf4fdf2c93f76533d00a13336f42", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/bee7b2573a5cdf4fdf2c93f76533d00a13336f42/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n isPreInstalled: false\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @run(emacs_path, args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )\n else\n @run(\"emacs\", args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 47} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n isPreInstalled: false\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @run(emacs_path, args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )\n else\n @run(\"emacs\", args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )\n```", "response": "/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, FortranBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = FortranBeautifier = (function() {\n class FortranBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs_path, emacs_script_path, tempFile;\n this.debug('fortran-beautifier', options);\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\");\n }\n this.debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'f90-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.run(emacs_path, args, {\n ignoreReturnCode: false\n }).then(() => {\n return this.readFile(tempFile);\n });\n } else {\n return this.run(\"emacs\", args, {\n ignoreReturnCode: false\n }).then(() => {\n return this.readFile(tempFile);\n });\n }\n }\n\n };\n\n FortranBeautifier.prototype.name = \"Fortran Beautifier\";\n\n FortranBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n FortranBeautifier.prototype.isPreInstalled = false;\n\n FortranBeautifier.prototype.options = {\n Fortran: true\n };\n\n return FortranBeautifier;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 47} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, FortranBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = FortranBeautifier = (function() {\n class FortranBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs_path, emacs_script_path, tempFile;\n this.debug('fortran-beautifier', options);\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\");\n }\n this.debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'f90-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.run(emacs_path, args, {\n ignoreReturnCode: false\n }).then(() => {\n return this.readFile(tempFile);\n });\n } else {\n return this.run(\"emacs\", args, {\n ignoreReturnCode: false\n }).then(() => {\n return this.readFile(tempFile);\n });\n }\n }\n\n };\n\n FortranBeautifier.prototype.name = \"Fortran Beautifier\";\n\n FortranBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n FortranBeautifier.prototype.isPreInstalled = false;\n\n FortranBeautifier.prototype.options = {\n Fortran: true\n };\n\n return FortranBeautifier;\n\n}).call(this);\n```", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n isPreInstalled: false\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @run(emacs_path, args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )\n else\n @run(\"emacs\", args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 47} +{"id": "Glavin001/atom-beautify:src/beautifiers/fortran-beautifier/index.coffee:1:completion", "type": "completion", "prompt": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class FortranBeautifier extends Beautifier\n name: \"Fortran Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n isPreInstalled: false\n\n options: {\n Fortran: true\n }\n\n beautify: (text, language, options) ->\n @debug('fortran-beautifier', options)\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path", "response": "if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-fortran-formating-script.lisp\")\n\n @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'f90-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @run(emacs_path, args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )\n else\n @run(\"emacs\", args, {ignoreReturnCode: false})\n .then(=>\n @readFile(tempFile)\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/fortran-beautifier/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/fortran-beautifier/index.coffee", "line_start": 1, "line_end": 47} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "\"use strict\"\n\ndefaults = require './defaults'\nbuilder = require './builder'\nparser = require './parser'\nprocessors = require './processors'\n\nexports.defaults = defaults.defaults\n\nexports.processors = processors\n\nclass exports.ValidationError extends Error\n constructor: (message) ->\n @message = message\n\nexports.Builder = builder.Builder\n\nexports.Parser = parser.Parser\n\nexports.parseString = parser.parseString\nexports.parseStringPromise = parser.parseStringPromise", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "7173c245aab4c2b417cd4c24f0b54e697a369864", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/7173c245aab4c2b417cd4c24f0b54e697a369864/src/xml2js.coffee", "line_start": 1, "line_end": 21} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "\"use strict\"\n\ndefaults = require './defaults'\nbuilder = require './builder'\nparser = require './parser'\nprocessors = require './processors'\n\nexports.defaults = defaults.defaults\n\nexports.processors = processors", "response": "class exports.ValidationError extends Error\n constructor: (message) ->\n @message = message\n\nexports.Builder = builder.Builder\n\nexports.Parser = parser.Parser\n\nexports.parseString = parser.parseString\nexports.parseStringPromise = parser.parseStringPromise", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "7173c245aab4c2b417cd4c24f0b54e697a369864", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/7173c245aab4c2b417cd4c24f0b54e697a369864/src/xml2js.coffee", "line_start": 1, "line_end": 21} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "\"use strict\"\n\ndefaults = require './defaults'\nbuilder = require './builder'\nparser = require './parser'\nprocessors = require './processors'\n\nexports.defaults = defaults.defaults\n\nexports.processors = processors\n\nclass exports.ValidationError extends Error\n constructor: (message) ->\n @message = message\n\nexports.Builder = builder.Builder\n\nexports.Parser = parser.Parser\n\nexports.parseString = parser.parseString", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "57dca2f7fcf359d6505ce94d98921335935e83e7", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/57dca2f7fcf359d6505ce94d98921335935e83e7/src/xml2js.coffee", "line_start": 1, "line_end": 20} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "\"use strict\"\n\ndefaults = require './defaults'\nbuilder = require './builder'\nparser = require './parser'\nprocessors = require './processors'\n\nexports.defaults = defaults.defaults\n\nexports.processors = processors", "response": "class exports.ValidationError extends Error\n constructor: (message) ->\n @message = message\n\nexports.Builder = builder.Builder\n\nexports.Parser = parser.Parser\n\nexports.parseString = parser.parseString", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "57dca2f7fcf359d6505ce94d98921335935e83e7", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/57dca2f7fcf359d6505ce94d98921335935e83e7/src/xml2js.coffee", "line_start": 1, "line_end": 20} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n normalizeTags: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 5, "line_end": 40} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n normalizeTags: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null\n```", "response": "var isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // normalize tag names to lower case\n normalizeTags: false,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n normalizeTags: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 5, "line_end": 40} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // normalize tag names to lower case\n normalizeTags: false,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n normalizeTags: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};\n```", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n normalizeTags: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 5, "line_end": 40} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless", "response": "ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n normalizeTags: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 5, "line_end": 40} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.ValidationError extends Error\n constructor: (message) ->\n @message = message", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 42, "line_end": 44} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # copy this versions default options\n @options = {}\n @options[key] = value for own key, value of exports.defaults[\"0.2\"]\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 46, "line_end": 95} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # copy this versions default options\n @options = {}\n @options[key] = value for own key, value of exports.defaults[\"0.2\"]\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>", "response": "if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 46, "line_end": 95} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# need a place to store the node name\n obj[\"#name\"] = if @options.normalizeTags then node.name.toLowerCase() else node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 96, "line_end": 145} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "# need a place to store the node name\n obj[\"#name\"] = if @options.normalizeTags then node.name.toLowerCase() else node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag", "response": "if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 96, "line_end": 145} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 146, "line_end": 175} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:completion", "type": "completion", "prompt": "obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result", "response": "@on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/cd43a5ddaed4cd227561cab9a8c3fc7774f1d20d/src/xml2js.coffee", "line_start": 146, "line_end": 175} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 5, "line_end": 39} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null\n```", "response": "var isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // normalize tag names to lower case\n normalizeTags: false,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 5, "line_end": 39} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // normalize tag names to lower case\n normalizeTags: false,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};\n```", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 5, "line_end": 39} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # normalize tag names to lower case\n normalizeTags: false\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false", "response": "# ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 5, "line_end": 39} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n if @options.normalizeTags\n nodeName = nodeName.toLowerCase()\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 95, "line_end": 144} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n if @options.normalizeTags\n nodeName = nodeName.toLowerCase()\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]", "response": "if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 95, "line_end": 144} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 145, "line_end": 177} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:completion", "type": "completion", "prompt": "# avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->", "response": "@reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "048f20b78b4185adb2d4cd5a909e061a3ee882cd", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/048f20b78b4185adb2d4cd5a909e061a3ee882cd/src/xml2js.coffee", "line_start": 145, "line_end": 177} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "df32c2346bbdba268aa500643e484b3fbed71dc3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/df32c2346bbdba268aa500643e484b3fbed71dc3/src/xml2js.coffee", "line_start": 5, "line_end": 37} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null\n```", "response": "var isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "df32c2346bbdba268aa500643e484b3fbed71dc3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/df32c2346bbdba268aa500643e484b3fbed71dc3/src/xml2js.coffee", "line_start": 5, "line_end": 37} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};\n```", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "df32c2346bbdba268aa500643e484b3fbed71dc3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/df32c2346bbdba268aa500643e484b3fbed71dc3/src/xml2js.coffee", "line_start": 5, "line_end": 37} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless", "response": "ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n charkey: \"_\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "df32c2346bbdba268aa500643e484b3fbed71dc3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/df32c2346bbdba268aa500643e484b3fbed71dc3/src/xml2js.coffee", "line_start": 5, "line_end": 37} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "df32c2346bbdba268aa500643e484b3fbed71dc3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/df32c2346bbdba268aa500643e484b3fbed71dc3/src/xml2js.coffee", "line_start": 93, "line_end": 142} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag", "response": "if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "df32c2346bbdba268aa500643e484b3fbed71dc3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/df32c2346bbdba268aa500643e484b3fbed71dc3/src/xml2js.coffee", "line_start": 93, "line_end": 142} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # copy this versions default options\n @options = {}\n @options[key] = value for own key, value of exports.defaults[\"0.1\"]\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "1991d13c3a5308e7482ee1635aaa41c93ca05124", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/1991d13c3a5308e7482ee1635aaa41c93ca05124/src/xml2js.coffee", "line_start": 43, "line_end": 92} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # copy this versions default options\n @options = {}\n @options[key] = value for own key, value of exports.defaults[\"0.1\"]\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>", "response": "if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "1991d13c3a5308e7482ee1635aaa41c93ca05124", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/1991d13c3a5308e7482ee1635aaa41c93ca05124/src/xml2js.coffee", "line_start": 43, "line_end": 92} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8de66fa66ac121915cfb64b65e16faaae55ca75a", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8de66fa66ac121915cfb64b65e16faaae55ca75a/src/xml2js.coffee", "line_start": 5, "line_end": 38} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null\n```", "response": "var isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n // not sure if # is the best idea, will investigate\n charkey: \"#\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8de66fa66ac121915cfb64b65e16faaae55ca75a", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8de66fa66ac121915cfb64b65e16faaae55ca75a/src/xml2js.coffee", "line_start": 5, "line_end": 38} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n explicitRoot: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n // not sure if # is the best idea, will investigate\n charkey: \"#\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null\n }\n};\n```", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8de66fa66ac121915cfb64b65e16faaae55ca75a", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8de66fa66ac121915cfb64b65e16faaae55ca75a/src/xml2js.coffee", "line_start": 5, "line_end": 38} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false", "response": "# merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n explicitRoot: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n explicitRoot: true\n validator: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8de66fa66ac121915cfb64b65e16faaae55ca75a", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8de66fa66ac121915cfb64b65e16faaae55ca75a/src/xml2js.coffee", "line_start": 5, "line_end": 38} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n validator: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "2164d82cf880871e0554c8dd8d1e39a7a7051002", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/2164d82cf880871e0554c8dd8d1e39a7a7051002/src/xml2js.coffee", "line_start": 5, "line_end": 36} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n validator: null\n```", "response": "var isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n // not sure if # is the best idea, will investigate\n charkey: \"#\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n validator: null\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "2164d82cf880871e0554c8dd8d1e39a7a7051002", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/2164d82cf880871e0554c8dd8d1e39a7a7051002/src/xml2js.coffee", "line_start": 5, "line_end": 36} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false,\n validator: null\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n // not sure if # is the best idea, will investigate\n charkey: \"#\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n validator: null\n }\n};\n```", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n validator: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "2164d82cf880871e0554c8dd8d1e39a7a7051002", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/2164d82cf880871e0554c8dd8d1e39a7a7051002/src/xml2js.coffee", "line_start": 5, "line_end": 36} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless", "response": "ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n validator: null\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n validator: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "2164d82cf880871e0554c8dd8d1e39a7a7051002", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/2164d82cf880871e0554c8dd8d1e39a7a7051002/src/xml2js.coffee", "line_start": 5, "line_end": 36} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 5, "line_end": 34} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false\n```", "response": "var isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n // not sure if # is the best idea, will investigate\n charkey: \"#\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 5, "line_end": 34} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isEmpty;\n\nisEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n};\n\nexports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n // normalize implicates trimming, just so you know\n normalize: true,\n // set default attribute object key\n attrkey: \"@\",\n // set default char object key\n charkey: \"#\",\n // always put child nodes in an array\n explicitArray: false,\n // ignore all attributes regardless\n ignoreAttrs: false,\n // merge attributes and child elements onto parent object. this may\n // cause collisions.\n mergeAttrs: false\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n attrkey: \"$\",\n // not sure if # is the best idea, will investigate\n charkey: \"#\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false\n }\n};\n```", "response": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 5, "line_end": 34} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "isEmpty = (thing) ->\n return typeof thing is \"object\" && thing? && Object.keys(thing).length is 0\n\nexports.defaults =\n \"0.1\":\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false", "response": "# ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n \"0.2\":\n explicitCharkey: false\n trim: false\n normalize: false\n attrkey: \"$\"\n # not sure if # is the best idea, will investigate\n charkey: \"#\"\n explicitArray: true\n ignoreAttrs: false\n mergeAttrs: false", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 5, "line_end": 34} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # copy this versions default options\n @options = value for own key, value of exports.defaults[\"0.1\"]\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 36, "line_end": 85} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # copy this versions default options\n @options = value for own key, value of exports.defaults[\"0.1\"]\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>", "response": "if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 36, "line_end": 85} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 86, "line_end": 135} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag", "response": "# check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 86, "line_end": 135} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 136, "line_end": 154} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()\n```", "response": "this.saxParser.ontext = this.saxParser.oncdata = (text) => {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[charkey] += text;\n }\n};\n\n({\n parseString: (str, cb) => {\n if ((cb != null) && typeof cb === \"function\") {\n this.on(\"end\", function(result) {\n this.reset();\n return cb(null, result);\n });\n this.on(\"error\", function(err) {\n this.reset();\n return cb(err);\n });\n }\n if (str.toString().trim() === '') {\n this.emit(\"end\", null);\n return true;\n }\n return this.saxParser.write(str.toString());\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 136, "line_end": 154} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis.saxParser.ontext = this.saxParser.oncdata = (text) => {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[charkey] += text;\n }\n};\n\n({\n parseString: (str, cb) => {\n if ((cb != null) && typeof cb === \"function\") {\n this.on(\"end\", function(result) {\n this.reset();\n return cb(null, result);\n });\n this.on(\"error\", function(err) {\n this.reset();\n return cb(err);\n });\n }\n if (str.toString().trim() === '') {\n this.emit(\"end\", null);\n return true;\n }\n return this.saxParser.write(str.toString());\n }\n});\n```", "response": "@saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 136, "line_end": 154} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "@saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()", "response": "cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "16084e47b0b13355828cac3503f43492a6d55581", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/16084e47b0b13355828cac3503f43492a6d55581/src/xml2js.coffee", "line_start": 136, "line_end": 154} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()", "response": "reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n```", "response": "// aliases, so we don't have to type so much\nvar attrkey, charkey,\n hasProp = {}.hasOwnProperty;\n\nattrkey = this.options.attrkey;\n\ncharkey = this.options.charkey;\n\nthis.saxParser.onopentag = (node) => {\n var key, obj, ref;\n obj = {};\n obj[charkey] = \"\";\n if (!this.options.ignoreAttrs) {\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(attrkey in obj) && !this.options.mergeAttrs) {\n obj[attrkey] = {};\n }\n if (this.options.mergeAttrs) {\n obj[key] = node.attributes[key];\n } else {\n obj[attrkey][key] = node.attributes[key];\n }\n }\n }\n // need a place to store the node name\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n};\n\nthis.saxParser.onclosetag = () => {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[charkey].match(/^\\s*$/)) {\n delete obj[charkey];\n } else {\n if (this.options.trim) {\n obj[charkey] = obj[charkey].trim();\n }\n if (this.options.normalize) {\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && charkey in obj && !this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n if (this.options.emptyTag !== void 0 && isEmpty(obj)) {\n obj = this.options.emptyTag;\n }\n // check whether we closed all the open tags\n if (stack.length > 0) {\n if (!this.options.explicitArray) {\n if (!(nodeName in s)) {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n return s[nodeName] = [old];\n }\n }\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// aliases, so we don't have to type so much\nvar attrkey, charkey,\n hasProp = {}.hasOwnProperty;\n\nattrkey = this.options.attrkey;\n\ncharkey = this.options.charkey;\n\nthis.saxParser.onopentag = (node) => {\n var key, obj, ref;\n obj = {};\n obj[charkey] = \"\";\n if (!this.options.ignoreAttrs) {\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(attrkey in obj) && !this.options.mergeAttrs) {\n obj[attrkey] = {};\n }\n if (this.options.mergeAttrs) {\n obj[key] = node.attributes[key];\n } else {\n obj[attrkey][key] = node.attributes[key];\n }\n }\n }\n // need a place to store the node name\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n};\n\nthis.saxParser.onclosetag = () => {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[charkey].match(/^\\s*$/)) {\n delete obj[charkey];\n } else {\n if (this.options.trim) {\n obj[charkey] = obj[charkey].trim();\n }\n if (this.options.normalize) {\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && charkey in obj && !this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n if (this.options.emptyTag !== void 0 && isEmpty(obj)) {\n obj = this.options.emptyTag;\n }\n // check whether we closed all the open tags\n if (stack.length > 0) {\n if (!this.options.explicitArray) {\n if (!(nodeName in s)) {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n return s[nodeName] = [old];\n }\n }\n }\n};\n```", "response": "# aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "# aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]", "response": "s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 108, "line_end": 142} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>", "response": "s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "de509d3e97b95c81ab5e3513fcabbf599986a6e3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/de509d3e97b95c81ab5e3513fcabbf599986a6e3/src/xml2js.coffee", "line_start": 108, "line_end": 142} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n # optional validator for schema-driven generawtion\n validator: null\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b023b382d12d72bf0a678fcd3b9f4e9f28fda928", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b023b382d12d72bf0a678fcd3b9f4e9f28fda928/src/xml2js.coffee", "line_start": 12, "line_end": 61} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # merge attributes and child elements onto parent object. this may\n # cause collisions.\n mergeAttrs: false\n # optional validator for schema-driven generawtion\n validator: null\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts", "response": "@reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b023b382d12d72bf0a678fcd3b9f4e9f28fda928", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b023b382d12d72bf0a678fcd3b9f4e9f28fda928/src/xml2js.coffee", "line_start": 12, "line_end": 61} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b023b382d12d72bf0a678fcd3b9f4e9f28fda928", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b023b382d12d72bf0a678fcd3b9f4e9f28fda928/src/xml2js.coffee", "line_start": 62, "line_end": 111} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "@resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]", "response": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n xpath = \"/\" + (node[\"#name\"] for node in stack).concat(nodeName).join(\"/\")\n obj = @options.validator(xpath, s and s[nodeName], obj)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b023b382d12d72bf0a678fcd3b9f4e9f28fda928", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b023b382d12d72bf0a678fcd3b9f4e9f28fda928/src/xml2js.coffee", "line_start": 62, "line_end": 111} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b023b382d12d72bf0a678fcd3b9f4e9f28fda928", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b023b382d12d72bf0a678fcd3b9f4e9f28fda928/src/xml2js.coffee", "line_start": 112, "line_end": 158} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:completion", "type": "completion", "prompt": "s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>", "response": "s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b023b382d12d72bf0a678fcd3b9f4e9f28fda928", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b023b382d12d72bf0a678fcd3b9f4e9f28fda928/src/xml2js.coffee", "line_start": 112, "line_end": 158} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n obj = @options.validator(obj, stack, nodeName)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a644bfdc8b9b7817144cdb8bf6a8a5eea7116254", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a644bfdc8b9b7817144cdb8bf6a8a5eea7116254/src/xml2js.coffee", "line_start": 62, "line_end": 111} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "@resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]", "response": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n obj = @options.validator(obj, stack, nodeName)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a644bfdc8b9b7817144cdb8bf6a8a5eea7116254", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a644bfdc8b9b7817144cdb8bf6a8a5eea7116254/src/xml2js.coffee", "line_start": 62, "line_end": 111} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a644bfdc8b9b7817144cdb8bf6a8a5eea7116254", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a644bfdc8b9b7817144cdb8bf6a8a5eea7116254/src/xml2js.coffee", "line_start": 112, "line_end": 157} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:5:completion", "type": "completion", "prompt": "else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]", "response": "if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n if ex instanceof exports.ValidationError\n @emit(\"error\", ex.message)\n else\n throw ex", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a644bfdc8b9b7817144cdb8bf6a8a5eea7116254", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a644bfdc8b9b7817144cdb8bf6a8a5eea7116254/src/xml2js.coffee", "line_start": 112, "line_end": 157} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n obj = @options.validator.validate(obj, stack, nodeName)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "5cb2296cca1e76ea473553607791416dd656aa1b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/5cb2296cca1e76ea473553607791416dd656aa1b/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "@resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj and not @options.mergeAttrs\n obj[attrkey] = {}\n if @options.mergeAttrs\n obj[key] = node.attributes[key]\n else\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]", "response": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n if @options.validator?\n obj = @options.validator.validate(obj, stack, nodeName)\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "5cb2296cca1e76ea473553607791416dd656aa1b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/5cb2296cca1e76ea473553607791416dd656aa1b/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n @emit(\"error\", ex.message)\n return @saxParser", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "5cb2296cca1e76ea473553607791416dd656aa1b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/5cb2296cca1e76ea473553607791416dd656aa1b/src/xml2js.coffee", "line_start": 108, "line_end": 151} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>", "response": "s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n try\n @saxParser.write str.toString()\n catch ex\n @emit(\"error\", ex.message)\n return @saxParser", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "5cb2296cca1e76ea473553607791416dd656aa1b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/5cb2296cca1e76ea473553607791416dd656aa1b/src/xml2js.coffee", "line_start": 108, "line_end": 151} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation\n @removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # remove all previous listeners for events, to prevent event listener\n # accumulation", "response": "@removeAllListeners()\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n```", "response": "var hasProp = {}.hasOwnProperty;\n\nthis.saxParser.onopentag = (node) => {\n var key, obj, ref;\n obj = {};\n obj[charkey] = \"\";\n if (!this.options.ignoreAttrs) {\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(attrkey in obj)) {\n obj[attrkey] = {};\n }\n obj[attrkey][key] = node.attributes[key];\n }\n }\n // need a place to store the node name\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n};\n\nthis.saxParser.onclosetag = () => {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[charkey].match(/^\\s*$/)) {\n delete obj[charkey];\n } else {\n if (this.options.trim) {\n obj[charkey] = obj[charkey].trim();\n }\n if (this.options.normalize) {\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && charkey in obj && !this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n if (this.options.emptyTag !== void 0 && isEmpty(obj)) {\n obj = this.options.emptyTag;\n }\n // check whether we closed all the open tags\n if (stack.length > 0) {\n if (!this.options.explicitArray) {\n if (!(nodeName in s)) {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n if (!(s[nodeName] instanceof Array)) {\n s[nodeName] = [];\n }\n return s[nodeName].push(obj);\n }\n } else {\n\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar hasProp = {}.hasOwnProperty;\n\nthis.saxParser.onopentag = (node) => {\n var key, obj, ref;\n obj = {};\n obj[charkey] = \"\";\n if (!this.options.ignoreAttrs) {\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(attrkey in obj)) {\n obj[attrkey] = {};\n }\n obj[attrkey][key] = node.attributes[key];\n }\n }\n // need a place to store the node name\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n};\n\nthis.saxParser.onclosetag = () => {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[charkey].match(/^\\s*$/)) {\n delete obj[charkey];\n } else {\n if (this.options.trim) {\n obj[charkey] = obj[charkey].trim();\n }\n if (this.options.normalize) {\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && charkey in obj && !this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n if (this.options.emptyTag !== void 0 && isEmpty(obj)) {\n obj = this.options.emptyTag;\n }\n // check whether we closed all the open tags\n if (stack.length > 0) {\n if (!this.options.explicitArray) {\n if (!(nodeName in s)) {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n if (!(s[nodeName] instanceof Array)) {\n s[nodeName] = [];\n }\n return s[nodeName].push(obj);\n }\n } else {\n\n }\n};\n```", "response": "@saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "@saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim", "response": "obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 108, "line_end": 136} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "# if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text", "response": "parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "b863ed92abfb92a9cb2cd82c636c492a13270327", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/b863ed92abfb92a9cb2cd82c636c492a13270327/src/xml2js.coffee", "line_start": 108, "line_end": 136} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c37c82a8b06fe2872f0d5d2334e78ff19aea7542", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c37c82a8b06fe2872f0d5d2334e78ff19aea7542/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n @options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # overwrite them with the specified options, if any\n @options[key] = value for own key, value of opts\n\n @reset()\n\n reset: =>\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful", "response": "@saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = @options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = @options.attrkey\n charkey = @options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c37c82a8b06fe2872f0d5d2334e78ff19aea7542", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c37c82a8b06fe2872f0d5d2334e78ff19aea7542/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c37c82a8b06fe2872f0d5d2334e78ff19aea7542", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c37c82a8b06fe2872f0d5d2334e78ff19aea7542/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "obj[charkey] = \"\"\n unless @options.ignoreAttrs\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if @options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if @options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set", "response": "if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if @options.emptyTag != undefined && isEmpty obj\n obj = @options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not @options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if @options.explicitRoot\n # avoid circular references", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c37c82a8b06fe2872f0d5d2334e78ff19aea7542", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c37c82a8b06fe2872f0d5d2334e78ff19aea7542/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c37c82a8b06fe2872f0d5d2334e78ff19aea7542", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c37c82a8b06fe2872f0d5d2334e78ff19aea7542/src/xml2js.coffee", "line_start": 108, "line_end": 133} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>", "response": "if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n @reset()\n cb null, result\n @on \"error\", (err) ->\n @reset()\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c37c82a8b06fe2872f0d5d2334e78ff19aea7542", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c37c82a8b06fe2872f0d5d2334e78ff19aea7542/src/xml2js.coffee", "line_start": 108, "line_end": 133} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = options.attrkey\n charkey = options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless options.ignoreAttrs", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # ignore all attributes regardless\n ignoreAttrs: false\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,", "response": "normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = options.attrkey\n charkey = options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n unless options.ignoreAttrs", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfor own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n```", "response": "var key, ref,\n hasProp = {}.hasOwnProperty;\n\nref = node.attributes;\nfor (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(attrkey in obj)) {\n obj[attrkey] = {};\n }\n obj[attrkey][key] = node.attributes[key];\n}\n\n// need a place to store the node name\nobj[\"#name\"] = node.name;\n\nstack.push(obj);\n\nthis.saxParser.onclosetag = () => {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[charkey].match(/^\\s*$/)) {\n delete obj[charkey];\n } else {\n if (options.trim) {\n obj[charkey] = obj[charkey].trim();\n }\n if (options.normalize) {\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && charkey in obj && !this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n if (options.emptyTag !== void 0 && isEmpty(obj)) {\n obj = options.emptyTag;\n }\n // check whether we closed all the open tags\n if (stack.length > 0) {\n if (!options.explicitArray) {\n if (!(nodeName in s)) {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n if (!(s[nodeName] instanceof Array)) {\n s[nodeName] = [];\n }\n return s[nodeName].push(obj);\n }\n } else {\n // if explicitRoot was specified, wrap stuff in the root tag name\n if (options.explicitRoot) {\n // avoid circular references\n old = obj;\n return obj = {};\n }\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar key, ref,\n hasProp = {}.hasOwnProperty;\n\nref = node.attributes;\nfor (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(attrkey in obj)) {\n obj[attrkey] = {};\n }\n obj[attrkey][key] = node.attributes[key];\n}\n\n// need a place to store the node name\nobj[\"#name\"] = node.name;\n\nstack.push(obj);\n\nthis.saxParser.onclosetag = () => {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[charkey].match(/^\\s*$/)) {\n delete obj[charkey];\n } else {\n if (options.trim) {\n obj[charkey] = obj[charkey].trim();\n }\n if (options.normalize) {\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && charkey in obj && !this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n if (options.emptyTag !== void 0 && isEmpty(obj)) {\n obj = options.emptyTag;\n }\n // check whether we closed all the open tags\n if (stack.length > 0) {\n if (!options.explicitArray) {\n if (!(nodeName in s)) {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n if (!(s[nodeName] instanceof Array)) {\n s[nodeName] = [];\n }\n return s[nodeName].push(obj);\n }\n } else {\n // if explicitRoot was specified, wrap stuff in the root tag name\n if (options.explicitRoot) {\n // avoid circular references\n old = obj;\n return obj = {};\n }\n }\n};\n```", "response": "for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]", "response": "if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n cb null, result\n @on \"error\", (err) ->\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 108, "line_end": 129} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>", "response": "if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n cb null, result\n @on \"error\", (err) ->\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "d41d510ce45211ed6cc9839c81c4a92e6a5e87cf", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/d41d510ce45211ed6cc9839c81c4a92e6a5e87cf/src/xml2js.coffee", "line_start": 108, "line_end": 129} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = options.attrkey\n charkey = options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c71e66c710ed98697e2079699c68589ea52c9595", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c71e66c710ed98697e2079699c68589ea52c9595/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # always put child nodes in an array\n explicitArray: false\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }", "response": "# emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = options.attrkey\n charkey = options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c71e66c710ed98697e2079699c68589ea52c9595", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c71e66c710ed98697e2079699c68589ea52c9595/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if not options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c71e66c710ed98697e2079699c68589ea52c9595", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c71e66c710ed98697e2079699c68589ea52c9595/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "obj[attrkey][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag", "response": "# check whether we closed all the open tags\n if stack.length > 0\n if not options.explicitArray\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n if not (s[nodeName] instanceof Array)\n s[nodeName] = []\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c71e66c710ed98697e2079699c68589ea52c9595", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c71e66c710ed98697e2079699c68589ea52c9595/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n cb null, result\n @on \"error\", (err) ->\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c71e66c710ed98697e2079699c68589ea52c9595", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c71e66c710ed98697e2079699c68589ea52c9595/src/xml2js.coffee", "line_start": 108, "line_end": 126} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"", "response": "@on \"end\", (result) ->\n cb null, result\n @on \"error\", (err) ->\n cb err\n\n if str.toString().trim() is ''\n @emit \"end\", null\n return true\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "c71e66c710ed98697e2079699c68589ea52c9595", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/c71e66c710ed98697e2079699c68589ea52c9595/src/xml2js.coffee", "line_start": 108, "line_end": 126} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n cb null, result\n @on \"error\", (err) ->\n cb err\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "6dff03b5e4c1f306bb286767061c6f296b6f761b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/6dff03b5e4c1f306bb286767061c6f296b6f761b/src/xml2js.coffee", "line_start": 108, "line_end": 122} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text", "response": "parseString: (str, cb) =>\n if cb? and typeof cb is \"function\"\n @on \"end\", (result) ->\n cb null, result\n @on \"error\", (err) ->\n cb err\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "6dff03b5e4c1f306bb286767061c6f296b6f761b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/6dff03b5e4c1f306bb286767061c6f296b6f761b/src/xml2js.coffee", "line_start": 108, "line_end": 122} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str, cb) =>\n if cb? and typeof cb is 'function'\n @on 'end', (result) ->\n cb null, result\n @on 'error', (err) ->\n cb err\n\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "f7436ce0eb0c876aa9b298413aa985b2040360d9", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/f7436ce0eb0c876aa9b298413aa985b2040360d9/src/xml2js.coffee", "line_start": 108, "line_end": 122} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text", "response": "parseString: (str, cb) =>\n if cb? and typeof cb is 'function'\n @on 'end', (result) ->\n cb null, result\n @on 'error', (err) ->\n cb err\n\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "f7436ce0eb0c876aa9b298413aa985b2040360d9", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/f7436ce0eb0c876aa9b298413aa985b2040360d9/src/xml2js.coffee", "line_start": 108, "line_end": 122} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "fd39560b891ad04b3d6b1086eb96e8b2e937288b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/fd39560b891ad04b3d6b1086eb96e8b2e937288b/src/xml2js.coffee", "line_start": 108, "line_end": 116} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:4:completion", "type": "completion", "prompt": "@emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]", "response": "if s\n s[charkey] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "fd39560b891ad04b3d6b1086eb96e8b2e937288b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/fd39560b891ad04b3d6b1086eb96e8b2e937288b/src/xml2js.coffee", "line_start": 108, "line_end": 116} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = options.attrkey\n charkey = options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "94da6991f5649c9b84a758d6d15f29490bff4867", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/94da6991f5649c9b84a758d6d15f29490bff4867/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }", "response": "# emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n # aliases, so we don't have to type so much\n attrkey = options.attrkey\n charkey = options.charkey\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[charkey] = \"\"\n for own key of node.attributes\n if attrkey not of obj\n obj[attrkey] = {}\n obj[attrkey][key] = node.attributes[key]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "94da6991f5649c9b84a758d6d15f29490bff4867", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/94da6991f5649c9b84a758d6d15f29490bff4867/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "94da6991f5649c9b84a758d6d15f29490bff4867", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/94da6991f5649c9b84a758d6d15f29490bff4867/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "# need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[charkey].match(/^\\s*$/)\n delete obj[charkey]\n else\n obj[charkey] = obj[charkey].trim() if options.trim\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY\n obj = obj[charkey]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag", "response": "# check whether we closed all the open tags\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[charkey] += text", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "94da6991f5649c9b84a758d6d15f29490bff4867", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/94da6991f5649c9b84a758d6d15f29490bff4867/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @ATTRKEY = options.attrkey\n @CHARKEY = options.charkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[@CHARKEY] = \"\"\n for own key of node.attributes\n if @ATTRKEY not of obj\n obj[@ATTRKEY] = {}\n obj[@ATTRKEY][key] = node.attributes[key]\n\n # need a place to store the node name", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "1a656087278c00cf9e206532e8c7ac08fab4620d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/1a656087278c00cf9e206532e8c7ac08fab4620d/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # set default attribute object key\n attrkey: \"@\"\n # set default char object key\n charkey: \"#\"\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but", "response": "# the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @ATTRKEY = options.attrkey\n @CHARKEY = options.charkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[@CHARKEY] = \"\"\n for own key of node.attributes\n if @ATTRKEY not of obj\n obj[@ATTRKEY] = {}\n obj[@ATTRKEY][key] = node.attributes[key]\n\n # need a place to store the node name", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "1a656087278c00cf9e206532e8c7ac08fab4620d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/1a656087278c00cf9e206532e8c7ac08fab4620d/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[@CHARKEY].match(/^\\s*$/)\n delete obj[@CHARKEY]\n else\n obj[@CHARKEY] = obj[@CHARKEY].trim() if options.trim\n obj[@CHARKEY] = obj[@CHARKEY].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and @CHARKEY of obj and not @EXPLICIT_CHARKEY\n obj = obj[@CHARKEY]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[@CHARKEY] += text\n\n parseString: (str) =>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "1a656087278c00cf9e206532e8c7ac08fab4620d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/1a656087278c00cf9e206532e8c7ac08fab4620d/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[@CHARKEY].match(/^\\s*$/)\n delete obj[@CHARKEY]\n else\n obj[@CHARKEY] = obj[@CHARKEY].trim() if options.trim\n obj[@CHARKEY] = obj[@CHARKEY].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and @CHARKEY of obj and not @EXPLICIT_CHARKEY\n obj = obj[@CHARKEY]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0", "response": "if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[@CHARKEY] += text\n\n parseString: (str) =>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "1a656087278c00cf9e206532e8c7ac08fab4620d", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/1a656087278c00cf9e206532e8c7ac08fab4620d/src/xml2js.coffee", "line_start": 58, "line_end": 107} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err\n err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e024b03581b1a8cbe7772b71f328d66800b70d80", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "class exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n\n # emit one error event if the sax parser fails. this is mostly a hack, but\n # the sax parser isn't state of the art either.\n err = false\n @saxParser.onerror = (error) =>\n if ! err", "response": "err = true\n @emit \"error\", error\n\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e024b03581b1a8cbe7772b71f328d66800b70d80", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/src/xml2js.coffee", "line_start": 8, "line_end": 57} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e024b03581b1a8cbe7772b71f328d66800b70d80", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/src/xml2js.coffee", "line_start": 58, "line_end": 102} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array", "response": "s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n # if explicitRoot was specified, wrap stuff in the root tag name\n if options.explicitRoot\n # avoid circular references\n old = obj\n obj = {}\n obj[nodeName] = old\n\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e024b03581b1a8cbe7772b71f328d66800b70d80", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/src/xml2js.coffee", "line_start": 58, "line_end": 102} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "5f54d6963b8a8b57f28dd3a8db2a22a2105837b3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/5f54d6963b8a8b57f28dd3a8db2a22a2105837b3/src/xml2js.coffee", "line_start": 58, "line_end": 95} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:3:completion", "type": "completion", "prompt": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if options.emptyTag != undefined && isEmpty obj\n obj = options.emptyTag\n\n # check whether we closed all the open tags\n if stack.length > 0", "response": "if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "5f54d6963b8a8b57f28dd3a8db2a22a2105837b3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/5f54d6963b8a8b57f28dd3a8db2a22a2105837b3/src/xml2js.coffee", "line_start": 58, "line_end": 95} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a48e4a4bec2576e9b091c3210a5fe06ea99f538a", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a48e4a4bec2576e9b091c3210a5fe06ea99f538a/src/xml2js.coffee", "line_start": 54, "line_end": 87} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj", "response": "else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a48e4a4bec2576e9b091c3210a5fe06ea99f538a", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a48e4a4bec2576e9b091c3210a5fe06ea99f538a/src/xml2js.coffee", "line_start": 54, "line_end": 87} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require 'sax'\nevents = require 'events'\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "7dddb3c5049f1b351824e993110569d77148ad2e", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require 'sax'\nevents = require 'events'\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor", "response": "@EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "7dddb3c5049f1b351824e993110569d77148ad2e", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "7dddb3c5049f1b351824e993110569d77148ad2e", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/src/xml2js.coffee", "line_start": 51, "line_end": 78} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else", "response": "old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "7dddb3c5049f1b351824e993110569d77148ad2e", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/src/xml2js.coffee", "line_start": 51, "line_end": 78} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nevents = require(\"events\")\n\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.\n # better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "29a619b91708aebf6c78af885fb42dc0b2aad4db", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/29a619b91708aebf6c78af885fb42dc0b2aad4db/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nevents = require(\"events\")\n\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n # always use the '#' key, even if there are no subkeys\n # setting this property by and is deprecated, yet still supported.", "response": "# better pass it as explicitCharkey option to the constructor\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "29a619b91708aebf6c78af885fb42dc0b2aad4db", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/29a619b91708aebf6c78af885fb42dc0b2aad4db/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "29a619b91708aebf6c78af885fb42dc0b2aad4db", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/29a619b91708aebf6c78af885fb42dc0b2aad4db/src/xml2js.coffee", "line_start": 51, "line_end": 79} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj", "response": "else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "29a619b91708aebf6c78af885fb42dc0b2aad4db", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/29a619b91708aebf6c78af885fb42dc0b2aad4db/src/xml2js.coffee", "line_start": 51, "line_end": 79} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nevents = require(\"events\")\n\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e1687bc96b0327db4aedaa136616790593724824", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nevents = require(\"events\")\n\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options. for compatibility's sake set to some\n # sub-optimal settings. might change in the future.\n options =\n explicitCharkey: false\n trim: true\n # normalize implicates trimming, just so you know\n normalize: true\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the SAX parser. tried trim and normalize, but they are not\n # very helpful\n @saxParser = sax.parser true, {\n trim: false,\n normalize: false\n }\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = options.explicitCharkey", "response": "@resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e1687bc96b0327db4aedaa136616790593724824", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e1687bc96b0327db4aedaa136616790593724824", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/src/xml2js.coffee", "line_start": 51, "line_end": 77} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nobj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()\n```", "response": "var obj, old;\n\n// also do away with '#' key altogether, if there's no subkeys\n// unless EXPLICIT_CHARKEY is set\nobj[\"#\"] = obj[\"#\"].trim()(options.trim ? (options.normalize ? obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() : void 0, Object.keys(obj).length === 1 && \"#\" in obj && !this.EXPLICIT_CHARKEY ? obj = obj[\"#\"] : void 0) : void 0);\n\nif (stack.length > 0) {\n if (!(nodeName in s)) {\n s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n s[nodeName].push(obj);\n }\n} else {\n this.resultObject = obj;\n this.emit(\"end\", this.resultObject);\n}\n\nthis.saxParser.ontext = this.saxParser.oncdata = (text) => {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += text;\n }\n};\n\n({\n parseString: (str) => {\n return this.saxParser.write(str.toString());\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e1687bc96b0327db4aedaa136616790593724824", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/src/xml2js.coffee", "line_start": 51, "line_end": 77} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar obj, old;\n\n// also do away with '#' key altogether, if there's no subkeys\n// unless EXPLICIT_CHARKEY is set\nobj[\"#\"] = obj[\"#\"].trim()(options.trim ? (options.normalize ? obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() : void 0, Object.keys(obj).length === 1 && \"#\" in obj && !this.EXPLICIT_CHARKEY ? obj = obj[\"#\"] : void 0) : void 0);\n\nif (stack.length > 0) {\n if (!(nodeName in s)) {\n s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n s[nodeName].push(obj);\n }\n} else {\n this.resultObject = obj;\n this.emit(\"end\", this.resultObject);\n}\n\nthis.saxParser.ontext = this.saxParser.oncdata = (text) => {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += text;\n }\n};\n\n({\n parseString: (str) => {\n return this.saxParser.write(str.toString());\n }\n});\n```", "response": "obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e1687bc96b0327db4aedaa136616790593724824", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/src/xml2js.coffee", "line_start": 51, "line_end": 77} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "obj[\"#\"] = obj[\"#\"].trim() if options.trim\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim() if options.normalize\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else", "response": "old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "e1687bc96b0327db4aedaa136616790593724824", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/src/xml2js.coffee", "line_start": 51, "line_end": 77} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nevents = require(\"events\")\n\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options\n options =\n explicitCharkey: false\n trim: false\n normalize: false\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the sax parser\n @saxParser = sax.parser true\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "054b79f2eab8754284fac4260dd356a87ef83e84", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/054b79f2eab8754284fac4260dd356a87ef83e84/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nevents = require(\"events\")\n\n\nclass exports.Parser extends events.EventEmitter\n constructor: (opts) ->\n\n # default options\n options =\n explicitCharkey: false\n trim: false\n normalize: false\n # overwrite them with the specified options, if any\n options[key] = value for own key, value of opts\n\n # make the sax parser\n @saxParser = sax.parser true\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = options.explicitCharkey\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"", "response": "for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "054b79f2eab8754284fac4260dd356a87ef83e84", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/054b79f2eab8754284fac4260dd356a87ef83e84/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "054b79f2eab8754284fac4260dd356a87ef83e84", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/054b79f2eab8754284fac4260dd356a87ef83e84/src/xml2js.coffee", "line_start": 51, "line_end": 71} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()\n```", "response": "var old;\n\nif (stack.length > 0) {\n if (!(nodeName in s)) {\n s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n s[nodeName].push(obj);\n }\n} else {\n this.resultObject = obj;\n this.emit(\"end\", this.resultObject);\n}\n\nthis.saxParser.ontext = this.saxParser.oncdata = (text) => {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += text;\n }\n};\n\n({\n parseString: (str) => {\n return this.saxParser.write(str.toString());\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "054b79f2eab8754284fac4260dd356a87ef83e84", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/054b79f2eab8754284fac4260dd356a87ef83e84/src/xml2js.coffee", "line_start": 51, "line_end": 71} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar old;\n\nif (stack.length > 0) {\n if (!(nodeName in s)) {\n s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n s[nodeName].push(obj);\n }\n} else {\n this.resultObject = obj;\n this.emit(\"end\", this.resultObject);\n}\n\nthis.saxParser.ontext = this.saxParser.oncdata = (text) => {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += text;\n }\n};\n\n({\n parseString: (str) => {\n return this.saxParser.write(str.toString());\n }\n});\n```", "response": "if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "054b79f2eab8754284fac4260dd356a87ef83e84", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/054b79f2eab8754284fac4260dd356a87ef83e84/src/xml2js.coffee", "line_start": 51, "line_end": 71} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj\n else", "response": "@resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "054b79f2eab8754284fac4260dd356a87ef83e84", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/054b79f2eab8754284fac4260dd356a87ef83e84/src/xml2js.coffee", "line_start": 51, "line_end": 71} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nevents = require(\"events\")\n\nclass exports.Parser extends events.EventEmitter\n constructor: ->\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "47fb32a5ebcda47d16800179e4c17a46825be5a4", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/47fb32a5ebcda47d16800179e4c17a46825be5a4/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nevents = require(\"events\")\n\nclass exports.Parser extends events.EventEmitter\n constructor: ->\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if \"@\" not of obj\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>", "response": "obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if nodeName not of s\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [old]\n s[nodeName].push obj", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "47fb32a5ebcda47d16800179e4c17a46825be5a4", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/47fb32a5ebcda47d16800179e4c17a46825be5a4/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "47fb32a5ebcda47d16800179e4c17a46825be5a4", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/47fb32a5ebcda47d16800179e4c17a46825be5a4/src/xml2js.coffee", "line_start": 51, "line_end": 61} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (text) =>", "response": "s = stack[stack.length - 1]\n if s\n s[\"#\"] += text\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "47fb32a5ebcda47d16800179e4c17a46825be5a4", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/47fb32a5ebcda47d16800179e4c17a46825be5a4/src/xml2js.coffee", "line_start": 51, "line_end": 61} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nevents = require(\"events\")\n\nclass exports.Parser extends events.EventEmitter\n constructor: ->\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nevents = require(\"events\")\n\nclass exports.Parser extends events.EventEmitter\n constructor: ->\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n\n @saxParser.onopentag = (node) =>\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = =>", "response": "obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not @EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c/src/xml2js.coffee", "line_start": 51, "line_end": 61} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "else\n @resultObject = obj\n @emit \"end\", @resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->", "response": "s = stack[stack.length - 1]\n if s\n s[\"#\"] += t\n\n parseString: (str) =>\n @saxParser.write str.toString()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a130536310e0cbc940a6ea69cb91c7b5cc2f6c9c/src/xml2js.coffee", "line_start": 51, "line_end": 61} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not that.EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "69e74053987ad46a175c8b2f127ac246c374bbd1", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/69e74053987ad46a175c8b2f127ac246c374bbd1/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not that.EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n```", "response": "var Parser, events, sax, sys,\n hasProp = {}.hasOwnProperty;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n // make the sax parser\n this.saxParser = sax.parser(true);\n // always use the '#' key, even if there are no subkeys\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj, ref;\n obj = {};\n obj[\"#\"] = \"\";\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(\"@\" in obj)) {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n // need a place to store the node name\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n return this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n // turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && \"#\" in obj && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "69e74053987ad46a175c8b2f127ac246c374bbd1", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/69e74053987ad46a175c8b2f127ac246c374bbd1/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Parser, events, sax, sys,\n hasProp = {}.hasOwnProperty;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n // make the sax parser\n this.saxParser = sax.parser(true);\n // always use the '#' key, even if there are no subkeys\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj, ref;\n obj = {};\n obj[\"#\"] = \"\";\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(\"@\" in obj)) {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n // need a place to store the node name\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n return this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n // remove the '#' key altogether if it's blank\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n // turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n // also do away with '#' key altogether, if there's no subkeys\n // unless EXPLICIT_CHARKEY is set\n if (Object.keys(obj).length === 1 && \"#\" in obj && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n }\n };\n};\n```", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not that.EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "69e74053987ad46a175c8b2f127ac246c374bbd1", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/69e74053987ad46a175c8b2f127ac246c374bbd1/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n # make the sax parser\n @saxParser = sax.parser(true)\n # always use the '#' key, even if there are no subkeys\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n # need a place to store the node name\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->", "response": "obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n # remove the '#' key altogether if it's blank\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n # turn 2 or more spaces into one space\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n # also do away with '#' key altogether, if there's no subkeys\n # unless EXPLICIT_CHARKEY is set\n if Object.keys(obj).length == 1 and \"#\" of obj and not that.EXPLICIT_CHARKEY\n obj = obj[\"#\"]\n\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "69e74053987ad46a175c8b2f127ac246c374bbd1", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/69e74053987ad46a175c8b2f127ac246c374bbd1/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t\n\n undefined\n\nsys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "69e74053987ad46a175c8b2f127ac246c374bbd1", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/69e74053987ad46a175c8b2f127ac246c374bbd1/src/xml2js.coffee", "line_start": 51, "line_end": 66} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "response": "undefined\n\nsys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "69e74053987ad46a175c8b2f127ac246c374bbd1", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/69e74053987ad46a175c8b2f127ac246c374bbd1/src/xml2js.coffee", "line_start": 51, "line_end": 66} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t\n```", "response": "var Parser, events, sax, sys,\n hasProp = {}.hasOwnProperty,\n indexOf = [].indexOf;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n this.saxParser = sax.parser(true);\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj, ref;\n obj = {};\n obj[\"#\"] = \"\";\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(\"@\" in obj)) {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n if (Object.keys(obj).length === 1 && indexOf.call(obj, \"#\") >= 0 && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n that.resultObject = obj;\n return that.emit(\"end\", that.resultObject);\n }\n };\n return this.saxParser.ontext = this.saxParser.oncdata = function(t) {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += t;\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Parser, events, sax, sys,\n hasProp = {}.hasOwnProperty,\n indexOf = [].indexOf;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n this.saxParser = sax.parser(true);\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj, ref;\n obj = {};\n obj[\"#\"] = \"\";\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(\"@\" in obj)) {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n if (Object.keys(obj).length === 1 && indexOf.call(obj, \"#\") >= 0 && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n that.resultObject = obj;\n return that.emit(\"end\", that.resultObject);\n }\n };\n return this.saxParser.ontext = this.saxParser.oncdata = function(t) {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += t;\n }\n };\n};\n```", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if not (\"@\" of obj)\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]", "response": "s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "undefined\n\nsys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 51, "line_end": 58} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nundefined\n\nsys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser\n```", "response": "void 0;\nsys.inherits(Parser, events.EventEmitter);\n\nParser.prototype.parseString = function(str) {\n return this.saxParser.write(str.toString());\n};\n\nexports.Parser = Parser;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 51, "line_end": 58} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvoid 0;\nsys.inherits(Parser, events.EventEmitter);\n\nParser.prototype.parseString = function(str) {\n return this.saxParser.write(str.toString());\n};\n\nexports.Parser = Parser;\n```", "response": "undefined\n\nsys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 51, "line_end": 58} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "undefined\n\nsys.inherits Parser, events.EventEmitter", "response": "Parser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "72e8fdc832471b4169c7f3982533e4439fad9b05", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/72e8fdc832471b4169c7f3982533e4439fad9b05/src/xml2js.coffee", "line_start": 51, "line_end": 58} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t\n```", "response": "var Parser, events, sax, sys,\n hasProp = {}.hasOwnProperty,\n indexOf = [].indexOf;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n this.saxParser = sax.parser(true);\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj, ref;\n obj = {};\n obj[\"#\"] = \"\";\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (typeof obj[\"@\"] === \"undefined\") {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n if (Object.keys(obj).length === 1 && indexOf.call(obj, \"#\") >= 0 && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n that.resultObject = obj;\n return that.emit(\"end\", that.resultObject);\n }\n };\n return this.saxParser.ontext = this.saxParser.oncdata = function(t) {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += t;\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Parser, events, sax, sys,\n hasProp = {}.hasOwnProperty,\n indexOf = [].indexOf;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n this.saxParser = sax.parser(true);\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj, ref;\n obj = {};\n obj[\"#\"] = \"\";\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (typeof obj[\"@\"] === \"undefined\") {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n if (Object.keys(obj).length === 1 && indexOf.call(obj, \"#\") >= 0 && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n that.resultObject = obj;\n return that.emit(\"end\", that.resultObject);\n }\n };\n return this.saxParser.ontext = this.saxParser.oncdata = function(t) {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += t;\n }\n };\n};\n```", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\n\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for own key of node.attributes\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]", "response": "s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/8d18e8bb6c9e804e640da4a6dcf31e15c8c545f3/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for key of node.attributes\n if node.attributes.hasOwnProperty(key)\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for key of node.attributes\n if node.attributes.hasOwnProperty(key)\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t\n```", "response": "var Parser, events, sax, sys,\n indexOf = [].indexOf;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n this.saxParser = sax.parser(true);\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj;\n obj = {};\n obj[\"#\"] = \"\";\n for (key in node.attributes) {\n if (node.attributes.hasOwnProperty(key)) {\n if (typeof obj[\"@\"] === \"undefined\") {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n }\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n if (Object.keys(obj).length === 1 && indexOf.call(obj, \"#\") >= 0 && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n that.resultObject = obj;\n return that.emit(\"end\", that.resultObject);\n }\n };\n return this.saxParser.ontext = this.saxParser.oncdata = function(t) {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += t;\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Parser, events, sax, sys,\n indexOf = [].indexOf;\n\nsax = require(\"sax\");\n\nsys = require(\"sys\");\n\nevents = require(\"events\");\n\nParser = function() {\n var stack, that;\n that = this;\n this.saxParser = sax.parser(true);\n this.EXPLICIT_CHARKEY = false;\n this.resultObject = null;\n stack = [];\n this.saxParser.onopentag = function(node) {\n var key, obj;\n obj = {};\n obj[\"#\"] = \"\";\n for (key in node.attributes) {\n if (node.attributes.hasOwnProperty(key)) {\n if (typeof obj[\"@\"] === \"undefined\") {\n obj[\"@\"] = {};\n }\n obj[\"@\"][key] = node.attributes[key];\n }\n }\n obj[\"#name\"] = node.name;\n return stack.push(obj);\n };\n this.saxParser.onclosetag = function() {\n var nodeName, obj, old, s;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n delete obj[\"#name\"];\n s = stack[stack.length - 1];\n if (obj[\"#\"].match(/^\\s*$/)) {\n delete obj[\"#\"];\n } else {\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim();\n if (Object.keys(obj).length === 1 && indexOf.call(obj, \"#\") >= 0 && !that.EXPLICIT_CHARKEY) {\n obj = obj[\"#\"];\n }\n }\n if (stack.length > 0) {\n if (typeof s[nodeName] === \"undefined\") {\n return s[nodeName] = obj;\n } else if (s[nodeName] instanceof Array) {\n return s[nodeName].push(obj);\n } else {\n old = s[nodeName];\n s[nodeName] = [old];\n return s[nodeName].push(obj);\n }\n } else {\n that.resultObject = obj;\n return that.emit(\"end\", that.resultObject);\n }\n };\n return this.saxParser.ontext = this.saxParser.oncdata = function(t) {\n var s;\n s = stack[stack.length - 1];\n if (s) {\n return s[\"#\"] += t;\n }\n };\n};\n```", "response": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for key of node.attributes\n if node.attributes.hasOwnProperty(key)\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]\n\n s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:1:completion", "type": "completion", "prompt": "sax = require(\"sax\")\nsys = require(\"sys\")\nevents = require(\"events\")\nParser = ->\n that = this\n @saxParser = sax.parser(true)\n @EXPLICIT_CHARKEY = false\n @resultObject = null\n stack = []\n @saxParser.onopentag = (node) ->\n obj = {}\n obj[\"#\"] = \"\"\n for key of node.attributes\n if node.attributes.hasOwnProperty(key)\n if typeof obj[\"@\"] == \"undefined\"\n obj[\"@\"] = {}\n obj[\"@\"][key] = node.attributes[key]\n obj[\"#name\"] = node.name\n stack.push obj\n\n @saxParser.onclosetag = ->\n obj = stack.pop()\n nodeName = obj[\"#name\"]\n delete obj[\"#name\"]", "response": "s = stack[stack.length - 1]\n if obj[\"#\"].match(/^\\s*$/)\n delete obj[\"#\"]\n else\n obj[\"#\"] = obj[\"#\"].replace(/\\s{2,}/g, \" \").trim()\n if Object.keys(obj).length == 1 and \"#\" in obj and not (that.EXPLICIT_CHARKEY)\n obj = obj[\"#\"]\n if stack.length > 0\n if typeof s[nodeName] == \"undefined\"\n s[nodeName] = obj\n else if s[nodeName] instanceof Array\n s[nodeName].push obj\n else\n old = s[nodeName]\n s[nodeName] = [ old ]\n s[nodeName].push obj\n else\n that.resultObject = obj\n that.emit \"end\", that.resultObject\n\n @saxParser.ontext = @saxParser.oncdata = (t) ->\n s = stack[stack.length - 1]\n if s\n s[\"#\"] += t", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 1, "line_end": 50} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 51, "line_end": 55} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser\n```", "response": "sys.inherits(Parser, events.EventEmitter);\n\nParser.prototype.parseString = function(str) {\n return this.saxParser.write(str.toString());\n};\n\nexports.Parser = Parser;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 51, "line_end": 55} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsys.inherits(Parser, events.EventEmitter);\n\nParser.prototype.parseString = function(str) {\n return this.saxParser.write(str.toString());\n};\n\nexports.Parser = Parser;\n```", "response": "sys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->\n @saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 51, "line_end": 55} +{"id": "Leonidas-from-XIV/node-xml2js:src/xml2js.coffee:2:completion", "type": "completion", "prompt": "sys.inherits Parser, events.EventEmitter\nParser::parseString = (str) ->", "response": "@saxParser.write str.toString()\n\nexports.Parser = Parser", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Leonidas-from-XIV/node-xml2js", "path": "src/xml2js.coffee", "license": "MIT", "commit": "a33d8f2e18f9f60b2f9554ade4d794a62215ce3b", "stars": 4965, "source_url": "https://github.com/Leonidas-from-XIV/node-xml2js/blob/a33d8f2e18f9f60b2f9554ade4d794a62215ce3b/src/xml2js.coffee", "line_start": 51, "line_end": 55} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{EventsDelegation} = require 'atom-utils'\nCompositeDisposable = null\n\nmodule.exports =\nclass StickyTitle\n EventsDelegation.includeInto(this)\n\n constructor: (@stickies, @scrollContainer) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n Array::forEach.call @stickies, (sticky) ->\n sticky.parentNode.style.height = sticky.offsetHeight + 'px'\n sticky.style.width = sticky.offsetWidth + 'px'\n\n @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>\n @scroll(e)\n\n dispose: ->\n @subscriptions.dispose()\n @stickies = null\n @scrollContainer = null\n\n scroll: (e) ->\n delta = if @lastScrollTop\n @lastScrollTop - @scrollContainer.scrollTop\n else\n 0\n\n Array::forEach.call @stickies, (sticky, i) =>\n nextSticky = @stickies[i + 1]\n prevSticky = @stickies[i - 1]\n scrollTop = @scrollContainer.getBoundingClientRect().top\n parentTop = sticky.parentNode.getBoundingClientRect().top\n {top} = sticky.getBoundingClientRect()\n\n if parentTop < scrollTop\n unless sticky.classList.contains('absolute')\n sticky.classList.add 'fixed'\n sticky.style.top = scrollTop + 'px'\n\n if nextSticky?\n nextTop = nextSticky.parentNode.getBoundingClientRect().top\n if top + sticky.offsetHeight >= nextTop\n sticky.classList.add('absolute')\n sticky.style.top = @scrollContainer.scrollTop + 'px'\n\n else\n sticky.classList.remove 'fixed'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{EventsDelegation} = require 'atom-utils'\nCompositeDisposable = null\n\nmodule.exports =\nclass StickyTitle\n EventsDelegation.includeInto(this)\n\n constructor: (@stickies, @scrollContainer) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n Array::forEach.call @stickies, (sticky) ->\n sticky.parentNode.style.height = sticky.offsetHeight + 'px'\n sticky.style.width = sticky.offsetWidth + 'px'\n\n @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>\n @scroll(e)\n\n dispose: ->\n @subscriptions.dispose()\n @stickies = null\n @scrollContainer = null\n\n scroll: (e) ->\n delta = if @lastScrollTop\n @lastScrollTop - @scrollContainer.scrollTop\n else\n 0\n\n Array::forEach.call @stickies, (sticky, i) =>\n nextSticky = @stickies[i + 1]\n prevSticky = @stickies[i - 1]\n scrollTop = @scrollContainer.getBoundingClientRect().top\n parentTop = sticky.parentNode.getBoundingClientRect().top\n {top} = sticky.getBoundingClientRect()\n\n if parentTop < scrollTop\n unless sticky.classList.contains('absolute')\n sticky.classList.add 'fixed'\n sticky.style.top = scrollTop + 'px'\n\n if nextSticky?\n nextTop = nextSticky.parentNode.getBoundingClientRect().top\n if top + sticky.offsetHeight >= nextTop\n sticky.classList.add('absolute')\n sticky.style.top = @scrollContainer.scrollTop + 'px'\n\n else\n sticky.classList.remove 'fixed'\n```", "response": "var CompositeDisposable, EventsDelegation, StickyTitle;\n\n({EventsDelegation} = require('atom-utils'));\n\nCompositeDisposable = null;\n\nmodule.exports = StickyTitle = (function() {\n class StickyTitle {\n constructor(stickies, scrollContainer) {\n this.stickies = stickies;\n this.scrollContainer = scrollContainer;\n if (CompositeDisposable == null) {\n CompositeDisposable = require('atom').CompositeDisposable;\n }\n this.subscriptions = new CompositeDisposable();\n Array.prototype.forEach.call(this.stickies, function(sticky) {\n sticky.parentNode.style.height = sticky.offsetHeight + 'px';\n return sticky.style.width = sticky.offsetWidth + 'px';\n });\n this.subscriptions.add(this.subscribeTo(this.scrollContainer, {\n 'scroll': (e) => {\n return this.scroll(e);\n }\n }));\n }\n\n dispose() {\n this.subscriptions.dispose();\n this.stickies = null;\n return this.scrollContainer = null;\n }\n\n scroll(e) {\n var delta;\n delta = this.lastScrollTop ? this.lastScrollTop - this.scrollContainer.scrollTop : 0;\n return Array.prototype.forEach.call(this.stickies, (sticky, i) => {\n var nextSticky, nextTop, parentTop, prevSticky, scrollTop, top;\n nextSticky = this.stickies[i + 1];\n prevSticky = this.stickies[i - 1];\n scrollTop = this.scrollContainer.getBoundingClientRect().top;\n parentTop = sticky.parentNode.getBoundingClientRect().top;\n ({top} = sticky.getBoundingClientRect());\n if (parentTop < scrollTop) {\n if (!sticky.classList.contains('absolute')) {\n sticky.classList.add('fixed');\n sticky.style.top = scrollTop + 'px';\n if (nextSticky != null) {\n nextTop = nextSticky.parentNode.getBoundingClientRect().top;\n if (top + sticky.offsetHeight >= nextTop) {\n sticky.classList.add('absolute');\n return sticky.style.top = this.scrollContainer.scrollTop + 'px';\n }\n }\n }\n } else {\n return sticky.classList.remove('fixed');\n }\n });\n }\n\n };\n\n EventsDelegation.includeInto(StickyTitle);\n\n return StickyTitle;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable, EventsDelegation, StickyTitle;\n\n({EventsDelegation} = require('atom-utils'));\n\nCompositeDisposable = null;\n\nmodule.exports = StickyTitle = (function() {\n class StickyTitle {\n constructor(stickies, scrollContainer) {\n this.stickies = stickies;\n this.scrollContainer = scrollContainer;\n if (CompositeDisposable == null) {\n CompositeDisposable = require('atom').CompositeDisposable;\n }\n this.subscriptions = new CompositeDisposable();\n Array.prototype.forEach.call(this.stickies, function(sticky) {\n sticky.parentNode.style.height = sticky.offsetHeight + 'px';\n return sticky.style.width = sticky.offsetWidth + 'px';\n });\n this.subscriptions.add(this.subscribeTo(this.scrollContainer, {\n 'scroll': (e) => {\n return this.scroll(e);\n }\n }));\n }\n\n dispose() {\n this.subscriptions.dispose();\n this.stickies = null;\n return this.scrollContainer = null;\n }\n\n scroll(e) {\n var delta;\n delta = this.lastScrollTop ? this.lastScrollTop - this.scrollContainer.scrollTop : 0;\n return Array.prototype.forEach.call(this.stickies, (sticky, i) => {\n var nextSticky, nextTop, parentTop, prevSticky, scrollTop, top;\n nextSticky = this.stickies[i + 1];\n prevSticky = this.stickies[i - 1];\n scrollTop = this.scrollContainer.getBoundingClientRect().top;\n parentTop = sticky.parentNode.getBoundingClientRect().top;\n ({top} = sticky.getBoundingClientRect());\n if (parentTop < scrollTop) {\n if (!sticky.classList.contains('absolute')) {\n sticky.classList.add('fixed');\n sticky.style.top = scrollTop + 'px';\n if (nextSticky != null) {\n nextTop = nextSticky.parentNode.getBoundingClientRect().top;\n if (top + sticky.offsetHeight >= nextTop) {\n sticky.classList.add('absolute');\n return sticky.style.top = this.scrollContainer.scrollTop + 'px';\n }\n }\n }\n } else {\n return sticky.classList.remove('fixed');\n }\n });\n }\n\n };\n\n EventsDelegation.includeInto(StickyTitle);\n\n return StickyTitle;\n\n}).call(this);\n```", "response": "{EventsDelegation} = require 'atom-utils'\nCompositeDisposable = null\n\nmodule.exports =\nclass StickyTitle\n EventsDelegation.includeInto(this)\n\n constructor: (@stickies, @scrollContainer) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n Array::forEach.call @stickies, (sticky) ->\n sticky.parentNode.style.height = sticky.offsetHeight + 'px'\n sticky.style.width = sticky.offsetWidth + 'px'\n\n @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>\n @scroll(e)\n\n dispose: ->\n @subscriptions.dispose()\n @stickies = null\n @scrollContainer = null\n\n scroll: (e) ->\n delta = if @lastScrollTop\n @lastScrollTop - @scrollContainer.scrollTop\n else\n 0\n\n Array::forEach.call @stickies, (sticky, i) =>\n nextSticky = @stickies[i + 1]\n prevSticky = @stickies[i - 1]\n scrollTop = @scrollContainer.getBoundingClientRect().top\n parentTop = sticky.parentNode.getBoundingClientRect().top\n {top} = sticky.getBoundingClientRect()\n\n if parentTop < scrollTop\n unless sticky.classList.contains('absolute')\n sticky.classList.add 'fixed'\n sticky.style.top = scrollTop + 'px'\n\n if nextSticky?\n nextTop = nextSticky.parentNode.getBoundingClientRect().top\n if top + sticky.offsetHeight >= nextTop\n sticky.classList.add('absolute')\n sticky.style.top = @scrollContainer.scrollTop + 'px'\n\n else\n sticky.classList.remove 'fixed'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:1:completion", "type": "completion", "prompt": "{EventsDelegation} = require 'atom-utils'\nCompositeDisposable = null\n\nmodule.exports =\nclass StickyTitle\n EventsDelegation.includeInto(this)\n\n constructor: (@stickies, @scrollContainer) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n Array::forEach.call @stickies, (sticky) ->\n sticky.parentNode.style.height = sticky.offsetHeight + 'px'\n sticky.style.width = sticky.offsetWidth + 'px'\n\n @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>\n @scroll(e)\n\n dispose: ->\n @subscriptions.dispose()\n @stickies = null\n @scrollContainer = null\n\n scroll: (e) ->", "response": "delta = if @lastScrollTop\n @lastScrollTop - @scrollContainer.scrollTop\n else\n 0\n\n Array::forEach.call @stickies, (sticky, i) =>\n nextSticky = @stickies[i + 1]\n prevSticky = @stickies[i - 1]\n scrollTop = @scrollContainer.getBoundingClientRect().top\n parentTop = sticky.parentNode.getBoundingClientRect().top\n {top} = sticky.getBoundingClientRect()\n\n if parentTop < scrollTop\n unless sticky.classList.contains('absolute')\n sticky.classList.add 'fixed'\n sticky.style.top = scrollTop + 'px'\n\n if nextSticky?\n nextTop = nextSticky.parentNode.getBoundingClientRect().top\n if top + sticky.offsetHeight >= nextTop\n sticky.classList.add('absolute')\n sticky.style.top = @scrollContainer.scrollTop + 'px'\n\n else\n sticky.classList.remove 'fixed'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if prevSticky? and prevSticky.classList.contains('absolute')\n prevTop = prevSticky.getBoundingClientRect().top\n prevTop -= prevSticky.offsetHeight if delta < 0\n\n if scrollTop <= prevTop\n prevSticky.classList.remove('absolute')\n prevSticky.style.top = scrollTop + 'px'\n\n @lastScrollTop = @scrollContainer.scrollTop", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 51, "line_end": 59} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif prevSticky? and prevSticky.classList.contains('absolute')\n prevTop = prevSticky.getBoundingClientRect().top\n prevTop -= prevSticky.offsetHeight if delta < 0\n\n if scrollTop <= prevTop\n prevSticky.classList.remove('absolute')\n prevSticky.style.top = scrollTop + 'px'\n\n @lastScrollTop = @scrollContainer.scrollTop\n```", "response": "var prevTop;\n\nif ((typeof prevSticky !== \"undefined\" && prevSticky !== null) && prevSticky.classList.contains('absolute')) {\n prevTop = prevSticky.getBoundingClientRect().top;\n if (delta < 0) {\n prevTop -= prevSticky.offsetHeight;\n }\n if (scrollTop <= prevTop) {\n prevSticky.classList.remove('absolute');\n prevSticky.style.top = scrollTop + 'px';\n }\n}\n\nthis.lastScrollTop = this.scrollContainer.scrollTop;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 51, "line_end": 59} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar prevTop;\n\nif ((typeof prevSticky !== \"undefined\" && prevSticky !== null) && prevSticky.classList.contains('absolute')) {\n prevTop = prevSticky.getBoundingClientRect().top;\n if (delta < 0) {\n prevTop -= prevSticky.offsetHeight;\n }\n if (scrollTop <= prevTop) {\n prevSticky.classList.remove('absolute');\n prevSticky.style.top = scrollTop + 'px';\n }\n}\n\nthis.lastScrollTop = this.scrollContainer.scrollTop;\n```", "response": "if prevSticky? and prevSticky.classList.contains('absolute')\n prevTop = prevSticky.getBoundingClientRect().top\n prevTop -= prevSticky.offsetHeight if delta < 0\n\n if scrollTop <= prevTop\n prevSticky.classList.remove('absolute')\n prevSticky.style.top = scrollTop + 'px'\n\n @lastScrollTop = @scrollContainer.scrollTop", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 51, "line_end": 59} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:2:completion", "type": "completion", "prompt": "if prevSticky? and prevSticky.classList.contains('absolute')\n prevTop = prevSticky.getBoundingClientRect().top\n prevTop -= prevSticky.offsetHeight if delta < 0", "response": "if scrollTop <= prevTop\n prevSticky.classList.remove('absolute')\n prevSticky.style.top = scrollTop + 'px'\n\n @lastScrollTop = @scrollContainer.scrollTop", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/sticky-title.coffee", "line_start": 51, "line_end": 59} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{CompositeDisposable} = require 'atom'\n{EventsDelegation} = require 'atom-utils'\n\nmodule.exports =\n\nclass StickyTitle\n EventsDelegation.includeInto(this)\n\n constructor: (@stickies, @scrollContainer) ->\n @subscriptions = new CompositeDisposable\n Array::forEach.call @stickies, (sticky) ->\n sticky.parentNode.style.height = sticky.offsetHeight + 'px'\n sticky.style.width = sticky.offsetWidth + 'px'\n\n @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>\n @scroll(e)\n\n dispose: ->\n @subscriptions.dispose()\n @stickies = null\n @scrollContainer = null\n\n scroll: (e) ->\n delta = if @lastScrollTop\n @lastScrollTop - @scrollContainer.scrollTop\n else\n 0\n\n Array::forEach.call @stickies, (sticky, i) =>\n nextSticky = @stickies[i + 1]\n prevSticky = @stickies[i - 1]\n scrollTop = @scrollContainer.getBoundingClientRect().top\n parentTop = sticky.parentNode.getBoundingClientRect().top\n {top} = sticky.getBoundingClientRect()\n\n if parentTop < scrollTop\n unless sticky.classList.contains('absolute')\n sticky.classList.add 'fixed'\n sticky.style.top = scrollTop + 'px'\n\n if nextSticky?\n nextTop = nextSticky.parentNode.getBoundingClientRect().top\n if top + sticky.offsetHeight >= nextTop\n sticky.classList.add('absolute')\n sticky.style.top = @scrollContainer.scrollTop + 'px'\n\n else\n sticky.classList.remove 'fixed'\n\n if prevSticky? and prevSticky.classList.contains('absolute')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/sticky-title.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:1:completion", "type": "completion", "prompt": "{CompositeDisposable} = require 'atom'\n{EventsDelegation} = require 'atom-utils'\n\nmodule.exports =\n\nclass StickyTitle\n EventsDelegation.includeInto(this)\n\n constructor: (@stickies, @scrollContainer) ->\n @subscriptions = new CompositeDisposable\n Array::forEach.call @stickies, (sticky) ->\n sticky.parentNode.style.height = sticky.offsetHeight + 'px'\n sticky.style.width = sticky.offsetWidth + 'px'\n\n @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>\n @scroll(e)\n\n dispose: ->\n @subscriptions.dispose()\n @stickies = null\n @scrollContainer = null\n\n scroll: (e) ->\n delta = if @lastScrollTop\n @lastScrollTop - @scrollContainer.scrollTop", "response": "else\n 0\n\n Array::forEach.call @stickies, (sticky, i) =>\n nextSticky = @stickies[i + 1]\n prevSticky = @stickies[i - 1]\n scrollTop = @scrollContainer.getBoundingClientRect().top\n parentTop = sticky.parentNode.getBoundingClientRect().top\n {top} = sticky.getBoundingClientRect()\n\n if parentTop < scrollTop\n unless sticky.classList.contains('absolute')\n sticky.classList.add 'fixed'\n sticky.style.top = scrollTop + 'px'\n\n if nextSticky?\n nextTop = nextSticky.parentNode.getBoundingClientRect().top\n if top + sticky.offsetHeight >= nextTop\n sticky.classList.add('absolute')\n sticky.style.top = @scrollContainer.scrollTop + 'px'\n\n else\n sticky.classList.remove 'fixed'\n\n if prevSticky? and prevSticky.classList.contains('absolute')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/sticky-title.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "prevTop = prevSticky.getBoundingClientRect().top\n prevTop -= prevSticky.offsetHeight if delta < 0\n\n if scrollTop <= prevTop\n prevSticky.classList.remove('absolute')\n prevSticky.style.top = scrollTop + 'px'\n\n @lastScrollTop = @scrollContainer.scrollTop", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/sticky-title.coffee", "line_start": 51, "line_end": 58} +{"id": "abe33/atom-pigments:lib/sticky-title.coffee:2:completion", "type": "completion", "prompt": "prevTop = prevSticky.getBoundingClientRect().top\n prevTop -= prevSticky.offsetHeight if delta < 0\n\n if scrollTop <= prevTop", "response": "prevSticky.classList.remove('absolute')\n prevSticky.style.top = scrollTop + 'px'\n\n @lastScrollTop = @scrollContainer.scrollTop", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/sticky-title.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/sticky-title.coffee", "line_start": 51, "line_end": 58} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'snippet-editor'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _toId: T.string\n _roomId: T.string\n _teamId: T.string\n _storyId: T.string\n draftMode: T.bool\n onClose: T.func.isRequired\n onSubmit: T.func.isRequired\n attachment: T.object\n\n getInitialState: ->\n data: Immutable.fromJS\n text: @props.attachment?.text or ''\n title: @props.attachment?.title or ''\n codeType: @props.attachment?.codeType or 'txt'\n\n componentDidMount: ->\n lazyModules.ensureCodeEditor =>\n isLoadedCodeEditor = true\n @debounceSaveDraft = debounce @saveDraft, 500\n @forceUpdate()\n\n componentWillUnmount: ->\n @debounceSaveDraft = null\n\n saveDraft: (snippetDraft) ->\n _channelId = @props._roomId or @props._toId or @props._storyId\n hasDraft = @state.data.get('text').length or @state.data.get('title').length\n\n if _channelId?\n if hasDraft\n draftActions.saveSnippet @props._teamId, _channelId, snippetDraft.toJS()\n else\n draftActions.clearSnippet @props._teamId, _channelId\n\n saveState: (data) ->\n @setState\n data: data\n , =>\n @debounceSaveDraft data\n\n handleEditorChange: (text) ->\n data = @state.data.set 'text', text\n @saveState data\n\n handleSelectorChange: (codeType) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 23, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'snippet-editor'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _toId: T.string\n _roomId: T.string\n _teamId: T.string\n _storyId: T.string\n draftMode: T.bool\n onClose: T.func.isRequired\n onSubmit: T.func.isRequired\n attachment: T.object\n\n getInitialState: ->\n data: Immutable.fromJS\n text: @props.attachment?.text or ''\n title: @props.attachment?.title or ''\n codeType: @props.attachment?.codeType or 'txt'\n\n componentDidMount: ->\n lazyModules.ensureCodeEditor =>\n isLoadedCodeEditor = true\n @debounceSaveDraft = debounce @saveDraft, 500\n @forceUpdate()\n\n componentWillUnmount: ->\n @debounceSaveDraft = null\n\n saveDraft: (snippetDraft) ->\n _channelId = @props._roomId or @props._toId or @props._storyId\n hasDraft = @state.data.get('text').length or @state.data.get('title').length\n\n if _channelId?\n if hasDraft\n draftActions.saveSnippet @props._teamId, _channelId, snippetDraft.toJS()\n else\n draftActions.clearSnippet @props._teamId, _channelId\n\n saveState: (data) ->\n @setState\n data: data\n , =>\n @debounceSaveDraft data\n\n handleEditorChange: (text) ->\n data = @state.data.set 'text', text\n @saveState data\n\n handleSelectorChange: (codeType) ->\n```", "response": "module.exports = React.createClass({\n displayName: 'snippet-editor',\n mixins: [PureRenderMixin],\n propTypes: {\n _toId: T.string,\n _roomId: T.string,\n _teamId: T.string,\n _storyId: T.string,\n draftMode: T.bool,\n onClose: T.func.isRequired,\n onSubmit: T.func.isRequired,\n attachment: T.object\n },\n getInitialState: function() {\n var ref, ref1, ref2;\n return {\n data: Immutable.fromJS({\n text: ((ref = this.props.attachment) != null ? ref.text : void 0) || '',\n title: ((ref1 = this.props.attachment) != null ? ref1.title : void 0) || '',\n codeType: ((ref2 = this.props.attachment) != null ? ref2.codeType : void 0) || 'txt'\n })\n };\n },\n componentDidMount: function() {\n return lazyModules.ensureCodeEditor(() => {\n var isLoadedCodeEditor;\n isLoadedCodeEditor = true;\n this.debounceSaveDraft = debounce(this.saveDraft, 500);\n return this.forceUpdate();\n });\n },\n componentWillUnmount: function() {\n return this.debounceSaveDraft = null;\n },\n saveDraft: function(snippetDraft) {\n var _channelId, hasDraft;\n _channelId = this.props._roomId || this.props._toId || this.props._storyId;\n hasDraft = this.state.data.get('text').length || this.state.data.get('title').length;\n if (_channelId != null) {\n if (hasDraft) {\n return draftActions.saveSnippet(this.props._teamId, _channelId, snippetDraft.toJS());\n } else {\n return draftActions.clearSnippet(this.props._teamId, _channelId);\n }\n }\n },\n saveState: function(data) {\n return this.setState({\n data: data\n }, () => {\n return this.debounceSaveDraft(data);\n });\n },\n handleEditorChange: function(text) {\n var data;\n data = this.state.data.set('text', text);\n return this.saveState(data);\n },\n handleSelectorChange: function(codeType) {}\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 23, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'snippet-editor',\n mixins: [PureRenderMixin],\n propTypes: {\n _toId: T.string,\n _roomId: T.string,\n _teamId: T.string,\n _storyId: T.string,\n draftMode: T.bool,\n onClose: T.func.isRequired,\n onSubmit: T.func.isRequired,\n attachment: T.object\n },\n getInitialState: function() {\n var ref, ref1, ref2;\n return {\n data: Immutable.fromJS({\n text: ((ref = this.props.attachment) != null ? ref.text : void 0) || '',\n title: ((ref1 = this.props.attachment) != null ? ref1.title : void 0) || '',\n codeType: ((ref2 = this.props.attachment) != null ? ref2.codeType : void 0) || 'txt'\n })\n };\n },\n componentDidMount: function() {\n return lazyModules.ensureCodeEditor(() => {\n var isLoadedCodeEditor;\n isLoadedCodeEditor = true;\n this.debounceSaveDraft = debounce(this.saveDraft, 500);\n return this.forceUpdate();\n });\n },\n componentWillUnmount: function() {\n return this.debounceSaveDraft = null;\n },\n saveDraft: function(snippetDraft) {\n var _channelId, hasDraft;\n _channelId = this.props._roomId || this.props._toId || this.props._storyId;\n hasDraft = this.state.data.get('text').length || this.state.data.get('title').length;\n if (_channelId != null) {\n if (hasDraft) {\n return draftActions.saveSnippet(this.props._teamId, _channelId, snippetDraft.toJS());\n } else {\n return draftActions.clearSnippet(this.props._teamId, _channelId);\n }\n }\n },\n saveState: function(data) {\n return this.setState({\n data: data\n }, () => {\n return this.debounceSaveDraft(data);\n });\n },\n handleEditorChange: function(text) {\n var data;\n data = this.state.data.set('text', text);\n return this.saveState(data);\n },\n handleSelectorChange: function(codeType) {}\n});\n```", "response": "module.exports = React.createClass\n displayName: 'snippet-editor'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _toId: T.string\n _roomId: T.string\n _teamId: T.string\n _storyId: T.string\n draftMode: T.bool\n onClose: T.func.isRequired\n onSubmit: T.func.isRequired\n attachment: T.object\n\n getInitialState: ->\n data: Immutable.fromJS\n text: @props.attachment?.text or ''\n title: @props.attachment?.title or ''\n codeType: @props.attachment?.codeType or 'txt'\n\n componentDidMount: ->\n lazyModules.ensureCodeEditor =>\n isLoadedCodeEditor = true\n @debounceSaveDraft = debounce @saveDraft, 500\n @forceUpdate()\n\n componentWillUnmount: ->\n @debounceSaveDraft = null\n\n saveDraft: (snippetDraft) ->\n _channelId = @props._roomId or @props._toId or @props._storyId\n hasDraft = @state.data.get('text').length or @state.data.get('title').length\n\n if _channelId?\n if hasDraft\n draftActions.saveSnippet @props._teamId, _channelId, snippetDraft.toJS()\n else\n draftActions.clearSnippet @props._teamId, _channelId\n\n saveState: (data) ->\n @setState\n data: data\n , =>\n @debounceSaveDraft data\n\n handleEditorChange: (text) ->\n data = @state.data.set 'text', text\n @saveState data\n\n handleSelectorChange: (codeType) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 23, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'snippet-editor'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _toId: T.string\n _roomId: T.string\n _teamId: T.string\n _storyId: T.string\n draftMode: T.bool\n onClose: T.func.isRequired\n onSubmit: T.func.isRequired\n attachment: T.object\n\n getInitialState: ->\n data: Immutable.fromJS\n text: @props.attachment?.text or ''\n title: @props.attachment?.title or ''\n codeType: @props.attachment?.codeType or 'txt'\n\n componentDidMount: ->\n lazyModules.ensureCodeEditor =>\n isLoadedCodeEditor = true\n @debounceSaveDraft = debounce @saveDraft, 500\n @forceUpdate()", "response": "componentWillUnmount: ->\n @debounceSaveDraft = null\n\n saveDraft: (snippetDraft) ->\n _channelId = @props._roomId or @props._toId or @props._storyId\n hasDraft = @state.data.get('text').length or @state.data.get('title').length\n\n if _channelId?\n if hasDraft\n draftActions.saveSnippet @props._teamId, _channelId, snippetDraft.toJS()\n else\n draftActions.clearSnippet @props._teamId, _channelId\n\n saveState: (data) ->\n @setState\n data: data\n , =>\n @debounceSaveDraft data\n\n handleEditorChange: (text) ->\n data = @state.data.set 'text', text\n @saveState data\n\n handleSelectorChange: (codeType) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 23, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "data = @state.data.set 'codeType', codeType\n @saveState data\n\n handleTitleChange: (event) ->\n data = @state.data.set 'title', event.target.value\n @saveState data\n\n onSubmit: ->\n isEmpty = @state.data.get('text')?.trim().length is 0\n\n if isEmpty\n notifyActions.error lang.getText 'snippet-send-empty'\n return\n\n @props.onSubmit @state.data.toJS()\n\n renderCodeEditor: ->\n codeEditor = lazyModules.load 'code-editor'\n\n codeEditor\n text: @state.data.get 'text'\n codeType: snippetUtil.getCodemirror @state.data.get 'codeType'\n onChange: @handleEditorChange\n placeholder: lang.getText 'snippet-editor-placeholder'\n\n renderSelector: ->\n snippetSelector = lazyModules.load 'snippet-selector'\n\n snippetSelector\n onClick: @handleSelectorChange\n codeType: @state.data.get 'codeType'\n codeAssets: snippetUtil.getAssets()\n\n renderTitle: ->\n div className: 'title',\n input\n type: 'text', className: 'input'\n onChange: @handleTitleChange\n placeholder: lang.getText 'snippet-editor-title-placeholder'\n defaultValue: @state.data.get 'title'\n\n render: ->\n return null if not isLoadedCodeEditor\n\n isEmpty = @state.data.get('text')?.trim().length is 0\n buttonClassName = cx 'button',\n 'is-primary': not isEmpty\n 'is-disabled': isEmpty\n\n div className: 'snippet-editor', onClick: @onClick,", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 73, "line_end": 122} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:2:completion", "type": "completion", "prompt": "data = @state.data.set 'codeType', codeType\n @saveState data\n\n handleTitleChange: (event) ->\n data = @state.data.set 'title', event.target.value\n @saveState data\n\n onSubmit: ->\n isEmpty = @state.data.get('text')?.trim().length is 0\n\n if isEmpty\n notifyActions.error lang.getText 'snippet-send-empty'\n return\n\n @props.onSubmit @state.data.toJS()\n\n renderCodeEditor: ->\n codeEditor = lazyModules.load 'code-editor'\n\n codeEditor\n text: @state.data.get 'text'\n codeType: snippetUtil.getCodemirror @state.data.get 'codeType'\n onChange: @handleEditorChange\n placeholder: lang.getText 'snippet-editor-placeholder'", "response": "renderSelector: ->\n snippetSelector = lazyModules.load 'snippet-selector'\n\n snippetSelector\n onClick: @handleSelectorChange\n codeType: @state.data.get 'codeType'\n codeAssets: snippetUtil.getAssets()\n\n renderTitle: ->\n div className: 'title',\n input\n type: 'text', className: 'input'\n onChange: @handleTitleChange\n placeholder: lang.getText 'snippet-editor-title-placeholder'\n defaultValue: @state.data.get 'title'\n\n render: ->\n return null if not isLoadedCodeEditor\n\n isEmpty = @state.data.get('text')?.trim().length is 0\n buttonClassName = cx 'button',\n 'is-primary': not isEmpty\n 'is-disabled': isEmpty\n\n div className: 'snippet-editor', onClick: @onClick,", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 73, "line_end": 122} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "div className: 'header line',\n lang.getText 'snippet-editor'\n Icon name: 'remove', className: 'button-close', size: 20, onClick: @props.onClose\n div className: 'body',\n @renderTitle()\n @renderCodeEditor()\n div ref: 'footer', className: 'footer',\n @renderSelector()\n div className: 'buttons line',\n button className: buttonClassName, onClick: @onSubmit, disabled: isEmpty,\n if @props.draftMode\n lang.getText 'send'\n else\n lang.getText 'save'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 123, "line_end": 136} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndiv className: 'header line',\n lang.getText 'snippet-editor'\n Icon name: 'remove', className: 'button-close', size: 20, onClick: @props.onClose\n div className: 'body',\n @renderTitle()\n @renderCodeEditor()\n div ref: 'footer', className: 'footer',\n @renderSelector()\n div className: 'buttons line',\n button className: buttonClassName, onClick: @onSubmit, disabled: isEmpty,\n if @props.draftMode\n lang.getText 'send'\n else\n lang.getText 'save'\n```", "response": "div({\n className: 'header line'\n}, lang.getText('snippet-editor'), Icon({\n name: 'remove',\n className: 'button-close',\n size: 20,\n onClick: this.props.onClose\n}));\n\ndiv({\n className: 'body'\n}, this.renderTitle(), this.renderCodeEditor());\n\ndiv({\n ref: 'footer',\n className: 'footer'\n}, this.renderSelector(), div({\n className: 'buttons line'\n}, button({\n className: buttonClassName,\n onClick: this.onSubmit,\n disabled: isEmpty\n}, this.props.draftMode ? lang.getText('send') : lang.getText('save'))));", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 123, "line_end": 136} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndiv({\n className: 'header line'\n}, lang.getText('snippet-editor'), Icon({\n name: 'remove',\n className: 'button-close',\n size: 20,\n onClick: this.props.onClose\n}));\n\ndiv({\n className: 'body'\n}, this.renderTitle(), this.renderCodeEditor());\n\ndiv({\n ref: 'footer',\n className: 'footer'\n}, this.renderSelector(), div({\n className: 'buttons line'\n}, button({\n className: buttonClassName,\n onClick: this.onSubmit,\n disabled: isEmpty\n}, this.props.draftMode ? lang.getText('send') : lang.getText('save'))));\n```", "response": "div className: 'header line',\n lang.getText 'snippet-editor'\n Icon name: 'remove', className: 'button-close', size: 20, onClick: @props.onClose\n div className: 'body',\n @renderTitle()\n @renderCodeEditor()\n div ref: 'footer', className: 'footer',\n @renderSelector()\n div className: 'buttons line',\n button className: buttonClassName, onClick: @onSubmit, disabled: isEmpty,\n if @props.draftMode\n lang.getText 'send'\n else\n lang.getText 'save'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 123, "line_end": 136} +{"id": "jianliaoim/talk-os:talk-web/client/app/snippet-editor.coffee:3:completion", "type": "completion", "prompt": "div className: 'header line',\n lang.getText 'snippet-editor'\n Icon name: 'remove', className: 'button-close', size: 20, onClick: @props.onClose\n div className: 'body',\n @renderTitle()\n @renderCodeEditor()\n div ref: 'footer', className: 'footer',", "response": "@renderSelector()\n div className: 'buttons line',\n button className: buttonClassName, onClick: @onSubmit, disabled: isEmpty,\n if @props.draftMode\n lang.getText 'send'\n else\n lang.getText 'save'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/snippet-editor.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/snippet-editor.coffee", "line_start": 123, "line_end": 136} +{"id": "soulwire/Coffee-Physics:source/engine/integrator/ImprovedEuler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### Improved Euler Integrator ###\n\nclass ImprovedEuler extends Integrator\n\n # x += (v * dt) + (a * 0.5 * dt * dt)\n # v += a * dt\n\n integrate: (particles, dt, drag) ->\n\n acc = new Vector()\n vel = new Vector()\n\n dtSq = dt * dt\n\n for p in particles when not p.fixed\n\n # Store previous location.\n p.old.pos.copy p.pos\n\n # Scale force to mass.\n p.acc.scale p.massInv\n\n # Duplicate velocity to preserve momentum.\n vel.copy p.vel\n\n # Duplicate force.\n acc.copy p.acc\n\n # Update position.\n p.pos.add (vel.scale dt).add (acc.scale 0.5 * dtSq)\n\n # Update velocity.\n p.vel.add p.acc.scale dt\n\n # Apply friction.\n if drag then p.vel.scale drag\n\n # Reset forces.\n p.acc.clear()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/engine/integrator/ImprovedEuler.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/integrator/ImprovedEuler.coffee", "line_start": 1, "line_end": 39} +{"id": "soulwire/Coffee-Physics:source/engine/integrator/ImprovedEuler.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n### Improved Euler Integrator ###\n\nclass ImprovedEuler extends Integrator\n\n # x += (v * dt) + (a * 0.5 * dt * dt)\n # v += a * dt\n\n integrate: (particles, dt, drag) ->\n\n acc = new Vector()\n vel = new Vector()\n\n dtSq = dt * dt\n\n for p in particles when not p.fixed\n\n # Store previous location.\n p.old.pos.copy p.pos\n\n # Scale force to mass.\n p.acc.scale p.massInv\n\n # Duplicate velocity to preserve momentum.\n vel.copy p.vel\n\n # Duplicate force.\n acc.copy p.acc\n\n # Update position.\n p.pos.add (vel.scale dt).add (acc.scale 0.5 * dtSq)\n\n # Update velocity.\n p.vel.add p.acc.scale dt\n\n # Apply friction.\n if drag then p.vel.scale drag\n\n # Reset forces.\n p.acc.clear()\n```", "response": "/* Improved Euler Integrator */\nvar ImprovedEuler;\n\nImprovedEuler = class ImprovedEuler extends Integrator {\n // x += (v * dt) + (a * 0.5 * dt * dt)\n // v += a * dt\n integrate(particles, dt, drag) {\n var acc, dtSq, i, len, p, results, vel;\n acc = new Vector();\n vel = new Vector();\n dtSq = dt * dt;\n results = [];\n for (i = 0, len = particles.length; i < len; i++) {\n p = particles[i];\n if (!(!p.fixed)) {\n continue;\n }\n // Store previous location.\n p.old.pos.copy(p.pos);\n // Scale force to mass.\n p.acc.scale(p.massInv);\n // Duplicate velocity to preserve momentum.\n vel.copy(p.vel);\n // Duplicate force.\n acc.copy(p.acc);\n // Update position.\n p.pos.add((vel.scale(dt)).add(acc.scale(0.5 * dtSq)));\n // Update velocity.\n p.vel.add(p.acc.scale(dt));\n // Apply friction.\n if (drag) {\n p.vel.scale(drag);\n }\n // Reset forces.\n results.push(p.acc.clear());\n }\n return results;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soulwire/Coffee-Physics", "path": "source/engine/integrator/ImprovedEuler.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/integrator/ImprovedEuler.coffee", "line_start": 1, "line_end": 39} +{"id": "soulwire/Coffee-Physics:source/engine/integrator/ImprovedEuler.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/* Improved Euler Integrator */\nvar ImprovedEuler;\n\nImprovedEuler = class ImprovedEuler extends Integrator {\n // x += (v * dt) + (a * 0.5 * dt * dt)\n // v += a * dt\n integrate(particles, dt, drag) {\n var acc, dtSq, i, len, p, results, vel;\n acc = new Vector();\n vel = new Vector();\n dtSq = dt * dt;\n results = [];\n for (i = 0, len = particles.length; i < len; i++) {\n p = particles[i];\n if (!(!p.fixed)) {\n continue;\n }\n // Store previous location.\n p.old.pos.copy(p.pos);\n // Scale force to mass.\n p.acc.scale(p.massInv);\n // Duplicate velocity to preserve momentum.\n vel.copy(p.vel);\n // Duplicate force.\n acc.copy(p.acc);\n // Update position.\n p.pos.add((vel.scale(dt)).add(acc.scale(0.5 * dtSq)));\n // Update velocity.\n p.vel.add(p.acc.scale(dt));\n // Apply friction.\n if (drag) {\n p.vel.scale(drag);\n }\n // Reset forces.\n results.push(p.acc.clear());\n }\n return results;\n }\n\n};\n```", "response": "### Improved Euler Integrator ###\n\nclass ImprovedEuler extends Integrator\n\n # x += (v * dt) + (a * 0.5 * dt * dt)\n # v += a * dt\n\n integrate: (particles, dt, drag) ->\n\n acc = new Vector()\n vel = new Vector()\n\n dtSq = dt * dt\n\n for p in particles when not p.fixed\n\n # Store previous location.\n p.old.pos.copy p.pos\n\n # Scale force to mass.\n p.acc.scale p.massInv\n\n # Duplicate velocity to preserve momentum.\n vel.copy p.vel\n\n # Duplicate force.\n acc.copy p.acc\n\n # Update position.\n p.pos.add (vel.scale dt).add (acc.scale 0.5 * dtSq)\n\n # Update velocity.\n p.vel.add p.acc.scale dt\n\n # Apply friction.\n if drag then p.vel.scale drag\n\n # Reset forces.\n p.acc.clear()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/engine/integrator/ImprovedEuler.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/integrator/ImprovedEuler.coffee", "line_start": 1, "line_end": 39} +{"id": "soulwire/Coffee-Physics:source/engine/integrator/ImprovedEuler.coffee:1:completion", "type": "completion", "prompt": "### Improved Euler Integrator ###\n\nclass ImprovedEuler extends Integrator\n\n # x += (v * dt) + (a * 0.5 * dt * dt)\n # v += a * dt\n\n integrate: (particles, dt, drag) ->\n\n acc = new Vector()\n vel = new Vector()\n\n dtSq = dt * dt\n\n for p in particles when not p.fixed\n\n # Store previous location.\n p.old.pos.copy p.pos", "response": "# Scale force to mass.\n p.acc.scale p.massInv\n\n # Duplicate velocity to preserve momentum.\n vel.copy p.vel\n\n # Duplicate force.\n acc.copy p.acc\n\n # Update position.\n p.pos.add (vel.scale dt).add (acc.scale 0.5 * dtSq)\n\n # Update velocity.\n p.vel.add p.acc.scale dt\n\n # Apply friction.\n if drag then p.vel.scale drag\n\n # Reset forces.\n p.acc.clear()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/engine/integrator/ImprovedEuler.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/engine/integrator/ImprovedEuler.coffee", "line_start": 1, "line_end": 39} +{"id": "jianliaoim/talk-os:talk-account/client/entry/renderer.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Err = require 'err1st'\nconfig = require 'config'\nlogger = require 'graceful-logger'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nroutes = require '../routes'\nschema = require '../schema'\nlocales = require '../locales'\ntemplate = require './template'\n\nrouterUtil = require 'router-view/lib/path'\n\nmodule.exports = (req, res) ->\n router = routerUtil.getCurrentInfo routes, req.originalUrl\n next_url = req.cookies?.next_url\n\n {accounts, user} = req.get()\n\n store = schema.store\n # 设置用户信息\n .set 'user', Immutable.fromJS user\n # 设置路由\n .set 'router', router\n # configured siteUrl for redirecting\n .setIn ['client', 'siteUrl'], config.siteUrl\n .setIn ['config', 'siteUrl'], config.siteUrl\n .setIn ['config', 'accountUrl'], config.accountUrl\n .setIn ['config', 'cookieDomain'], config.cookieDomain\n .setIn ['config', 'weiboLogin'], config.weiboLogin\n .setIn ['config', 'firimLogin'], config.firimLogin\n .setIn ['config', 'githubLogin'], config.githubLogin\n .setIn ['config', 'trelloLogin'], config.trelloLogin\n .setIn ['config', 'teambitionLogin'], config.teambitionLogin\n # language detected from cookie and headers\n .setIn ['client', 'language'], req.getLocale()\n # /bind-thirdparty need an `method` for further behaviors\n .setIn ['client', 'serverAction'], (req.cookies?.method or null)\n # remember refer, client router will probably rewrite `query`\n .setIn ['client', 'referer'], router.getIn(['query', 'next_url']) or next_url\n # page of /accounts renders a list of accounts\n .setIn ['page', 'accounts'], Immutable.fromJS(accounts)\n .setIn ['client', 'captchaService'], config.captchaService\n\n if res.err?\n if res.err.code is 404\n res.status res.err.status\n store = store.set 'serverError', Immutable.fromJS\n status: 404\n message: locales.get('pageNotFound', req.getLocale())", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/entry/renderer.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/renderer.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-account/client/entry/renderer.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nErr = require 'err1st'\nconfig = require 'config'\nlogger = require 'graceful-logger'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nroutes = require '../routes'\nschema = require '../schema'\nlocales = require '../locales'\ntemplate = require './template'\n\nrouterUtil = require 'router-view/lib/path'\n\nmodule.exports = (req, res) ->\n router = routerUtil.getCurrentInfo routes, req.originalUrl\n next_url = req.cookies?.next_url\n\n {accounts, user} = req.get()\n\n store = schema.store\n # 设置用户信息\n .set 'user', Immutable.fromJS user\n # 设置路由\n .set 'router', router\n # configured siteUrl for redirecting\n .setIn ['client', 'siteUrl'], config.siteUrl\n .setIn ['config', 'siteUrl'], config.siteUrl\n .setIn ['config', 'accountUrl'], config.accountUrl\n .setIn ['config', 'cookieDomain'], config.cookieDomain\n .setIn ['config', 'weiboLogin'], config.weiboLogin\n .setIn ['config', 'firimLogin'], config.firimLogin\n .setIn ['config', 'githubLogin'], config.githubLogin\n .setIn ['config', 'trelloLogin'], config.trelloLogin\n .setIn ['config', 'teambitionLogin'], config.teambitionLogin\n # language detected from cookie and headers\n .setIn ['client', 'language'], req.getLocale()\n # /bind-thirdparty need an `method` for further behaviors\n .setIn ['client', 'serverAction'], (req.cookies?.method or null)\n # remember refer, client router will probably rewrite `query`\n .setIn ['client', 'referer'], router.getIn(['query', 'next_url']) or next_url\n # page of /accounts renders a list of accounts\n .setIn ['page', 'accounts'], Immutable.fromJS(accounts)\n .setIn ['client', 'captchaService'], config.captchaService\n\n if res.err?\n if res.err.code is 404\n res.status res.err.status\n store = store.set 'serverError', Immutable.fromJS\n status: 404\n message: locales.get('pageNotFound', req.getLocale())\n```", "response": "var Err, Immutable, config, locales, logger, recorder, routerUtil, routes, schema, template;\n\nErr = require('err1st');\n\nconfig = require('config');\n\nlogger = require('graceful-logger');\n\nrecorder = require('actions-recorder');\n\nImmutable = require('immutable');\n\nroutes = require('../routes');\n\nschema = require('../schema');\n\nlocales = require('../locales');\n\ntemplate = require('./template');\n\nrouterUtil = require('router-view/lib/path');\n\nmodule.exports = function(req, res) {\n var accounts, next_url, ref, ref1, router, store, user;\n router = routerUtil.getCurrentInfo(routes, req.originalUrl);\n next_url = (ref = req.cookies) != null ? ref.next_url : void 0;\n ({accounts, user} = req.get());\n // 设置用户信息\n // 设置路由\n // configured siteUrl for redirecting\n // language detected from cookie and headers\n // /bind-thirdparty need an `method` for further behaviors\n // remember refer, client router will probably rewrite `query`\n // page of /accounts renders a list of accounts\n store = schema.store.set('user', Immutable.fromJS(user)).set('router', router).setIn(['client', 'siteUrl'], config.siteUrl).setIn(['config', 'siteUrl'], config.siteUrl).setIn(['config', 'accountUrl'], config.accountUrl).setIn(['config', 'cookieDomain'], config.cookieDomain).setIn(['config', 'weiboLogin'], config.weiboLogin).setIn(['config', 'firimLogin'], config.firimLogin).setIn(['config', 'githubLogin'], config.githubLogin).setIn(['config', 'trelloLogin'], config.trelloLogin).setIn(['config', 'teambitionLogin'], config.teambitionLogin).setIn(['client', 'language'], req.getLocale()).setIn(['client', 'serverAction'], ((ref1 = req.cookies) != null ? ref1.method : void 0) || null).setIn(['client', 'referer'], router.getIn(['query', 'next_url']) || next_url).setIn(['page', 'accounts'], Immutable.fromJS(accounts)).setIn(['client', 'captchaService'], config.captchaService);\n if (res.err != null) {\n if (res.err.code === 404) {\n res.status(res.err.status);\n return store = store.set('serverError', Immutable.fromJS({\n status: 404,\n message: locales.get('pageNotFound', req.getLocale())\n }));\n }\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/entry/renderer.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/renderer.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-account/client/entry/renderer.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Err, Immutable, config, locales, logger, recorder, routerUtil, routes, schema, template;\n\nErr = require('err1st');\n\nconfig = require('config');\n\nlogger = require('graceful-logger');\n\nrecorder = require('actions-recorder');\n\nImmutable = require('immutable');\n\nroutes = require('../routes');\n\nschema = require('../schema');\n\nlocales = require('../locales');\n\ntemplate = require('./template');\n\nrouterUtil = require('router-view/lib/path');\n\nmodule.exports = function(req, res) {\n var accounts, next_url, ref, ref1, router, store, user;\n router = routerUtil.getCurrentInfo(routes, req.originalUrl);\n next_url = (ref = req.cookies) != null ? ref.next_url : void 0;\n ({accounts, user} = req.get());\n // 设置用户信息\n // 设置路由\n // configured siteUrl for redirecting\n // language detected from cookie and headers\n // /bind-thirdparty need an `method` for further behaviors\n // remember refer, client router will probably rewrite `query`\n // page of /accounts renders a list of accounts\n store = schema.store.set('user', Immutable.fromJS(user)).set('router', router).setIn(['client', 'siteUrl'], config.siteUrl).setIn(['config', 'siteUrl'], config.siteUrl).setIn(['config', 'accountUrl'], config.accountUrl).setIn(['config', 'cookieDomain'], config.cookieDomain).setIn(['config', 'weiboLogin'], config.weiboLogin).setIn(['config', 'firimLogin'], config.firimLogin).setIn(['config', 'githubLogin'], config.githubLogin).setIn(['config', 'trelloLogin'], config.trelloLogin).setIn(['config', 'teambitionLogin'], config.teambitionLogin).setIn(['client', 'language'], req.getLocale()).setIn(['client', 'serverAction'], ((ref1 = req.cookies) != null ? ref1.method : void 0) || null).setIn(['client', 'referer'], router.getIn(['query', 'next_url']) || next_url).setIn(['page', 'accounts'], Immutable.fromJS(accounts)).setIn(['client', 'captchaService'], config.captchaService);\n if (res.err != null) {\n if (res.err.code === 404) {\n res.status(res.err.status);\n return store = store.set('serverError', Immutable.fromJS({\n status: 404,\n message: locales.get('pageNotFound', req.getLocale())\n }));\n }\n }\n};\n```", "response": "Err = require 'err1st'\nconfig = require 'config'\nlogger = require 'graceful-logger'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nroutes = require '../routes'\nschema = require '../schema'\nlocales = require '../locales'\ntemplate = require './template'\n\nrouterUtil = require 'router-view/lib/path'\n\nmodule.exports = (req, res) ->\n router = routerUtil.getCurrentInfo routes, req.originalUrl\n next_url = req.cookies?.next_url\n\n {accounts, user} = req.get()\n\n store = schema.store\n # 设置用户信息\n .set 'user', Immutable.fromJS user\n # 设置路由\n .set 'router', router\n # configured siteUrl for redirecting\n .setIn ['client', 'siteUrl'], config.siteUrl\n .setIn ['config', 'siteUrl'], config.siteUrl\n .setIn ['config', 'accountUrl'], config.accountUrl\n .setIn ['config', 'cookieDomain'], config.cookieDomain\n .setIn ['config', 'weiboLogin'], config.weiboLogin\n .setIn ['config', 'firimLogin'], config.firimLogin\n .setIn ['config', 'githubLogin'], config.githubLogin\n .setIn ['config', 'trelloLogin'], config.trelloLogin\n .setIn ['config', 'teambitionLogin'], config.teambitionLogin\n # language detected from cookie and headers\n .setIn ['client', 'language'], req.getLocale()\n # /bind-thirdparty need an `method` for further behaviors\n .setIn ['client', 'serverAction'], (req.cookies?.method or null)\n # remember refer, client router will probably rewrite `query`\n .setIn ['client', 'referer'], router.getIn(['query', 'next_url']) or next_url\n # page of /accounts renders a list of accounts\n .setIn ['page', 'accounts'], Immutable.fromJS(accounts)\n .setIn ['client', 'captchaService'], config.captchaService\n\n if res.err?\n if res.err.code is 404\n res.status res.err.status\n store = store.set 'serverError', Immutable.fromJS\n status: 404\n message: locales.get('pageNotFound', req.getLocale())", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/entry/renderer.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/renderer.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-account/client/entry/renderer.coffee:1:completion", "type": "completion", "prompt": "Err = require 'err1st'\nconfig = require 'config'\nlogger = require 'graceful-logger'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nroutes = require '../routes'\nschema = require '../schema'\nlocales = require '../locales'\ntemplate = require './template'\n\nrouterUtil = require 'router-view/lib/path'\n\nmodule.exports = (req, res) ->\n router = routerUtil.getCurrentInfo routes, req.originalUrl\n next_url = req.cookies?.next_url\n\n {accounts, user} = req.get()\n\n store = schema.store\n # 设置用户信息\n .set 'user', Immutable.fromJS user\n # 设置路由\n .set 'router', router\n # configured siteUrl for redirecting", "response": ".setIn ['client', 'siteUrl'], config.siteUrl\n .setIn ['config', 'siteUrl'], config.siteUrl\n .setIn ['config', 'accountUrl'], config.accountUrl\n .setIn ['config', 'cookieDomain'], config.cookieDomain\n .setIn ['config', 'weiboLogin'], config.weiboLogin\n .setIn ['config', 'firimLogin'], config.firimLogin\n .setIn ['config', 'githubLogin'], config.githubLogin\n .setIn ['config', 'trelloLogin'], config.trelloLogin\n .setIn ['config', 'teambitionLogin'], config.teambitionLogin\n # language detected from cookie and headers\n .setIn ['client', 'language'], req.getLocale()\n # /bind-thirdparty need an `method` for further behaviors\n .setIn ['client', 'serverAction'], (req.cookies?.method or null)\n # remember refer, client router will probably rewrite `query`\n .setIn ['client', 'referer'], router.getIn(['query', 'next_url']) or next_url\n # page of /accounts renders a list of accounts\n .setIn ['page', 'accounts'], Immutable.fromJS(accounts)\n .setIn ['client', 'captchaService'], config.captchaService\n\n if res.err?\n if res.err.code is 404\n res.status res.err.status\n store = store.set 'serverError', Immutable.fromJS\n status: 404\n message: locales.get('pageNotFound', req.getLocale())", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/entry/renderer.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/renderer.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-account/client/entry/renderer.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n err = new Err(res.err) unless res.err instanceof Err\n # copied logics to write status code\n logger.warn err.stack if config.debug or err.code is 100\n res.status err.status\n store = store.set 'serverError', Immutable.fromJS\n status: err.status\n message: err.message\n\n recorder.setup initial: store\n res.end template.render(recorder.getCore())", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/entry/renderer.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/renderer.coffee", "line_start": 51, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-account/client/entry/renderer.coffee:2:completion", "type": "completion", "prompt": "else\n err = new Err(res.err) unless res.err instanceof Err\n # copied logics to write status code\n logger.warn err.stack if config.debug or err.code is 100\n res.status err.status", "response": "store = store.set 'serverError', Immutable.fromJS\n status: err.status\n message: err.message\n\n recorder.setup initial: store\n res.end template.render(recorder.getCore())", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/entry/renderer.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/renderer.coffee", "line_start": 51, "line_end": 61} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) ->\n try\n v = text.match(/uncrustify (\\d+\\.\\d+)/)[1]\n catch error\n @error(error)\n v = text.match(/Uncrustify-(\\d+\\.\\d+)/)[1] if not v?\n if v\n return v + \".0\"\n }\n docker: {\n image: \"unibeautify/uncrustify\"\n }\n }\n ]\n\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options, context) ->\n fileExtension = context.fileExtension\n\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) ->\n try\n v = text.match(/uncrustify (\\d+\\.\\d+)/)[1]\n catch error\n @error(error)\n v = text.match(/Uncrustify-(\\d+\\.\\d+)/)[1] if not v?\n if v\n return v + \".0\"\n }\n docker: {\n image: \"unibeautify/uncrustify\"\n }\n }\n ]", "response": "options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options, context) ->\n fileExtension = context.fileExtension\n\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text, fileExtension and \".#{fileExtension}\")\n \"-o\"\n outputFile = @tempFile(\"output\", text, fileExtension and \".#{fileExtension}\")\n \"-l\"\n lang\n ])\n .then(=>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 110} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:completion", "type": "completion", "prompt": "else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"", "response": "lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text, fileExtension and \".#{fileExtension}\")\n \"-o\"\n outputFile = @tempFile(\"output\", text, fileExtension and \".#{fileExtension}\")\n \"-l\"\n lang\n ])\n .then(=>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 110} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) ->\n try\n v = text.match(/uncrustify (\\d+\\.\\d+)/)[1]\n catch error\n @error(error)\n v = text.match(/Uncrustify-(\\d+\\.\\d+)/)[1] if not v?\n if v\n return v + \".0\"\n }\n docker: {\n image: \"unibeautify/uncrustify\"\n }\n }\n ]\n\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "baca098a91c33e1bbc39fe7f78c27db2c36ba3b3", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/baca098a91c33e1bbc39fe7f78c27db2c36ba3b3/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) ->\n try\n v = text.match(/uncrustify (\\d+\\.\\d+)/)[1]\n catch error\n @error(error)\n v = text.match(/Uncrustify-(\\d+\\.\\d+)/)[1] if not v?\n if v\n return v + \".0\"\n }\n docker: {\n image: \"unibeautify/uncrustify\"\n }\n }\n ]", "response": "options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "baca098a91c33e1bbc39fe7f78c27db2c36ba3b3", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/baca098a91c33e1bbc39fe7f78c27db2c36ba3b3/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ])\n .then(=>\n @readFile(outputFile)\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "baca098a91c33e1bbc39fe7f78c27db2c36ba3b3", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/baca098a91c33e1bbc39fe7f78c27db2c36ba3b3/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 110} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:completion", "type": "completion", "prompt": "editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"", "response": "lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ])\n .then(=>\n @readFile(outputFile)\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "baca098a91c33e1bbc39fe7f78c27db2c36ba3b3", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/baca098a91c33e1bbc39fe7f78c27db2c36ba3b3/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 110} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) ->\n try\n v = text.match(/uncrustify (\\d+\\.\\d+)/)[1]\n catch error\n @error(error)\n v = text.match(/Uncrustify-(\\d+\\.\\d+)/)[1] if not v?\n if v\n return v + \".0\"\n }\n }\n ]\n\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "d99b43cb16175a39dac05442cd7dcb43836a70a6", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d99b43cb16175a39dac05442cd7dcb43836a70a6/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) ->\n try\n v = text.match(/uncrustify (\\d+\\.\\d+)/)[1]\n catch error\n @error(error)\n v = text.match(/Uncrustify-(\\d+\\.\\d+)/)[1] if not v?\n if v\n return v + \".0\"\n }\n }\n ]\n\n options: {\n Apex: true\n C: true", "response": "\"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "d99b43cb16175a39dac05442cd7dcb43836a70a6", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d99b43cb16175a39dac05442cd7dcb43836a70a6/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ])\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "d99b43cb16175a39dac05442cd7dcb43836a70a6", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d99b43cb16175a39dac05442cd7dcb43836a70a6/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 108} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:completion", "type": "completion", "prompt": "projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"", "response": "lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ])\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "d99b43cb16175a39dac05442cd7dcb43836a70a6", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d99b43cb16175a39dac05442cd7dcb43836a70a6/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 108} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) -> text.match(/uncrustify (\\d+\\.\\d+)/)[1] + \".0\"\n }\n }\n ]\n\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9144df29a194ee2cb24a242818b77341a0051bbf", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9144df29a194ee2cb24a242818b77341a0051bbf/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n executables: [\n {\n name: \"Uncrustify\"\n cmd: \"uncrustify\"\n homepage: \"http://uncrustify.sourceforge.net/\"\n installation: \"https://github.com/uncrustify/uncrustify\"\n version: {\n parse: (text) -> text.match(/uncrustify (\\d+\\.\\d+)/)[1] + \".0\"\n }\n }\n ]\n\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true", "response": "Arduino: true\n }\n\n beautify: (text, language, options) ->\n uncrustify = @exe(\"uncrustify\")\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9144df29a194ee2cb24a242818b77341a0051bbf", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9144df29a194ee2cb24a242818b77341a0051bbf/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9144df29a194ee2cb24a242818b77341a0051bbf", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9144df29a194ee2cb24a242818b77341a0051bbf/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 103} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:completion", "type": "completion", "prompt": "reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"", "response": "lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n uncrustify.run([\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9144df29a194ee2cb24a242818b77341a0051bbf", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9144df29a194ee2cb24a242818b77341a0051bbf/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 103} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n isPreInstalled: false\n\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n\n\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n isPreInstalled: false\n\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->", "response": "throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n\n\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n @run(\"uncrustify\", [\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 94} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:completion", "type": "completion", "prompt": "lang = \"C\"\n when \"C++\"\n lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"", "response": "@run(\"uncrustify\", [\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 94} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n\n\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "88305ae1c6df043d9bc3ed8ec50dfc6faca38403", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/88305ae1c6df043d9bc3ed8ec50dfc6faca38403/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n link: \"https://github.com/uncrustify/uncrustify\"\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath", "response": "else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n\n\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "88305ae1c6df043d9bc3ed8ec50dfc6faca38403", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/88305ae1c6df043d9bc3ed8ec50dfc6faca38403/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n @run(\"uncrustify\", [\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "88305ae1c6df043d9bc3ed8ec50dfc6faca38403", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/88305ae1c6df043d9bc3ed8ec50dfc6faca38403/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 92} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:completion", "type": "completion", "prompt": "lang = \"CPP\"\n when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"", "response": "@run(\"uncrustify\", [\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "88305ae1c6df043d9bc3ed8ec50dfc6faca38403", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/88305ae1c6df043d9bc3ed8ec50dfc6faca38403/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 92} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else\n # Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n\n\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9ff43dafcc25f5486bc595b58e77d085277b4fb2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9ff43dafcc25f5486bc595b58e77d085277b4fb2/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Uncrustify extends Beautifier\n name: \"Uncrustify\"\n options: {\n Apex: true\n C: true\n \"C++\": true\n \"C#\": true\n \"Objective-C\": true\n D: true\n Pawn: true\n Vala: true\n Java: true\n Arduino: true\n }\n\n beautify: (text, language, options) ->\n # console.log('uncrustify.beautify', language, options)\n return new @Promise((resolve, reject) ->\n configPath = options.configPath\n unless configPath\n # No custom config path\n cfg options, (error, cPath) ->\n throw error if error\n resolve cPath\n else", "response": "# Has custom config path\n editor = atom.workspace.getActiveTextEditor()\n if editor?\n basePath = path.dirname(editor.getPath())\n projectPath = atom.workspace.project.getPaths()[0]\n # console.log(basePath);\n # Expand Home Directory in Config Path\n expandedConfigPath = expandHomeDir(configPath)\n configPath = path.resolve(projectPath, expandedConfigPath)\n resolve configPath\n else\n reject(new Error(\"No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.\"))\n )\n .then((configPath) =>\n\n\n # Select Uncrustify language\n lang = \"C\" # Default is C\n switch language\n when \"Apex\"\n lang = \"Apex\"\n when \"C\"\n lang = \"C\"\n when \"C++\"\n lang = \"CPP\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9ff43dafcc25f5486bc595b58e77d085277b4fb2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9ff43dafcc25f5486bc595b58e77d085277b4fb2/src/beautifiers/uncrustify/index.coffee", "line_start": 11, "line_end": 60} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"\n\n @run(\"uncrustify\", [\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9ff43dafcc25f5486bc595b58e77d085277b4fb2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9ff43dafcc25f5486bc595b58e77d085277b4fb2/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 91} +{"id": "Glavin001/atom-beautify:src/beautifiers/uncrustify/index.coffee:2:completion", "type": "completion", "prompt": "when \"C#\"\n lang = \"CS\"\n when \"Objective-C\", \"Objective-C++\"\n lang = \"OC+\"\n when \"D\"\n lang = \"D\"\n when \"Pawn\"\n lang = \"PAWN\"\n when \"Vala\"\n lang = \"VALA\"\n when \"Java\"\n lang = \"JAVA\"\n when \"Arduino\"\n lang = \"CPP\"", "response": "@run(\"uncrustify\", [\n \"-c\"\n configPath\n \"-f\"\n @tempFile(\"input\", text)\n \"-o\"\n outputFile = @tempFile(\"output\", text)\n \"-l\"\n lang\n ], help: {\n link: \"http://sourceforge.net/projects/uncrustify/\"\n })\n .then(=>\n @readFile(outputFile)\n )\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/uncrustify/index.coffee", "license": "MIT", "commit": "9ff43dafcc25f5486bc595b58e77d085277b4fb2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/9ff43dafcc25f5486bc595b58e77d085277b4fb2/src/beautifiers/uncrustify/index.coffee", "line_start": 61, "line_end": 91} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# RTSP spec:\n# RFC 2326 http://www.ietf.org/rfc/rfc2326.txt\n\napi =\n INTERLEAVED_SIGN: 0x24 # '$' (dollar sign)\n INTERLEAVED_HEADER_LEN: 4\n\n # Creates an interleaved header and returns the buffer.\n #\n # opts:\n # channel: channel identifier\n # payloadLength: payload length\n createInterleavedHeader: (opts) ->\n if not opts?.channel?\n throw new Error \"createInterleavedHeader: channel is required\"\n if not opts?.payloadLength?\n throw new Error \"createInterleavedHeader: payloadLength is required\"\n\n return new Buffer [\n api.INTERLEAVED_SIGN,\n opts.channel,\n opts.payloadLength >> 8, opts.payloadLength & 0xff,\n ]\n\n # Parses and returns an interleaved header.\n #\n # If the buffer doesn't have enough length for an interleaved header,\n # returns null.\n parseInterleavedHeader: (buf) ->\n if buf.length < api.INTERLEAVED_HEADER_LEN\n # not enough buffer\n return null\n\n if buf[0] isnt api.INTERLEAVED_SIGN\n throw new Error \"The buffer is not an interleaved data\"\n\n info = {}\n info.channel = buf[1]\n info.payloadLength = (buf[2] << 8) | buf[3]\n info.totalLength = api.INTERLEAVED_HEADER_LEN + info.payloadLength\n return info\n\n # Parses and returns the information of complete interleaved data.\n #\n # If parsing failed or buf doesn't have enough length for\n # the payload, returns null.\n getInterleavedData: (buf) ->\n info = api.parseInterleavedHeader buf\n if not info?\n return null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 1, "line_end": 50} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# RTSP spec:\n# RFC 2326 http://www.ietf.org/rfc/rfc2326.txt\n\napi =\n INTERLEAVED_SIGN: 0x24 # '$' (dollar sign)\n INTERLEAVED_HEADER_LEN: 4\n\n # Creates an interleaved header and returns the buffer.\n #\n # opts:\n # channel: channel identifier\n # payloadLength: payload length\n createInterleavedHeader: (opts) ->\n if not opts?.channel?\n throw new Error \"createInterleavedHeader: channel is required\"\n if not opts?.payloadLength?\n throw new Error \"createInterleavedHeader: payloadLength is required\"\n\n return new Buffer [\n api.INTERLEAVED_SIGN,\n opts.channel,\n opts.payloadLength >> 8, opts.payloadLength & 0xff,\n ]\n\n # Parses and returns an interleaved header.\n #\n # If the buffer doesn't have enough length for an interleaved header,\n # returns null.\n parseInterleavedHeader: (buf) ->\n if buf.length < api.INTERLEAVED_HEADER_LEN\n # not enough buffer\n return null\n\n if buf[0] isnt api.INTERLEAVED_SIGN\n throw new Error \"The buffer is not an interleaved data\"\n\n info = {}\n info.channel = buf[1]\n info.payloadLength = (buf[2] << 8) | buf[3]\n info.totalLength = api.INTERLEAVED_HEADER_LEN + info.payloadLength\n return info\n\n # Parses and returns the information of complete interleaved data.\n #\n # If parsing failed or buf doesn't have enough length for\n # the payload, returns null.\n getInterleavedData: (buf) ->\n info = api.parseInterleavedHeader buf\n if not info?\n return null\n```", "response": "// RTSP spec:\n// RFC 2326 http://www.ietf.org/rfc/rfc2326.txt\nvar api;\n\napi = {\n INTERLEAVED_SIGN: 0x24, // '$' (dollar sign)\n INTERLEAVED_HEADER_LEN: 4,\n // Creates an interleaved header and returns the buffer.\n\n // opts:\n // channel: channel identifier\n // payloadLength: payload length\n createInterleavedHeader: function(opts) {\n if ((opts != null ? opts.channel : void 0) == null) {\n throw new Error(\"createInterleavedHeader: channel is required\");\n }\n if ((opts != null ? opts.payloadLength : void 0) == null) {\n throw new Error(\"createInterleavedHeader: payloadLength is required\");\n }\n return new Buffer([api.INTERLEAVED_SIGN, opts.channel, opts.payloadLength >> 8, opts.payloadLength & 0xff]);\n },\n // Parses and returns an interleaved header.\n\n // If the buffer doesn't have enough length for an interleaved header,\n // returns null.\n parseInterleavedHeader: function(buf) {\n var info;\n if (buf.length < api.INTERLEAVED_HEADER_LEN) {\n // not enough buffer\n return null;\n }\n if (buf[0] !== api.INTERLEAVED_SIGN) {\n throw new Error(\"The buffer is not an interleaved data\");\n }\n info = {};\n info.channel = buf[1];\n info.payloadLength = (buf[2] << 8) | buf[3];\n info.totalLength = api.INTERLEAVED_HEADER_LEN + info.payloadLength;\n return info;\n },\n // Parses and returns the information of complete interleaved data.\n\n // If parsing failed or buf doesn't have enough length for\n // the payload, returns null.\n getInterleavedData: function(buf) {\n var info;\n info = api.parseInterleavedHeader(buf);\n if (info == null) {\n return null;\n }\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 1, "line_end": 50} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// RTSP spec:\n// RFC 2326 http://www.ietf.org/rfc/rfc2326.txt\nvar api;\n\napi = {\n INTERLEAVED_SIGN: 0x24, // '$' (dollar sign)\n INTERLEAVED_HEADER_LEN: 4,\n // Creates an interleaved header and returns the buffer.\n\n // opts:\n // channel: channel identifier\n // payloadLength: payload length\n createInterleavedHeader: function(opts) {\n if ((opts != null ? opts.channel : void 0) == null) {\n throw new Error(\"createInterleavedHeader: channel is required\");\n }\n if ((opts != null ? opts.payloadLength : void 0) == null) {\n throw new Error(\"createInterleavedHeader: payloadLength is required\");\n }\n return new Buffer([api.INTERLEAVED_SIGN, opts.channel, opts.payloadLength >> 8, opts.payloadLength & 0xff]);\n },\n // Parses and returns an interleaved header.\n\n // If the buffer doesn't have enough length for an interleaved header,\n // returns null.\n parseInterleavedHeader: function(buf) {\n var info;\n if (buf.length < api.INTERLEAVED_HEADER_LEN) {\n // not enough buffer\n return null;\n }\n if (buf[0] !== api.INTERLEAVED_SIGN) {\n throw new Error(\"The buffer is not an interleaved data\");\n }\n info = {};\n info.channel = buf[1];\n info.payloadLength = (buf[2] << 8) | buf[3];\n info.totalLength = api.INTERLEAVED_HEADER_LEN + info.payloadLength;\n return info;\n },\n // Parses and returns the information of complete interleaved data.\n\n // If parsing failed or buf doesn't have enough length for\n // the payload, returns null.\n getInterleavedData: function(buf) {\n var info;\n info = api.parseInterleavedHeader(buf);\n if (info == null) {\n return null;\n }\n }\n};\n```", "response": "# RTSP spec:\n# RFC 2326 http://www.ietf.org/rfc/rfc2326.txt\n\napi =\n INTERLEAVED_SIGN: 0x24 # '$' (dollar sign)\n INTERLEAVED_HEADER_LEN: 4\n\n # Creates an interleaved header and returns the buffer.\n #\n # opts:\n # channel: channel identifier\n # payloadLength: payload length\n createInterleavedHeader: (opts) ->\n if not opts?.channel?\n throw new Error \"createInterleavedHeader: channel is required\"\n if not opts?.payloadLength?\n throw new Error \"createInterleavedHeader: payloadLength is required\"\n\n return new Buffer [\n api.INTERLEAVED_SIGN,\n opts.channel,\n opts.payloadLength >> 8, opts.payloadLength & 0xff,\n ]\n\n # Parses and returns an interleaved header.\n #\n # If the buffer doesn't have enough length for an interleaved header,\n # returns null.\n parseInterleavedHeader: (buf) ->\n if buf.length < api.INTERLEAVED_HEADER_LEN\n # not enough buffer\n return null\n\n if buf[0] isnt api.INTERLEAVED_SIGN\n throw new Error \"The buffer is not an interleaved data\"\n\n info = {}\n info.channel = buf[1]\n info.payloadLength = (buf[2] << 8) | buf[3]\n info.totalLength = api.INTERLEAVED_HEADER_LEN + info.payloadLength\n return info\n\n # Parses and returns the information of complete interleaved data.\n #\n # If parsing failed or buf doesn't have enough length for\n # the payload, returns null.\n getInterleavedData: (buf) ->\n info = api.parseInterleavedHeader buf\n if not info?\n return null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 1, "line_end": 50} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:1:completion", "type": "completion", "prompt": "# RTSP spec:\n# RFC 2326 http://www.ietf.org/rfc/rfc2326.txt\n\napi =\n INTERLEAVED_SIGN: 0x24 # '$' (dollar sign)\n INTERLEAVED_HEADER_LEN: 4\n\n # Creates an interleaved header and returns the buffer.\n #\n # opts:\n # channel: channel identifier\n # payloadLength: payload length\n createInterleavedHeader: (opts) ->\n if not opts?.channel?\n throw new Error \"createInterleavedHeader: channel is required\"\n if not opts?.payloadLength?\n throw new Error \"createInterleavedHeader: payloadLength is required\"\n\n return new Buffer [\n api.INTERLEAVED_SIGN,\n opts.channel,\n opts.payloadLength >> 8, opts.payloadLength & 0xff,\n ]\n\n # Parses and returns an interleaved header.", "response": "#\n # If the buffer doesn't have enough length for an interleaved header,\n # returns null.\n parseInterleavedHeader: (buf) ->\n if buf.length < api.INTERLEAVED_HEADER_LEN\n # not enough buffer\n return null\n\n if buf[0] isnt api.INTERLEAVED_SIGN\n throw new Error \"The buffer is not an interleaved data\"\n\n info = {}\n info.channel = buf[1]\n info.payloadLength = (buf[2] << 8) | buf[3]\n info.totalLength = api.INTERLEAVED_HEADER_LEN + info.payloadLength\n return info\n\n # Parses and returns the information of complete interleaved data.\n #\n # If parsing failed or buf doesn't have enough length for\n # the payload, returns null.\n getInterleavedData: (buf) ->\n info = api.parseInterleavedHeader buf\n if not info?\n return null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 1, "line_end": 50} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if buf.length < info.totalLength\n # not enough buffer\n return null\n\n info.data = buf[api.INTERLEAVED_HEADER_LEN...info.totalLength]\n\n return info\n\nmodule.exports = api", "source_lang": "", "target_lang": "CoffeeScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 51, "line_end": 60} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif buf.length < info.totalLength\n # not enough buffer\n return null\n\n info.data = buf[api.INTERLEAVED_HEADER_LEN...info.totalLength]\n\n return info\n\nmodule.exports = api\n```", "response": "if (buf.length < info.totalLength) {\n // not enough buffer\n return null;\n}\n\ninfo.data = buf.slice(api.INTERLEAVED_HEADER_LEN, info.totalLength);\n\nreturn info;\n\nmodule.exports = api;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 51, "line_end": 60} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (buf.length < info.totalLength) {\n // not enough buffer\n return null;\n}\n\ninfo.data = buf.slice(api.INTERLEAVED_HEADER_LEN, info.totalLength);\n\nreturn info;\n\nmodule.exports = api;\n```", "response": "if buf.length < info.totalLength\n # not enough buffer\n return null\n\n info.data = buf[api.INTERLEAVED_HEADER_LEN...info.totalLength]\n\n return info\n\nmodule.exports = api", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 51, "line_end": 60} +{"id": "iizukanao/node-rtsp-rtmp-server:rtsp.coffee:2:completion", "type": "completion", "prompt": "if buf.length < info.totalLength\n # not enough buffer\n return null", "response": "info.data = buf[api.INTERLEAVED_HEADER_LEN...info.totalLength]\n\n return info\n\nmodule.exports = api", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "iizukanao/node-rtsp-rtmp-server", "path": "rtsp.coffee", "license": "MIT", "commit": "af6524dda361dd6dd193d2f66b289e0b65a48b89", "stars": 1100, "source_url": "https://github.com/iizukanao/node-rtsp-rtmp-server/blob/af6524dda361dd6dd193d2f66b289e0b65a48b89/rtsp.coffee", "line_start": 51, "line_end": 60} +{"id": "jianliaoim/talk-os:talk-web/client/app/team-invite-batch.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'team-invite-batch'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _teamId: T.string.isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onClose: T.func.isRequired\n\n getInitialState: ->\n invitees: ''\n\n makeInvitees: (data) ->\n arr = []\n data = data.split /\\s|,|;/\n data.forEach (el) ->\n if el.length > 0\n arr.push el\n arr\n\n makeData: (data) ->\n data = Immutable.fromJS data\n data\n .groupBy (el) ->\n if util.isEmail el\n 'emails'\n else if util.isMobile el\n 'mobiles'\n .toJS()\n\n validInvitees: (data) ->\n data.every (el) ->\n util.isMobile(el) or util.isEmail(el)\n\n onBatchInvite: ->\n if @state.invitees.trim().length isnt 0\n invitees = @makeInvitees @state.invitees\n inviteesNew = []\n max = 100\n\n if (invitees.length is 0) or not @validInvitees invitees\n notifyActions.error l('room-members-invalid')\n else\n invitees.forEach (invitee) =>\n if not @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])\n inviteesNew.push invitee\n\n if inviteesNew.length > 0 and inviteesNew.length < max\n inviteesNew = @makeData inviteesNew\n teamActions.batchInvite @props._teamId, inviteesNew,", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/team-invite-batch.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-invite-batch.coffee", "line_start": 17, "line_end": 66} +{"id": "jianliaoim/talk-os:talk-web/client/app/team-invite-batch.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'team-invite-batch'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _teamId: T.string.isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onClose: T.func.isRequired\n\n getInitialState: ->\n invitees: ''\n\n makeInvitees: (data) ->\n arr = []\n data = data.split /\\s|,|;/\n data.forEach (el) ->\n if el.length > 0\n arr.push el\n arr\n\n makeData: (data) ->\n data = Immutable.fromJS data\n data\n .groupBy (el) ->\n if util.isEmail el\n 'emails'\n else if util.isMobile el\n 'mobiles'\n .toJS()\n\n validInvitees: (data) ->\n data.every (el) ->\n util.isMobile(el) or util.isEmail(el)\n\n onBatchInvite: ->\n if @state.invitees.trim().length isnt 0\n invitees = @makeInvitees @state.invitees\n inviteesNew = []\n max = 100\n\n if (invitees.length is 0) or not @validInvitees invitees\n notifyActions.error l('room-members-invalid')\n else\n invitees.forEach (invitee) =>\n if not @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])\n inviteesNew.push invitee\n\n if inviteesNew.length > 0 and inviteesNew.length < max\n inviteesNew = @makeData inviteesNew\n teamActions.batchInvite @props._teamId, inviteesNew,\n```", "response": "module.exports = React.createClass({\n displayName: 'team-invite-batch',\n mixins: [PureRenderMixin],\n propTypes: {\n _teamId: T.string.isRequired,\n contacts: T.instanceOf(Immutable.List).isRequired,\n onClose: T.func.isRequired\n },\n getInitialState: function() {\n return {\n invitees: ''\n };\n },\n makeInvitees: function(data) {\n var arr;\n arr = [];\n data = data.split(/\\s|,|;/);\n data.forEach(function(el) {\n if (el.length > 0) {\n return arr.push(el);\n }\n });\n return arr;\n },\n makeData: function(data) {\n data = Immutable.fromJS(data);\n return data.groupBy(function(el) {\n if (util.isEmail(el)) {\n return 'emails';\n } else if (util.isMobile(el)) {\n return 'mobiles';\n }\n }).toJS();\n },\n validInvitees: function(data) {\n return data.every(function(el) {\n return util.isMobile(el) || util.isEmail(el);\n });\n },\n onBatchInvite: function() {\n var invitees, inviteesNew, max;\n if (this.state.invitees.trim().length !== 0) {\n invitees = this.makeInvitees(this.state.invitees);\n inviteesNew = [];\n max = 100;\n if ((invitees.length === 0) || !this.validInvitees(invitees)) {\n return notifyActions.error(l('room-members-invalid'));\n } else {\n invitees.forEach((invitee) => {\n if (!this.props.contacts.some(function(x) {\n return invitee === x.get('email') || invitee === x.get('phoneForLogin');\n })) {\n return inviteesNew.push(invitee);\n }\n });\n if (inviteesNew.length > 0 && inviteesNew.length < max) {\n inviteesNew = this.makeData(inviteesNew);\n return teamActions.batchInvite(this.props._teamId, inviteesNew);\n }\n }\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/team-invite-batch.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-invite-batch.coffee", "line_start": 17, "line_end": 66} +{"id": "jianliaoim/talk-os:talk-web/client/app/team-invite-batch.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'team-invite-batch',\n mixins: [PureRenderMixin],\n propTypes: {\n _teamId: T.string.isRequired,\n contacts: T.instanceOf(Immutable.List).isRequired,\n onClose: T.func.isRequired\n },\n getInitialState: function() {\n return {\n invitees: ''\n };\n },\n makeInvitees: function(data) {\n var arr;\n arr = [];\n data = data.split(/\\s|,|;/);\n data.forEach(function(el) {\n if (el.length > 0) {\n return arr.push(el);\n }\n });\n return arr;\n },\n makeData: function(data) {\n data = Immutable.fromJS(data);\n return data.groupBy(function(el) {\n if (util.isEmail(el)) {\n return 'emails';\n } else if (util.isMobile(el)) {\n return 'mobiles';\n }\n }).toJS();\n },\n validInvitees: function(data) {\n return data.every(function(el) {\n return util.isMobile(el) || util.isEmail(el);\n });\n },\n onBatchInvite: function() {\n var invitees, inviteesNew, max;\n if (this.state.invitees.trim().length !== 0) {\n invitees = this.makeInvitees(this.state.invitees);\n inviteesNew = [];\n max = 100;\n if ((invitees.length === 0) || !this.validInvitees(invitees)) {\n return notifyActions.error(l('room-members-invalid'));\n } else {\n invitees.forEach((invitee) => {\n if (!this.props.contacts.some(function(x) {\n return invitee === x.get('email') || invitee === x.get('phoneForLogin');\n })) {\n return inviteesNew.push(invitee);\n }\n });\n if (inviteesNew.length > 0 && inviteesNew.length < max) {\n inviteesNew = this.makeData(inviteesNew);\n return teamActions.batchInvite(this.props._teamId, inviteesNew);\n }\n }\n }\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'team-invite-batch'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _teamId: T.string.isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onClose: T.func.isRequired\n\n getInitialState: ->\n invitees: ''\n\n makeInvitees: (data) ->\n arr = []\n data = data.split /\\s|,|;/\n data.forEach (el) ->\n if el.length > 0\n arr.push el\n arr\n\n makeData: (data) ->\n data = Immutable.fromJS data\n data\n .groupBy (el) ->\n if util.isEmail el\n 'emails'\n else if util.isMobile el\n 'mobiles'\n .toJS()\n\n validInvitees: (data) ->\n data.every (el) ->\n util.isMobile(el) or util.isEmail(el)\n\n onBatchInvite: ->\n if @state.invitees.trim().length isnt 0\n invitees = @makeInvitees @state.invitees\n inviteesNew = []\n max = 100\n\n if (invitees.length is 0) or not @validInvitees invitees\n notifyActions.error l('room-members-invalid')\n else\n invitees.forEach (invitee) =>\n if not @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])\n inviteesNew.push invitee\n\n if inviteesNew.length > 0 and inviteesNew.length < max\n inviteesNew = @makeData inviteesNew\n teamActions.batchInvite @props._teamId, inviteesNew,", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/team-invite-batch.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-invite-batch.coffee", "line_start": 17, "line_end": 66} +{"id": "jianliaoim/talk-os:talk-web/client/app/team-invite-batch.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'team-invite-batch'\n mixins: [ PureRenderMixin ]\n\n propTypes:\n _teamId: T.string.isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onClose: T.func.isRequired\n\n getInitialState: ->\n invitees: ''\n\n makeInvitees: (data) ->\n arr = []\n data = data.split /\\s|,|;/\n data.forEach (el) ->\n if el.length > 0\n arr.push el\n arr\n\n makeData: (data) ->\n data = Immutable.fromJS data\n data\n .groupBy (el) ->\n if util.isEmail el", "response": "'emails'\n else if util.isMobile el\n 'mobiles'\n .toJS()\n\n validInvitees: (data) ->\n data.every (el) ->\n util.isMobile(el) or util.isEmail(el)\n\n onBatchInvite: ->\n if @state.invitees.trim().length isnt 0\n invitees = @makeInvitees @state.invitees\n inviteesNew = []\n max = 100\n\n if (invitees.length is 0) or not @validInvitees invitees\n notifyActions.error l('room-members-invalid')\n else\n invitees.forEach (invitee) =>\n if not @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])\n inviteesNew.push invitee\n\n if inviteesNew.length > 0 and inviteesNew.length < max\n inviteesNew = @makeData inviteesNew\n teamActions.batchInvite @props._teamId, inviteesNew,", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/team-invite-batch.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-invite-batch.coffee", "line_start": 17, "line_end": 66} +{"id": "jianliaoim/talk-os:talk-web/client/app/team-invite-batch.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "=>\n @setState invitees: ''\n @props.onClose()\n notifyActions.success l('room-members-success')\n ->\n notifyActions.error l('room-members-error')\n else if inviteesNew.length >= max\n notifyActions.error l('room-members-exceed-maximum').replace '%s', max\n else if invitees.length isnt inviteesNew.length\n notifyActions.error l('room-members-exists')\n\n onTextareaChange: (event) ->\n @setState invitees: event.target.value\n\n renderFooter: ->\n div className: 'footer',\n span className: 'button', onClick: @onBatchInvite, l('team-contacts-batch-invite-link')\n\n render: ->\n div className: 'team-invite-batch',\n div className: 'section',\n l('team-contacts-batch-invite')\n textarea\n autoFocus: true\n className: 'form-control is-static'\n placeholder: l('batch-invite-textarea')\n onChange: @onTextareaChange\n @renderFooter()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/team-invite-batch.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-invite-batch.coffee", "line_start": 67, "line_end": 94} +{"id": "jianliaoim/talk-os:talk-web/client/app/team-invite-batch.coffee:2:completion", "type": "completion", "prompt": "=>\n @setState invitees: ''\n @props.onClose()\n notifyActions.success l('room-members-success')\n ->\n notifyActions.error l('room-members-error')\n else if inviteesNew.length >= max\n notifyActions.error l('room-members-exceed-maximum').replace '%s', max\n else if invitees.length isnt inviteesNew.length\n notifyActions.error l('room-members-exists')\n\n onTextareaChange: (event) ->\n @setState invitees: event.target.value", "response": "renderFooter: ->\n div className: 'footer',\n span className: 'button', onClick: @onBatchInvite, l('team-contacts-batch-invite-link')\n\n render: ->\n div className: 'team-invite-batch',\n div className: 'section',\n l('team-contacts-batch-invite')\n textarea\n autoFocus: true\n className: 'form-control is-static'\n placeholder: l('batch-invite-textarea')\n onChange: @onTextareaChange\n @renderFooter()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/team-invite-batch.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/team-invite-batch.coffee", "line_start": 67, "line_end": 94} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/sms.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Err = require 'err1st'\nPromise = require 'bluebird'\nrequestAsync = Promise.promisify(require 'request')\nconfig = require 'config'\nmoment = require 'moment'\n\nmodule.exports =\n sendSMS: (mobile, text, options = {}, callback = ->) ->\n # @osv\n return callback(null, ok: 1)\n {redis} = require '../components'\n endOfToday = moment().endOf('day').valueOf()\n rateKey = \"sms:#{mobile}:#{endOfToday}\"\n\n if options.dailyRate\n $overRate = redis.getAsync rateKey\n\n .then (rateNum) ->\n return unless rateNum\n if Number(rateNum) > options.dailyRate\n throw new Err 'MOBILE_RATE_EXCEEDED'\n return\n\n else $overRate = Promise.resolve()\n\n $sendSMS = $overRate.then ->\n _options =\n method: 'POST'\n url: config.sms.host + '/send'\n json: true\n body:\n key: config.sms.key\n secret: config.sms.secret\n phone: mobile\n ip: options.ip\n _userId: options._userId\n refer: options.refer\n msg: text\n uid: options.uid or options._userId\n requestAsync _options\n .spread (res) ->\n throw new Err('SEND_SMS_ERROR') unless res?.statusCode is 200\n res.body\n\n $setRate = $sendSMS.then ->\n remainSeconds = Math.floor((endOfToday - Date.now())/1000)\n redis\n .multi()\n .incr rateKey\n .expire rateKey, remainSeconds", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/sms.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/sms.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/sms.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nErr = require 'err1st'\nPromise = require 'bluebird'\nrequestAsync = Promise.promisify(require 'request')\nconfig = require 'config'\nmoment = require 'moment'\n\nmodule.exports =\n sendSMS: (mobile, text, options = {}, callback = ->) ->\n # @osv\n return callback(null, ok: 1)\n {redis} = require '../components'\n endOfToday = moment().endOf('day').valueOf()\n rateKey = \"sms:#{mobile}:#{endOfToday}\"\n\n if options.dailyRate\n $overRate = redis.getAsync rateKey\n\n .then (rateNum) ->\n return unless rateNum\n if Number(rateNum) > options.dailyRate\n throw new Err 'MOBILE_RATE_EXCEEDED'\n return\n\n else $overRate = Promise.resolve()\n\n $sendSMS = $overRate.then ->\n _options =\n method: 'POST'\n url: config.sms.host + '/send'\n json: true\n body:\n key: config.sms.key\n secret: config.sms.secret\n phone: mobile\n ip: options.ip\n _userId: options._userId\n refer: options.refer\n msg: text\n uid: options.uid or options._userId\n requestAsync _options\n .spread (res) ->\n throw new Err('SEND_SMS_ERROR') unless res?.statusCode is 200\n res.body\n\n $setRate = $sendSMS.then ->\n remainSeconds = Math.floor((endOfToday - Date.now())/1000)\n redis\n .multi()\n .incr rateKey\n .expire rateKey, remainSeconds\n```", "response": "var Err, Promise, config, moment, requestAsync;\n\nErr = require('err1st');\n\nPromise = require('bluebird');\n\nrequestAsync = Promise.promisify(require('request'));\n\nconfig = require('config');\n\nmoment = require('moment');\n\nmodule.exports = {\n sendSMS: function(mobile, text, options = {}, callback = function() {}) {\n var $overRate, $sendSMS, $setRate, endOfToday, rateKey, redis;\n // @osv\n return callback(null, {\n ok: 1\n });\n ({redis} = require('../components'));\n endOfToday = moment().endOf('day').valueOf();\n rateKey = `sms:${mobile}:${endOfToday}`;\n if (options.dailyRate) {\n $overRate = redis.getAsync(rateKey).then(function(rateNum) {\n if (!rateNum) {\n return;\n }\n if (Number(rateNum) > options.dailyRate) {\n throw new Err('MOBILE_RATE_EXCEEDED');\n }\n });\n } else {\n $overRate = Promise.resolve();\n }\n $sendSMS = $overRate.then(function() {\n var _options;\n _options = {\n method: 'POST',\n url: config.sms.host + '/send',\n json: true,\n body: {\n key: config.sms.key,\n secret: config.sms.secret,\n phone: mobile,\n ip: options.ip,\n _userId: options._userId,\n refer: options.refer,\n msg: text,\n uid: options.uid || options._userId\n }\n };\n return requestAsync(_options).spread(function(res) {\n if ((res != null ? res.statusCode : void 0) !== 200) {\n throw new Err('SEND_SMS_ERROR');\n }\n return res.body;\n });\n });\n return $setRate = $sendSMS.then(function() {\n var remainSeconds;\n remainSeconds = Math.floor((endOfToday - Date.now()) / 1000);\n return redis.multi().incr(rateKey).expire(rateKey, remainSeconds);\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/sms.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/sms.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/sms.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Err, Promise, config, moment, requestAsync;\n\nErr = require('err1st');\n\nPromise = require('bluebird');\n\nrequestAsync = Promise.promisify(require('request'));\n\nconfig = require('config');\n\nmoment = require('moment');\n\nmodule.exports = {\n sendSMS: function(mobile, text, options = {}, callback = function() {}) {\n var $overRate, $sendSMS, $setRate, endOfToday, rateKey, redis;\n // @osv\n return callback(null, {\n ok: 1\n });\n ({redis} = require('../components'));\n endOfToday = moment().endOf('day').valueOf();\n rateKey = `sms:${mobile}:${endOfToday}`;\n if (options.dailyRate) {\n $overRate = redis.getAsync(rateKey).then(function(rateNum) {\n if (!rateNum) {\n return;\n }\n if (Number(rateNum) > options.dailyRate) {\n throw new Err('MOBILE_RATE_EXCEEDED');\n }\n });\n } else {\n $overRate = Promise.resolve();\n }\n $sendSMS = $overRate.then(function() {\n var _options;\n _options = {\n method: 'POST',\n url: config.sms.host + '/send',\n json: true,\n body: {\n key: config.sms.key,\n secret: config.sms.secret,\n phone: mobile,\n ip: options.ip,\n _userId: options._userId,\n refer: options.refer,\n msg: text,\n uid: options.uid || options._userId\n }\n };\n return requestAsync(_options).spread(function(res) {\n if ((res != null ? res.statusCode : void 0) !== 200) {\n throw new Err('SEND_SMS_ERROR');\n }\n return res.body;\n });\n });\n return $setRate = $sendSMS.then(function() {\n var remainSeconds;\n remainSeconds = Math.floor((endOfToday - Date.now()) / 1000);\n return redis.multi().incr(rateKey).expire(rateKey, remainSeconds);\n });\n }\n};\n```", "response": "Err = require 'err1st'\nPromise = require 'bluebird'\nrequestAsync = Promise.promisify(require 'request')\nconfig = require 'config'\nmoment = require 'moment'\n\nmodule.exports =\n sendSMS: (mobile, text, options = {}, callback = ->) ->\n # @osv\n return callback(null, ok: 1)\n {redis} = require '../components'\n endOfToday = moment().endOf('day').valueOf()\n rateKey = \"sms:#{mobile}:#{endOfToday}\"\n\n if options.dailyRate\n $overRate = redis.getAsync rateKey\n\n .then (rateNum) ->\n return unless rateNum\n if Number(rateNum) > options.dailyRate\n throw new Err 'MOBILE_RATE_EXCEEDED'\n return\n\n else $overRate = Promise.resolve()\n\n $sendSMS = $overRate.then ->\n _options =\n method: 'POST'\n url: config.sms.host + '/send'\n json: true\n body:\n key: config.sms.key\n secret: config.sms.secret\n phone: mobile\n ip: options.ip\n _userId: options._userId\n refer: options.refer\n msg: text\n uid: options.uid or options._userId\n requestAsync _options\n .spread (res) ->\n throw new Err('SEND_SMS_ERROR') unless res?.statusCode is 200\n res.body\n\n $setRate = $sendSMS.then ->\n remainSeconds = Math.floor((endOfToday - Date.now())/1000)\n redis\n .multi()\n .incr rateKey\n .expire rateKey, remainSeconds", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/sms.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/sms.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/sms.coffee:1:completion", "type": "completion", "prompt": "Err = require 'err1st'\nPromise = require 'bluebird'\nrequestAsync = Promise.promisify(require 'request')\nconfig = require 'config'\nmoment = require 'moment'\n\nmodule.exports =\n sendSMS: (mobile, text, options = {}, callback = ->) ->\n # @osv\n return callback(null, ok: 1)\n {redis} = require '../components'\n endOfToday = moment().endOf('day').valueOf()\n rateKey = \"sms:#{mobile}:#{endOfToday}\"\n\n if options.dailyRate\n $overRate = redis.getAsync rateKey\n\n .then (rateNum) ->\n return unless rateNum\n if Number(rateNum) > options.dailyRate\n throw new Err 'MOBILE_RATE_EXCEEDED'\n return\n\n else $overRate = Promise.resolve()", "response": "$sendSMS = $overRate.then ->\n _options =\n method: 'POST'\n url: config.sms.host + '/send'\n json: true\n body:\n key: config.sms.key\n secret: config.sms.secret\n phone: mobile\n ip: options.ip\n _userId: options._userId\n refer: options.refer\n msg: text\n uid: options.uid or options._userId\n requestAsync _options\n .spread (res) ->\n throw new Err('SEND_SMS_ERROR') unless res?.statusCode is 200\n res.body\n\n $setRate = $sendSMS.then ->\n remainSeconds = Math.floor((endOfToday - Date.now())/1000)\n redis\n .multi()\n .incr rateKey\n .expire rateKey, remainSeconds", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/sms.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/sms.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/sms.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": ".execAsync()\n\n Promise.all [$sendSMS, $setRate]\n .spread (body) -> body\n .nodeify callback", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/sms.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/sms.coffee", "line_start": 51, "line_end": 55} +{"id": "mauricemach/zappa:tests/assets.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n @get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return this.get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->\n t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @css '/index.css': '''\n font-family: sans-serif;\n '''", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n @get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return this.get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->\n t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @css '/index.css': '''\n font-family: sans-serif;\n '''\n```", "response": "this.tests = {\n client: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {\n return this.get({\n '#/': function() {\n return alert('hi');\n }\n });\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/index.js', function(err, res) {\n t.equal(1, res.body, ';zappa.run(function () {\\n return this.get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n coffee: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.coffee({\n '/coffee.js': function() {\n return alert('hi');\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/coffee.js', function(err, res) {\n t.equal(1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n js: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.js({\n '/js.js': `alert('hi');`\n });\n });\n c = t.client(zapp.app);\n return c.get('/js.js', function(err, res) {\n t.equal(1, res.body, \"alert('hi');\");\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n css: function(t) {\n var zapp;\n t.expect(1, 2);\n t.wait(3000);\n return zapp = zappa(port++, function() {\n return this.css({\n '/index.css': `font-family: sans-serif;`\n });\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis.tests = {\n client: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {\n return this.get({\n '#/': function() {\n return alert('hi');\n }\n });\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/index.js', function(err, res) {\n t.equal(1, res.body, ';zappa.run(function () {\\n return this.get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n coffee: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.coffee({\n '/coffee.js': function() {\n return alert('hi');\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/coffee.js', function(err, res) {\n t.equal(1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n js: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.js({\n '/js.js': `alert('hi');`\n });\n });\n c = t.client(zapp.app);\n return c.get('/js.js', function(err, res) {\n t.equal(1, res.body, \"alert('hi');\");\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n css: function(t) {\n var zapp;\n t.expect(1, 2);\n t.wait(3000);\n return zapp = zappa(port++, function() {\n return this.css({\n '/index.css': `font-family: sans-serif;`\n });\n });\n }\n};\n```", "response": "@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n @get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return this.get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->\n t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @css '/index.css': '''\n font-family: sans-serif;\n '''", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:1:completion", "type": "completion", "prompt": "@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n @get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return this.get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->", "response": "t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n @css '/index.css': '''\n font-family: sans-serif;\n '''", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n @stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '91669'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:2:completion", "type": "completion", "prompt": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n @stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)", "response": "c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '91669'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.use('zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.use('zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.ok('zappa', res.body.indexOf('window.zappa={},') > -1);\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.use('zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.use('zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.ok('zappa', res.body.indexOf('window.zappa={},') > -1);\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @use 'zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "c.get '/client.js', (err, res) ->\n t.equal 'client', res.headers['content-length'], '42'\n c.get '/shared.js', (err, res) ->\n t.equal 'shared', res.headers['content-length'], '87'\n c.get '/coffee.js', (err, res) ->\n t.equal 'coffee', res.headers['content-length'], '475'\n c.get '/js.js', (err, res) ->\n t.equal 'js', res.headers['content-length'], '12'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 154, "line_end": 161} +{"id": "mauricemach/zappa:tests/assets.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nc.get '/client.js', (err, res) ->\n t.equal 'client', res.headers['content-length'], '42'\n c.get '/shared.js', (err, res) ->\n t.equal 'shared', res.headers['content-length'], '87'\n c.get '/coffee.js', (err, res) ->\n t.equal 'coffee', res.headers['content-length'], '475'\n c.get '/js.js', (err, res) ->\n t.equal 'js', res.headers['content-length'], '12'\n```", "response": "c.get('/client.js', function(err, res) {\n return t.equal('client', res.headers['content-length'], '42');\n});\n\nc.get('/shared.js', function(err, res) {\n return t.equal('shared', res.headers['content-length'], '87');\n});\n\nc.get('/coffee.js', function(err, res) {\n return t.equal('coffee', res.headers['content-length'], '475');\n});\n\nc.get('/js.js', function(err, res) {\n return t.equal('js', res.headers['content-length'], '12');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 154, "line_end": 161} +{"id": "mauricemach/zappa:tests/assets.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nc.get('/client.js', function(err, res) {\n return t.equal('client', res.headers['content-length'], '42');\n});\n\nc.get('/shared.js', function(err, res) {\n return t.equal('shared', res.headers['content-length'], '87');\n});\n\nc.get('/coffee.js', function(err, res) {\n return t.equal('coffee', res.headers['content-length'], '475');\n});\n\nc.get('/js.js', function(err, res) {\n return t.equal('js', res.headers['content-length'], '12');\n});\n```", "response": "c.get '/client.js', (err, res) ->\n t.equal 'client', res.headers['content-length'], '42'\n c.get '/shared.js', (err, res) ->\n t.equal 'shared', res.headers['content-length'], '87'\n c.get '/coffee.js', (err, res) ->\n t.equal 'coffee', res.headers['content-length'], '475'\n c.get '/js.js', (err, res) ->\n t.equal 'js', res.headers['content-length'], '12'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 154, "line_end": 161} +{"id": "mauricemach/zappa:tests/assets.coffee:4:completion", "type": "completion", "prompt": "c.get '/client.js', (err, res) ->\n t.equal 'client', res.headers['content-length'], '42'\n c.get '/shared.js', (err, res) ->\n t.equal 'shared', res.headers['content-length'], '87'", "response": "c.get '/coffee.js', (err, res) ->\n t.equal 'coffee', res.headers['content-length'], '475'\n c.get '/js.js', (err, res) ->\n t.equal 'js', res.headers['content-length'], '12'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/assets.coffee", "line_start": 154, "line_end": 161} +{"id": "mauricemach/zappa:tests/assets.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n @stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve jquery'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '91669'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "44808669dcc48e436237fa0fcb7645d36f367ce7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/44808669dcc48e436237fa0fcb7645d36f367ce7/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:2:completion", "type": "completion", "prompt": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n @stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)", "response": "c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve jquery'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '91669'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "44808669dcc48e436237fa0fcb7645d36f367ce7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/44808669dcc48e436237fa0fcb7645d36f367ce7/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "44808669dcc48e436237fa0fcb7645d36f367ce7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/44808669dcc48e436237fa0fcb7645d36f367ce7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.ok('zappa', res.body.indexOf('window.zappa={},') > -1);\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "44808669dcc48e436237fa0fcb7645d36f367ce7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/44808669dcc48e436237fa0fcb7645d36f367ce7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'snippet');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.ok('snippet', res.body.indexOf('window.zappa = {};') > -1);\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.ok('zappa', res.body.indexOf('window.zappa={},') > -1);\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "44808669dcc48e436237fa0fcb7645d36f367ce7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/44808669dcc48e436237fa0fcb7645d36f367ce7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'snippet'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.ok 'zappa', res.body.indexOf('window.zappa={},') > -1", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "44808669dcc48e436237fa0fcb7645d36f367ce7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/44808669dcc48e436237fa0fcb7645d36f367ce7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2894'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "97c7ba23356254d5006e2cb8cb2c0012b05553ac", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/97c7ba23356254d5006e2cb8cb2c0012b05553ac/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2894'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5574');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5574');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2894');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "97c7ba23356254d5006e2cb8cb2c0012b05553ac", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/97c7ba23356254d5006e2cb8cb2c0012b05553ac/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5574');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5574');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2894');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2894'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "97c7ba23356254d5006e2cb8cb2c0012b05553ac", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/97c7ba23356254d5006e2cb8cb2c0012b05553ac/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5574'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2894'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "97c7ba23356254d5006e2cb8cb2c0012b05553ac", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/97c7ba23356254d5006e2cb8cb2c0012b05553ac/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2809'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2809'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5525');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5525');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2809');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5525');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5525');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2809');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2809'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5525'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2809'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e2df1016e4d0cd8360bb0ae5f96da48d8f6723b7/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2623'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "2f373ce1622801e11822adff5138103887427b62", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/2f373ce1622801e11822adff5138103887427b62/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2623'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5049');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5049');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2623');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "2f373ce1622801e11822adff5138103887427b62", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/2f373ce1622801e11822adff5138103887427b62/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5049');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5049');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2623');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2623'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "2f373ce1622801e11822adff5138103887427b62", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/2f373ce1622801e11822adff5138103887427b62/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5049'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2623'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "2f373ce1622801e11822adff5138103887427b62", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/2f373ce1622801e11822adff5138103887427b62/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2667'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "92f6f994e18cf11bd33881c68bbe0f5c846d24b2", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/92f6f994e18cf11bd33881c68bbe0f5c846d24b2/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2667'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5160');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5160');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2667');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "92f6f994e18cf11bd33881c68bbe0f5c846d24b2", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/92f6f994e18cf11bd33881c68bbe0f5c846d24b2/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '18059');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5160');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5160');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2667');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2667'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "92f6f994e18cf11bd33881c68bbe0f5c846d24b2", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/92f6f994e18cf11bd33881c68bbe0f5c846d24b2/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '18059'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5160'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2667'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "92f6f994e18cf11bd33881c68bbe0f5c846d24b2", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/92f6f994e18cf11bd33881c68bbe0f5c846d24b2/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n @stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve jquery'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '92334'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "13361ea724375f6dd3e85118df6cd62145ef7ab0", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/13361ea724375f6dd3e85118df6cd62145ef7ab0/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:2:completion", "type": "completion", "prompt": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n @stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)", "response": "c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve jquery'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '92334'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "13361ea724375f6dd3e85118df6cd62145ef7ab0", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/13361ea724375f6dd3e85118df6cd62145ef7ab0/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2663'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "13361ea724375f6dd3e85118df6cd62145ef7ab0", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/13361ea724375f6dd3e85118df6cd62145ef7ab0/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2663'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5156');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5156');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2663');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "13361ea724375f6dd3e85118df6cd62145ef7ab0", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/13361ea724375f6dd3e85118df6cd62145ef7ab0/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5156');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '5156');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2663');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2663'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "13361ea724375f6dd3e85118df6cd62145ef7ab0", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/13361ea724375f6dd3e85118df6cd62145ef7ab0/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '5156'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2663'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "13361ea724375f6dd3e85118df6cd62145ef7ab0", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/13361ea724375f6dd3e85118df6cd62145ef7ab0/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2492'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2492'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2492');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n },\n minify: function(t) {\n var c, zapp;\n t.expect('zappa', 'client', 'shared', 'coffee', 'js');\n t.wait(3000);\n zapp = zappa(port++, function() {\n this.enable('serve zappa', 'minify');\n this.client({\n '/client.js': function() {\n return alert('foo');\n }\n });\n this.shared({\n '/shared.js': function() {\n if (typeof window !== \"undefined\" && window !== null) {\n return alert('foo');\n }\n }\n });\n this.coffee({\n '/coffee.js': function() {\n return alert('foo');\n }\n });\n return this.js({\n '/js.js': \"alert('foo');\"\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n return t.equal('zappa', res.headers['content-length'], '2492');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2492'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->", "response": "t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n minify: (t) ->\n t.expect 'zappa', 'client', 'shared', 'coffee', 'js'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa', 'minify'\n @client '/client.js': -> alert 'foo'\n @shared '/shared.js': -> alert 'foo' if window?\n @coffee '/coffee.js': -> alert 'foo'\n @js '/js.js': \"alert('foo');\"\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'zappa', res.headers['content-length'], '2492'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e5d10aedecdd70b2c81c6923a746fb7d2f9eeafd/tests/assets.coffee", "line_start": 104, "line_end": 153} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "a991eab803a76ebc3156095775a13b376176e341", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/a991eab803a76ebc3156095775a13b376176e341/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "a991eab803a76ebc3156095775a13b376176e341", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/a991eab803a76ebc3156095775a13b376176e341/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return this.client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '4685');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "a991eab803a76ebc3156095775a13b376176e341", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/a991eab803a76ebc3156095775a13b376176e341/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->", "response": "@enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n @client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '4685'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "a991eab803a76ebc3156095775a13b376176e341", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/a991eab803a76ebc3156095775a13b376176e341/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->\n t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n css '/index.css': '''\n font-family: sans-serif;\n '''", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->\n t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n css '/index.css': '''\n font-family: sans-serif;\n '''\n```", "response": "this.tests = {\n client: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {\n return get({\n '#/': function() {\n return alert('hi');\n }\n });\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/index.js', function(err, res) {\n t.equal(1, res.body, ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n coffee: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return coffee({\n '/coffee.js': function() {\n return alert('hi');\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/coffee.js', function(err, res) {\n t.equal(1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n js: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return js({\n '/js.js': `alert('hi');`\n });\n });\n c = t.client(zapp.app);\n return c.get('/js.js', function(err, res) {\n t.equal(1, res.body, \"alert('hi');\");\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n css: function(t) {\n var zapp;\n t.expect(1, 2);\n t.wait(3000);\n return zapp = zappa(port++, function() {\n return css({\n '/index.css': `font-family: sans-serif;`\n });\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis.tests = {\n client: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {\n return get({\n '#/': function() {\n return alert('hi');\n }\n });\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/index.js', function(err, res) {\n t.equal(1, res.body, ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n coffee: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return coffee({\n '/coffee.js': function() {\n return alert('hi');\n }\n });\n });\n c = t.client(zapp.app);\n return c.get('/coffee.js', function(err, res) {\n t.equal(1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();');\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n js: function(t) {\n var c, zapp;\n t.expect(1, 2);\n t.wait(3000);\n zapp = zappa(port++, function() {\n return js({\n '/js.js': `alert('hi');`\n });\n });\n c = t.client(zapp.app);\n return c.get('/js.js', function(err, res) {\n t.equal(1, res.body, \"alert('hi');\");\n return t.equal(2, res.headers['content-type'], 'application/javascript');\n });\n },\n css: function(t) {\n var zapp;\n t.expect(1, 2);\n t.wait(3000);\n return zapp = zappa(port++, function() {\n return css({\n '/index.css': `font-family: sans-serif;`\n });\n });\n }\n};\n```", "response": "@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->\n t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n css '/index.css': '''\n font-family: sans-serif;\n '''", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:1:completion", "type": "completion", "prompt": "@tests =\n client: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/index.js', (err, res) ->\n t.equal 1, res.body, ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n coffee: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n coffee '/coffee.js': ->\n alert 'hi'\n\n c = t.client(zapp.app)\n c.get '/coffee.js', (err, res) ->", "response": "t.equal 1, res.body, ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n js: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n js '/js.js': '''\n alert('hi');\n '''\n\n c = t.client(zapp.app)\n c.get '/js.js', (err, res) ->\n t.equal 1, res.body, \"alert('hi');\"\n t.equal 2, res.headers['content-type'], 'application/javascript'\n\n css: (t) ->\n t.expect 1, 2\n t.wait 3000\n\n zapp = zappa port++, ->\n css '/index.css': '''\n font-family: sans-serif;\n '''", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 4, "line_end": 53} +{"id": "mauricemach/zappa:tests/assets.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve jquery'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '92334'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:2:completion", "type": "completion", "prompt": "c = t.client(zapp.app)\n c.get '/index.css', (err, res) ->\n t.equal 1, res.body, 'font-family: sans-serif;'\n t.equal 2, res.headers['content-type'], 'text/css'\n\n stylus: (t) ->\n t.expect 'header', 'body'\n t.wait 3000\n\n zapp = zappa port++, ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n\n c = t.client(zapp.app)", "response": "c.get '/index.css', (err, res) ->\n t.equal 'header', res.headers['content-type'], 'text/css'\n t.equal 'body', res.body, '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n\n jquery: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve jquery'\n\n c = t.client(zapp.app)\n c.get '/zappa/jquery.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '92334'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 54, "line_end": 103} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '7037');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '7037');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '7037');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '7037');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->", "response": "enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '7037'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "d2bfe3e0b4920f99699ca1c730cc40bbde565850", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/d2bfe3e0b4920f99699ca1c730cc40bbde565850/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "974f5b26e61fedc740a305bc5d21606a77af840e", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/974f5b26e61fedc740a305bc5d21606a77af840e/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6865');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6865');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "974f5b26e61fedc740a305bc5d21606a77af840e", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/974f5b26e61fedc740a305bc5d21606a77af840e/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6865');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6865');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "974f5b26e61fedc740a305bc5d21606a77af840e", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/974f5b26e61fedc740a305bc5d21606a77af840e/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->", "response": "enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6865'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "974f5b26e61fedc740a305bc5d21606a77af840e", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/974f5b26e61fedc740a305bc5d21606a77af840e/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "6a0bf34282a3db50b307b1319d30ff227d4277a9", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'\n```", "response": "({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6864');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6864');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "6a0bf34282a3db50b307b1319d30ff227d4277a9", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n sammy: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve sammy');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/sammy.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '16854');\n });\n },\n zappa: function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return enable('serve zappa');\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6864');\n });\n },\n 'zappa (automatic)': function(t) {\n var c, zapp;\n t.expect('content-type', 'length');\n t.wait(3000);\n zapp = zappa(port++, function() {\n return client({\n '/index.js': function() {}\n });\n });\n c = t.client(zapp.app);\n return c.get('/zappa/zappa.js', function(err, res) {\n t.equal('content-type', res.headers['content-type'], 'application/javascript');\n return t.equal('length', res.headers['content-length'], '6864');\n });\n }\n});\n```", "response": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "6a0bf34282a3db50b307b1319d30ff227d4277a9", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:3:completion", "type": "completion", "prompt": "sammy: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n enable 'serve sammy'\n\n c = t.client(zapp.app)\n c.get '/zappa/sammy.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '16854'\n\n zappa: (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->", "response": "enable 'serve zappa'\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'\n\n 'zappa (automatic)': (t) ->\n t.expect 'content-type', 'length'\n t.wait 3000\n\n zapp = zappa port++, ->\n client '/index.js': ->\n\n c = t.client(zapp.app)\n c.get '/zappa/zappa.js', (err, res) ->\n t.equal 'content-type', res.headers['content-type'], 'application/javascript'\n t.equal 'length', res.headers['content-length'], '6864'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "6a0bf34282a3db50b307b1319d30ff227d4277a9", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/assets.coffee", "line_start": 104, "line_end": 138} +{"id": "mauricemach/zappa:tests/assets.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports =\n client: ->\n t = zappa ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.response {url: '/index.js'}, {headers, body}\n\n coffee: ->\n t = zappa ->\n coffee '/coffee.js': ->\n alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.response {url: '/coffee.js'}, {headers, body}\n\n js: ->\n t = zappa ->\n js '/js.js': '''\n alert('hi');\n '''\n headers = 'Content-Type': 'application/javascript'\n body = \"alert('hi');\"\n t.response {url: '/js.js'}, {headers, body}\n\n css: ->\n t = zappa ->\n css '/index.css': '''\n font-family: sans-serif;\n '''\n headers = 'Content-Type': 'text/css'\n body = 'font-family: sans-serif;'\n t.response {url: '/index.css'}, {headers, body}\n\n stylus: ->\n t = zappa ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n headers = 'Content-Type': 'text/css'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "3c5114ebe4b768e7266ad497703eff62404efac3", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/3c5114ebe4b768e7266ad497703eff62404efac3/tests/assets.coffee", "line_start": 3, "line_end": 52} +{"id": "mauricemach/zappa:tests/assets.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports =\n client: ->\n t = zappa ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.response {url: '/index.js'}, {headers, body}\n\n coffee: ->\n t = zappa ->\n coffee '/coffee.js': ->\n alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.response {url: '/coffee.js'}, {headers, body}\n\n js: ->\n t = zappa ->\n js '/js.js': '''\n alert('hi');\n '''\n headers = 'Content-Type': 'application/javascript'\n body = \"alert('hi');\"\n t.response {url: '/js.js'}, {headers, body}\n\n css: ->\n t = zappa ->\n css '/index.css': '''\n font-family: sans-serif;\n '''\n headers = 'Content-Type': 'text/css'\n body = 'font-family: sans-serif;'\n t.response {url: '/index.css'}, {headers, body}\n\n stylus: ->\n t = zappa ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n headers = 'Content-Type': 'text/css'\n```", "response": "module.exports = {\n client: function() {\n var body, headers, t;\n t = zappa(function() {\n return client({\n '/index.js': function() {\n return get({\n '#/': function() {\n return alert('hi');\n }\n });\n }\n });\n });\n headers = {\n 'Content-Type': 'application/javascript'\n };\n body = ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });';\n return t.response({\n url: '/index.js'\n }, {headers, body});\n },\n coffee: function() {\n var body, headers, t;\n t = zappa(function() {\n return coffee({\n '/coffee.js': function() {\n return alert('hi');\n }\n });\n });\n headers = {\n 'Content-Type': 'application/javascript'\n };\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();';\n return t.response({\n url: '/coffee.js'\n }, {headers, body});\n },\n js: function() {\n var body, headers, t;\n t = zappa(function() {\n return js({\n '/js.js': `alert('hi');`\n });\n });\n headers = {\n 'Content-Type': 'application/javascript'\n };\n body = \"alert('hi');\";\n return t.response({\n url: '/js.js'\n }, {headers, body});\n },\n css: function() {\n var body, headers, t;\n t = zappa(function() {\n return css({\n '/index.css': `font-family: sans-serif;`\n });\n });\n headers = {\n 'Content-Type': 'text/css'\n };\n body = 'font-family: sans-serif;';\n return t.response({\n url: '/index.css'\n }, {headers, body});\n },\n stylus: function() {\n var headers, t;\n t = zappa(function() {\n return stylus({\n '/index.css': `border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\nbody\n font 12px Helvetica, Arial, sans-serif\n\na.button\n border-radius 5px`\n });\n });\n return headers = {\n 'Content-Type': 'text/css'\n };\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "3c5114ebe4b768e7266ad497703eff62404efac3", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/3c5114ebe4b768e7266ad497703eff62404efac3/tests/assets.coffee", "line_start": 3, "line_end": 52} +{"id": "mauricemach/zappa:tests/assets.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = {\n client: function() {\n var body, headers, t;\n t = zappa(function() {\n return client({\n '/index.js': function() {\n return get({\n '#/': function() {\n return alert('hi');\n }\n });\n }\n });\n });\n headers = {\n 'Content-Type': 'application/javascript'\n };\n body = ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });';\n return t.response({\n url: '/index.js'\n }, {headers, body});\n },\n coffee: function() {\n var body, headers, t;\n t = zappa(function() {\n return coffee({\n '/coffee.js': function() {\n return alert('hi');\n }\n });\n });\n headers = {\n 'Content-Type': 'application/javascript'\n };\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();';\n return t.response({\n url: '/coffee.js'\n }, {headers, body});\n },\n js: function() {\n var body, headers, t;\n t = zappa(function() {\n return js({\n '/js.js': `alert('hi');`\n });\n });\n headers = {\n 'Content-Type': 'application/javascript'\n };\n body = \"alert('hi');\";\n return t.response({\n url: '/js.js'\n }, {headers, body});\n },\n css: function() {\n var body, headers, t;\n t = zappa(function() {\n return css({\n '/index.css': `font-family: sans-serif;`\n });\n });\n headers = {\n 'Content-Type': 'text/css'\n };\n body = 'font-family: sans-serif;';\n return t.response({\n url: '/index.css'\n }, {headers, body});\n },\n stylus: function() {\n var headers, t;\n t = zappa(function() {\n return stylus({\n '/index.css': `border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\nbody\n font 12px Helvetica, Arial, sans-serif\n\na.button\n border-radius 5px`\n });\n });\n return headers = {\n 'Content-Type': 'text/css'\n };\n }\n};\n```", "response": "module.exports =\n client: ->\n t = zappa ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.response {url: '/index.js'}, {headers, body}\n\n coffee: ->\n t = zappa ->\n coffee '/coffee.js': ->\n alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.response {url: '/coffee.js'}, {headers, body}\n\n js: ->\n t = zappa ->\n js '/js.js': '''\n alert('hi');\n '''\n headers = 'Content-Type': 'application/javascript'\n body = \"alert('hi');\"\n t.response {url: '/js.js'}, {headers, body}\n\n css: ->\n t = zappa ->\n css '/index.css': '''\n font-family: sans-serif;\n '''\n headers = 'Content-Type': 'text/css'\n body = 'font-family: sans-serif;'\n t.response {url: '/index.css'}, {headers, body}\n\n stylus: ->\n t = zappa ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n headers = 'Content-Type': 'text/css'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "3c5114ebe4b768e7266ad497703eff62404efac3", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/3c5114ebe4b768e7266ad497703eff62404efac3/tests/assets.coffee", "line_start": 3, "line_end": 52} +{"id": "mauricemach/zappa:tests/assets.coffee:1:completion", "type": "completion", "prompt": "module.exports =\n client: ->\n t = zappa ->\n client '/index.js': ->\n get '#/': -> alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';zappa.run(function () {\\n return get({\\n \\'#/\\': function() {\\n return alert(\\'hi\\');\\n }\\n });\\n });'\n t.response {url: '/index.js'}, {headers, body}\n\n coffee: ->\n t = zappa ->\n coffee '/coffee.js': ->\n alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.response {url: '/coffee.js'}, {headers, body}\n\n js: ->\n t = zappa ->\n js '/js.js': '''\n alert('hi');\n '''\n headers = 'Content-Type': 'application/javascript'\n body = \"alert('hi');\"\n t.response {url: '/js.js'}, {headers, body}", "response": "css: ->\n t = zappa ->\n css '/index.css': '''\n font-family: sans-serif;\n '''\n headers = 'Content-Type': 'text/css'\n body = 'font-family: sans-serif;'\n t.response {url: '/index.css'}, {headers, body}\n\n stylus: ->\n t = zappa ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n headers = 'Content-Type': 'text/css'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "3c5114ebe4b768e7266ad497703eff62404efac3", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/3c5114ebe4b768e7266ad497703eff62404efac3/tests/assets.coffee", "line_start": 3, "line_end": 52} +{"id": "mauricemach/zappa:tests/assets.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "body = '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n t.response {url: '/index.css'}, {headers, body}\n\n jquery: ->\n t = zappa ->\n enable 'serve jquery'\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '92334'\n t.response {url: '/zappa/jquery.js'}, {status, headers}\n\n sammy: ->\n t = zappa ->\n enable 'serve sammy'\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '16854'\n t.response {url: '/zappa/sammy.js'}, {status, headers}\n\n zappa: ->\n t = zappa ->\n enable 'serve zappa'\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '6864'\n t.response {url: '/zappa/zappa.js'}, {status, headers}\n\n 'zappa (automatic)': ->\n t = zappa ->\n client '/index.js': ->\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '6864'\n t.response {url: '/zappa/zappa.js'}, {status, headers}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "3c5114ebe4b768e7266ad497703eff62404efac3", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/3c5114ebe4b768e7266ad497703eff62404efac3/tests/assets.coffee", "line_start": 53, "line_end": 100} +{"id": "mauricemach/zappa:tests/assets.coffee:2:completion", "type": "completion", "prompt": "body = '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n\n '''\n t.response {url: '/index.css'}, {headers, body}\n\n jquery: ->\n t = zappa ->\n enable 'serve jquery'\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '92334'\n t.response {url: '/zappa/jquery.js'}, {status, headers}\n\n sammy: ->\n t = zappa ->", "response": "enable 'serve sammy'\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '16854'\n t.response {url: '/zappa/sammy.js'}, {status, headers}\n\n zappa: ->\n t = zappa ->\n enable 'serve zappa'\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '6864'\n t.response {url: '/zappa/zappa.js'}, {status, headers}\n\n 'zappa (automatic)': ->\n t = zappa ->\n client '/index.js': ->\n status = 200\n headers =\n 'Content-Type': 'application/javascript'\n 'Content-Length': '6864'\n t.response {url: '/zappa/zappa.js'}, {status, headers}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "3c5114ebe4b768e7266ad497703eff62404efac3", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/3c5114ebe4b768e7266ad497703eff62404efac3/tests/assets.coffee", "line_start": 53, "line_end": 100} +{"id": "mauricemach/zappa:tests/assets.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "zappa = require('./support/tester') require('../src/zappa')\n\nmodule.exports =\n coffee: ->\n t = zappa ->\n coffee '/coffee.js': ->\n alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.response {url: '/coffee.js'}, {headers, body}\n\n js: ->\n t = zappa ->\n js '/js.js': '''\n alert('hi');\n '''\n headers = 'Content-Type': 'application/javascript'\n body = \"alert('hi');\"\n t.response {url: '/js.js'}, {headers, body}\n\n css: ->\n t = zappa ->\n css '/index.css': '''\n font-family: sans-serif;\n '''\n headers = 'Content-Type': 'text/css'\n body = 'font-family: sans-serif;'\n t.response {url: '/index.css'}, {headers, body}\n\n stylus: ->\n t = zappa ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n headers = 'Content-Type': 'text/css'\n body = '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e338cf805cb6b68ea06957166238560063d1f1e4", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/assets.coffee", "line_start": 1, "line_end": 50} +{"id": "mauricemach/zappa:tests/assets.coffee:1:completion", "type": "completion", "prompt": "zappa = require('./support/tester') require('../src/zappa')\n\nmodule.exports =\n coffee: ->\n t = zappa ->\n coffee '/coffee.js': ->\n alert 'hi'\n headers = 'Content-Type': 'application/javascript'\n body = ';var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\\n return alert(\\'hi\\');\\n })();'\n t.response {url: '/coffee.js'}, {headers, body}\n\n js: ->\n t = zappa ->\n js '/js.js': '''\n alert('hi');\n '''\n headers = 'Content-Type': 'application/javascript'\n body = \"alert('hi');\"\n t.response {url: '/js.js'}, {headers, body}\n\n css: ->\n t = zappa ->\n css '/index.css': '''\n font-family: sans-serif;\n '''", "response": "headers = 'Content-Type': 'text/css'\n body = 'font-family: sans-serif;'\n t.response {url: '/index.css'}, {headers, body}\n\n stylus: ->\n t = zappa ->\n stylus '/index.css': '''\n border-radius()\n -webkit-border-radius arguments\n -moz-border-radius arguments\n border-radius arguments\n\n body\n font 12px Helvetica, Arial, sans-serif\n\n a.button\n border-radius 5px\n '''\n headers = 'Content-Type': 'text/css'\n body = '''\n body {\n font: 12px Helvetica, Arial, sans-serif;\n }\n a.button {\n -webkit-border-radius: 5px;", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "tests/assets.coffee", "license": "MIT", "commit": "e338cf805cb6b68ea06957166238560063d1f1e4", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/assets.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/util/url.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "detect = require './detect'\n\nexports.issueUrl = 'http://tburl.in/3e8ad2b0'\nexports.feedbackUrl = 'https://jianliao.com/page/invite/e840f0402t'\nexports.xiaoaiAvatar = 'https://dn-talk.oss.aliyuncs.com/images/icons/talkai@2x.png'\nexports.emailIcon = 'https://dn-talk.oss.aliyuncs.com/icons/email@2x.png'\n\nexports.iosAppUrl = 'https://itunes.apple.com/cn/app/talk-by-teambition/id922425179?mt=8'\nexports.macAppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk.dmg'\nexports.androidAppUrl = 'https://dn-talk.oss.aliyuncs.com/downloads/talk-teambition-release.apk'\nexports.windows32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-ia32.zip'\nexports.windows64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-x64.zip'\nexports.linux32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-ia32.tar.gz'\nexports.linux64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-x64.tar.gz'\n\njianliaoPages = [\n /^\\/site/\n /^\\/blog/\n /^\\/doc/\n /^\\/page/\n /^\\/v\\d/\n /^\\/t\\//\n]\n\nexports.isInRoutes = (locationOrigin, href) ->\n isOrigin = href.indexOf(locationOrigin) is 0\n\n routePath = href.substr(locationOrigin.length)\n isException = jianliaoPages.some (route) ->\n routePath.match(route)?\n\n isOrigin and not isException", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/url.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/url.coffee", "line_start": 1, "line_end": 32} +{"id": "jianliaoim/talk-os:talk-web/client/util/url.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndetect = require './detect'\n\nexports.issueUrl = 'http://tburl.in/3e8ad2b0'\nexports.feedbackUrl = 'https://jianliao.com/page/invite/e840f0402t'\nexports.xiaoaiAvatar = 'https://dn-talk.oss.aliyuncs.com/images/icons/talkai@2x.png'\nexports.emailIcon = 'https://dn-talk.oss.aliyuncs.com/icons/email@2x.png'\n\nexports.iosAppUrl = 'https://itunes.apple.com/cn/app/talk-by-teambition/id922425179?mt=8'\nexports.macAppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk.dmg'\nexports.androidAppUrl = 'https://dn-talk.oss.aliyuncs.com/downloads/talk-teambition-release.apk'\nexports.windows32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-ia32.zip'\nexports.windows64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-x64.zip'\nexports.linux32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-ia32.tar.gz'\nexports.linux64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-x64.tar.gz'\n\njianliaoPages = [\n /^\\/site/\n /^\\/blog/\n /^\\/doc/\n /^\\/page/\n /^\\/v\\d/\n /^\\/t\\//\n]\n\nexports.isInRoutes = (locationOrigin, href) ->\n isOrigin = href.indexOf(locationOrigin) is 0\n\n routePath = href.substr(locationOrigin.length)\n isException = jianliaoPages.some (route) ->\n routePath.match(route)?\n\n isOrigin and not isException\n```", "response": "var detect, jianliaoPages;\n\ndetect = require('./detect');\n\nexports.issueUrl = 'http://tburl.in/3e8ad2b0';\n\nexports.feedbackUrl = 'https://jianliao.com/page/invite/e840f0402t';\n\nexports.xiaoaiAvatar = 'https://dn-talk.oss.aliyuncs.com/images/icons/talkai@2x.png';\n\nexports.emailIcon = 'https://dn-talk.oss.aliyuncs.com/icons/email@2x.png';\n\nexports.iosAppUrl = 'https://itunes.apple.com/cn/app/talk-by-teambition/id922425179?mt=8';\n\nexports.macAppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk.dmg';\n\nexports.androidAppUrl = 'https://dn-talk.oss.aliyuncs.com/downloads/talk-teambition-release.apk';\n\nexports.windows32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-ia32.zip';\n\nexports.windows64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-x64.zip';\n\nexports.linux32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-ia32.tar.gz';\n\nexports.linux64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-x64.tar.gz';\n\njianliaoPages = [/^\\/site/, /^\\/blog/, /^\\/doc/, /^\\/page/, /^\\/v\\d/, /^\\/t\\//];\n\nexports.isInRoutes = function(locationOrigin, href) {\n var isException, isOrigin, routePath;\n isOrigin = href.indexOf(locationOrigin) === 0;\n routePath = href.substr(locationOrigin.length);\n isException = jianliaoPages.some(function(route) {\n return routePath.match(route) != null;\n });\n return isOrigin && !isException;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/url.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/url.coffee", "line_start": 1, "line_end": 32} +{"id": "jianliaoim/talk-os:talk-web/client/util/url.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar detect, jianliaoPages;\n\ndetect = require('./detect');\n\nexports.issueUrl = 'http://tburl.in/3e8ad2b0';\n\nexports.feedbackUrl = 'https://jianliao.com/page/invite/e840f0402t';\n\nexports.xiaoaiAvatar = 'https://dn-talk.oss.aliyuncs.com/images/icons/talkai@2x.png';\n\nexports.emailIcon = 'https://dn-talk.oss.aliyuncs.com/icons/email@2x.png';\n\nexports.iosAppUrl = 'https://itunes.apple.com/cn/app/talk-by-teambition/id922425179?mt=8';\n\nexports.macAppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk.dmg';\n\nexports.androidAppUrl = 'https://dn-talk.oss.aliyuncs.com/downloads/talk-teambition-release.apk';\n\nexports.windows32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-ia32.zip';\n\nexports.windows64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-x64.zip';\n\nexports.linux32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-ia32.tar.gz';\n\nexports.linux64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-x64.tar.gz';\n\njianliaoPages = [/^\\/site/, /^\\/blog/, /^\\/doc/, /^\\/page/, /^\\/v\\d/, /^\\/t\\//];\n\nexports.isInRoutes = function(locationOrigin, href) {\n var isException, isOrigin, routePath;\n isOrigin = href.indexOf(locationOrigin) === 0;\n routePath = href.substr(locationOrigin.length);\n isException = jianliaoPages.some(function(route) {\n return routePath.match(route) != null;\n });\n return isOrigin && !isException;\n};\n```", "response": "detect = require './detect'\n\nexports.issueUrl = 'http://tburl.in/3e8ad2b0'\nexports.feedbackUrl = 'https://jianliao.com/page/invite/e840f0402t'\nexports.xiaoaiAvatar = 'https://dn-talk.oss.aliyuncs.com/images/icons/talkai@2x.png'\nexports.emailIcon = 'https://dn-talk.oss.aliyuncs.com/icons/email@2x.png'\n\nexports.iosAppUrl = 'https://itunes.apple.com/cn/app/talk-by-teambition/id922425179?mt=8'\nexports.macAppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk.dmg'\nexports.androidAppUrl = 'https://dn-talk.oss.aliyuncs.com/downloads/talk-teambition-release.apk'\nexports.windows32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-ia32.zip'\nexports.windows64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-x64.zip'\nexports.linux32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-ia32.tar.gz'\nexports.linux64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-x64.tar.gz'\n\njianliaoPages = [\n /^\\/site/\n /^\\/blog/\n /^\\/doc/\n /^\\/page/\n /^\\/v\\d/\n /^\\/t\\//\n]\n\nexports.isInRoutes = (locationOrigin, href) ->\n isOrigin = href.indexOf(locationOrigin) is 0\n\n routePath = href.substr(locationOrigin.length)\n isException = jianliaoPages.some (route) ->\n routePath.match(route)?\n\n isOrigin and not isException", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/url.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/url.coffee", "line_start": 1, "line_end": 32} +{"id": "jianliaoim/talk-os:talk-web/client/util/url.coffee:1:completion", "type": "completion", "prompt": "detect = require './detect'\n\nexports.issueUrl = 'http://tburl.in/3e8ad2b0'\nexports.feedbackUrl = 'https://jianliao.com/page/invite/e840f0402t'\nexports.xiaoaiAvatar = 'https://dn-talk.oss.aliyuncs.com/images/icons/talkai@2x.png'\nexports.emailIcon = 'https://dn-talk.oss.aliyuncs.com/icons/email@2x.png'\n\nexports.iosAppUrl = 'https://itunes.apple.com/cn/app/talk-by-teambition/id922425179?mt=8'\nexports.macAppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk.dmg'\nexports.androidAppUrl = 'https://dn-talk.oss.aliyuncs.com/downloads/talk-teambition-release.apk'\nexports.windows32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-ia32.zip'\nexports.windows64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-win32-x64.zip'\nexports.linux32AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-ia32.tar.gz'\nexports.linux64AppUrl = 'https://dn-talk.oss.aliyuncs.com/app-downloads/talk-linux-x64.tar.gz'\n\njianliaoPages = [", "response": "/^\\/site/\n /^\\/blog/\n /^\\/doc/\n /^\\/page/\n /^\\/v\\d/\n /^\\/t\\//\n]\n\nexports.isInRoutes = (locationOrigin, href) ->\n isOrigin = href.indexOf(locationOrigin) is 0\n\n routePath = href.substr(locationOrigin.length)\n isException = jianliaoPages.some (route) ->\n routePath.match(route)?\n\n isOrigin and not isException", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/url.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/url.coffee", "line_start": 1, "line_end": 32} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.experimental == '1'\n @experimental = true\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.experimental == '1'\n @experimental = true\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.experimental === '1') {\n this.experimental = true;\n }\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n loadJsonStringIntoProject(jsonString) {\n var json;\n return json = JSON.parse(jsonString);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.1\";\n\n return Editor;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.experimental === '1') {\n this.experimental = true;\n }\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n loadJsonStringIntoProject(jsonString) {\n var json;\n return json = JSON.parse(jsonString);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.1\";\n\n return Editor;\n\n}).call(this);\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.experimental == '1'\n @experimental = true\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)", "response": "# Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.experimental == '1'\n @experimental = true\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.\n if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n loadJsonStringIntoProjectFromExternalSource: (jsonString) ->\n @loadJsonStringIntoProject(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n\n getJsonStringOfProject: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @getJsonStringOfProject()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @loadJsonStringIntoProject(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @getJsonStringOfProject()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "# TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.\n if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n loadJsonStringIntoProjectFromExternalSource: (jsonString) ->\n @loadJsonStringIntoProject(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n\n getJsonStringOfProject: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================", "response": "localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @getJsonStringOfProject()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @loadJsonStringIntoProject(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @getJsonStringOfProject()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nloadFromFile: ->\n Storage.loadFile (jsonString) =>\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n```", "response": "({\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.loadJsonStringIntoProjectFromExternalSource(jsonString);\n });\n },\n // ===========================================================================\n // External URL\n // ===========================================================================\n\n // TODO: Deal with error conditions, timeout, etc.\n // TODO: Maybe move xhr stuff to Util.\n // TODO: Show some sort of loading indicator.\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n return this.loadJsonStringIntoProjectFromExternalSource(jsonString);\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.getJsonStringOfProject();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.loadJsonStringIntoProjectFromExternalSource(jsonString);\n });\n },\n // ===========================================================================\n // External URL\n // ===========================================================================\n\n // TODO: Deal with error conditions, timeout, etc.\n // TODO: Maybe move xhr stuff to Util.\n // TODO: Show some sort of loading indicator.\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n return this.loadJsonStringIntoProjectFromExternalSource(jsonString);\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.getJsonStringOfProject();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n }\n});\n```", "response": "loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:completion", "type": "completion", "prompt": "loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History", "response": "# ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 159, "line_end": 171} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nredo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0\n```", "response": "({\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n },\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 159, "line_end": 171} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n },\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});\n```", "response": "redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 159, "line_end": 171} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:completion", "type": "completion", "prompt": "redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()", "response": "isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a9c998cb75d6726b1cf5eb5b059f2c7b6d1e11a2/src/Model/Editor.coffee", "line_start": 159, "line_end": 171} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n loadJsonStringIntoProject(jsonString) {\n var json;\n return json = JSON.parse(jsonString);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.1\";\n\n return Editor;\n\n}).call(this);\n\n// TODO: If the file format changes, this will need to check the version\n// and convert or fail appropriately.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n loadJsonStringIntoProject(jsonString) {\n var json;\n return json = JSON.parse(jsonString);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.1\";\n\n return Editor;\n\n}).call(this);\n\n// TODO: If the file format changes, this will need to check the version\n// and convert or fail appropriately.\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)", "response": "# Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n loadJsonStringIntoProject: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n loadJsonStringIntoProjectFromExternalSource: (jsonString) ->\n @loadJsonStringIntoProject(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n\n getJsonStringOfProject: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @getJsonStringOfProject()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @loadJsonStringIntoProject(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @getJsonStringOfProject()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n loadJsonStringIntoProjectFromExternalSource: (jsonString) ->\n @loadJsonStringIntoProject(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n\n getJsonStringOfProject: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @getJsonStringOfProject()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @loadJsonStringIntoProject(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @getJsonStringOfProject()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n```", "response": "if (json.type === \"Apparatus\") {\n this.project = this.serializer.dejsonify(json);\n}\n\n({\n loadJsonStringIntoProjectFromExternalSource: function(jsonString) {\n this.loadJsonStringIntoProject(jsonString);\n this.checkpoint();\n return Apparatus.refresh(); // HACK: calling Apparatus seems funky here.\n },\n getJsonStringOfProject: function() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n },\n createNewProject: function() {\n return this.project = new Model.Project();\n },\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.getJsonStringOfProject();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.loadJsonStringIntoProject(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.getJsonStringOfProject();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {});\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (json.type === \"Apparatus\") {\n this.project = this.serializer.dejsonify(json);\n}\n\n({\n loadJsonStringIntoProjectFromExternalSource: function(jsonString) {\n this.loadJsonStringIntoProject(jsonString);\n this.checkpoint();\n return Apparatus.refresh(); // HACK: calling Apparatus seems funky here.\n },\n getJsonStringOfProject: function() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n },\n createNewProject: function() {\n return this.project = new Model.Project();\n },\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.getJsonStringOfProject();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.loadJsonStringIntoProject(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.getJsonStringOfProject();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {});\n }\n});\n```", "response": "if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n loadJsonStringIntoProjectFromExternalSource: (jsonString) ->\n @loadJsonStringIntoProject(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n\n getJsonStringOfProject: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @getJsonStringOfProject()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @loadJsonStringIntoProject(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @getJsonStringOfProject()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n loadJsonStringIntoProjectFromExternalSource: (jsonString) ->\n @loadJsonStringIntoProject(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n\n getJsonStringOfProject: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"", "response": "saveToLocalStorage: ->\n jsonString = @getJsonStringOfProject()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @loadJsonStringIntoProject(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @getJsonStringOfProject()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n redo: ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n redo: ->\n```", "response": "this.loadJsonStringIntoProjectFromExternalSource(jsonString)({\n // ===========================================================================\n // External URL\n // ===========================================================================\n\n // TODO: Deal with error conditions, timeout, etc.\n // TODO: Maybe move xhr stuff to Util.\n // TODO: Show some sort of loading indicator.\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n return this.loadJsonStringIntoProjectFromExternalSource(jsonString);\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.getJsonStringOfProject();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {}\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis.loadJsonStringIntoProjectFromExternalSource(jsonString)({\n // ===========================================================================\n // External URL\n // ===========================================================================\n\n // TODO: Deal with error conditions, timeout, etc.\n // TODO: Maybe move xhr stuff to Util.\n // TODO: Show some sort of loading indicator.\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n return this.loadJsonStringIntoProjectFromExternalSource(jsonString);\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.getJsonStringOfProject();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {}\n});\n```", "response": "@loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n redo: ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:completion", "type": "completion", "prompt": "@loadJsonStringIntoProjectFromExternalSource(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @loadJsonStringIntoProjectFromExternalSource(jsonString)\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================", "response": "_setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @getJsonStringOfProject()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n redo: ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 159, "line_end": 169} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreturn unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0\n```", "response": "if (!this.isRedoable()) {\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n}\n\n({\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 159, "line_end": 169} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (!this.isRedoable()) {\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.loadJsonStringIntoProject(this.current);\n return this.saveToLocalStorage();\n}\n\n({\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});\n```", "response": "return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 159, "line_end": 169} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:completion", "type": "completion", "prompt": "return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @loadJsonStringIntoProject(@current)\n @saveToLocalStorage()", "response": "isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "7e4cb8771426288afdc4758d7c6208cc233018c5", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/7e4cb8771426288afdc4758d7c6208cc233018c5/src/Model/Editor.coffee", "line_start": 159, "line_end": 169} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n return json = JSON.parse(jsonString);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.1\";\n\n return Editor;\n\n}).call(this);\n\n// TODO: If the file format changes, this will need to check the version\n// and convert or fail appropriately.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n return json = JSON.parse(jsonString);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.1\";\n\n return Editor;\n\n}).call(this);\n\n// TODO: If the file format changes, this will need to check the version\n// and convert or fail appropriately.\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)", "response": "# Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.1\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n # TODO: If the file format changes, this will need to check the version\n # and convert or fail appropriately.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL\n```", "response": "if (json.type === \"Apparatus\") {\n this.project = this.serializer.dejsonify(json);\n}\n\n({\n save: function() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n },\n createNewProject: function() {\n return this.project = new Model.Project();\n },\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n }\n});\n\n// ===========================================================================\n// External URL", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (json.type === \"Apparatus\") {\n this.project = this.serializer.dejsonify(json);\n}\n\n({\n save: function() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n },\n createNewProject: function() {\n return this.project = new Model.Project();\n },\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n }\n});\n\n// ===========================================================================\n// External URL\n```", "response": "if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "if json.type == \"Apparatus\"\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString", "response": "loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n```", "response": "// ===========================================================================\n\n// TODO: Deal with error conditions, timeout, etc.\n// TODO: Maybe move xhr stuff to Util.\n// TODO: Show some sort of loading indicator.\n({\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n this.load(jsonString);\n this.checkpoint();\n return Apparatus.refresh(); // HACK: calling Apparatus seems funky here.\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.save();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n return this.current = this.redoStack.pop();\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// ===========================================================================\n\n// TODO: Deal with error conditions, timeout, etc.\n// TODO: Maybe move xhr stuff to Util.\n// TODO: Show some sort of loading indicator.\n({\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n this.load(jsonString);\n this.checkpoint();\n return Apparatus.refresh(); // HACK: calling Apparatus seems funky here.\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.save();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n return this.current = this.redoStack.pop();\n }\n});\n```", "response": "# ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:completion", "type": "completion", "prompt": "# ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.", "response": "@current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 159, "line_end": 166} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:completion", "type": "completion", "prompt": "@load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->", "response": "return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0d3acbcbe264f318b00e15e2dd1b9eff2e929203", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0d3acbcbe264f318b00e15e2dd1b9eff2e929203/src/Model/Editor.coffee", "line_start": 159, "line_end": 166} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = new Model.Layout();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = new Model.Layout()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)", "response": "# Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsave: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n```", "response": "({\n save: function() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n },\n createNewProject: function() {\n return this.project = new Model.Project();\n },\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n }\n});\n\n// ===========================================================================\n// External URL\n// ===========================================================================", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n save: function() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n },\n createNewProject: function() {\n return this.project = new Model.Project();\n },\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n }\n});\n\n// ===========================================================================\n// External URL\n// ===========================================================================\n```", "response": "save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]", "response": "if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n```", "response": "// TODO: Deal with error conditions, timeout, etc.\n// TODO: Maybe move xhr stuff to Util.\n// TODO: Show some sort of loading indicator.\n({\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n this.load(jsonString);\n this.checkpoint();\n return Apparatus.refresh(); // HACK: calling Apparatus seems funky here.\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.save();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// TODO: Deal with error conditions, timeout, etc.\n// TODO: Maybe move xhr stuff to Util.\n// TODO: Show some sort of loading indicator.\n({\n loadFromURL: function(url) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n var jsonString;\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.status !== 200) {\n return;\n }\n jsonString = xhr.responseText;\n this.load(jsonString);\n this.checkpoint();\n return Apparatus.refresh(); // HACK: calling Apparatus seems funky here.\n };\n xhr.open(\"GET\", url, true);\n return xhr.send();\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.save();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n this.undoStack.push(this.current);\n if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n }\n this.redoStack = [];\n return this.current = jsonString;\n },\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n }\n});\n```", "response": "# TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:completion", "type": "completion", "prompt": "# TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->\n xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []", "response": "@redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 159, "line_end": 164} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0\n```", "response": "({\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 159, "line_end": 164} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});\n```", "response": "isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 159, "line_end": 164} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:4:completion", "type": "completion", "prompt": "isUndoable: ->\n return @undoStack.length > 0", "response": "isRedoable: ->\n return @redoStack.length > 0", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Editor.coffee", "line_start": 159, "line_end": 164} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = { rightPanelWidth: 400 }\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "c07e280ab05c9576a00549820e25b0f8383f0024", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/c07e280ab05c9576a00549820e25b0f8383f0024/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = { rightPanelWidth: 400 }\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = {\n rightPanelWidth: 400\n };\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "c07e280ab05c9576a00549820e25b0f8383f0024", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/c07e280ab05c9576a00549820e25b0f8383f0024/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupLayout();\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupLayout() {\n return this.layout = {\n rightPanelWidth: 400\n };\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = { rightPanelWidth: 400 }\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "c07e280ab05c9576a00549820e25b0f8383f0024", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/c07e280ab05c9576a00549820e25b0f8383f0024/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupLayout()\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupLayout: ->\n @layout = { rightPanelWidth: 400 }\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)", "response": "# Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "c07e280ab05c9576a00549820e25b0f8383f0024", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/c07e280ab05c9576a00549820e25b0f8383f0024/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json;\n json = this.serializer.jsonify(this.project);\n return json.type = \"Apparatus\";\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n this._parseQueryString();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // Checks if we should load an external JSON file based on the query string\n // (the ?stuff at the end of the URL).\n _parseQueryString() {\n var parsed;\n parsed = queryString.parse(location.search);\n if (parsed.load) {\n return this.loadFromURL(parsed.load);\n }\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json;\n json = this.serializer.jsonify(this.project);\n return json.type = \"Apparatus\";\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)\n if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n @_parseQueryString()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # Checks if we should load an external JSON file based on the query string\n # (the ?stuff at the end of the URL).\n _parseQueryString: ->\n parsed = queryString.parse(location.search)", "response": "if parsed.load\n @loadFromURL(parsed.load)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 9, "line_end": 58} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->", "response": "delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # External URL\n # ===========================================================================\n\n # TODO: Deal with error conditions, timeout, etc.\n # TODO: Maybe move xhr stuff to Util.\n # TODO: Show some sort of loading indicator.\n loadFromURL: (url) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 59, "line_end": 108} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:completion", "type": "completion", "prompt": "xhr = new XMLHttpRequest()\n xhr.onreadystatechange = =>\n return unless xhr.readyState == 4\n return unless xhr.status == 200\n jsonString = xhr.responseText\n @load(jsonString)\n @checkpoint()\n Apparatus.refresh() # HACK: calling Apparatus seems funky here.\n xhr.open(\"GET\", url, true)\n xhr.send()\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100", "response": "checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "78d3d0bd60324c54fb3594489ce6317ca27081a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/78d3d0bd60324c54fb3594489ce6317ca27081a2/src/Model/Editor.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n createNewProject() {\n return this.project = new Model.Project();\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n this._setupRevision();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n createNewProject() {\n return this.project = new Model.Project();\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n @_setupRevision()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references", "response": "# are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 58, "line_end": 107} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)\n```", "response": "// ===========================================================================\n// Local Storage\n// ===========================================================================\n({\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.save();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n return this.undoStack.push(this.current);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 58, "line_end": 107} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// ===========================================================================\n// Local Storage\n// ===========================================================================\n({\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n window.localStorage[this.localStorageName] = jsonString;\n return jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n _setupRevision: function() {\n // @current is a JSON string representing the current state. @undoStack and\n // @redoStack are arrays of such JSON strings.\n this.current = this.save();\n this.undoStack = [];\n this.redoStack = [];\n return this.maxUndoStackSize = 100;\n },\n checkpoint: function() {\n var jsonString;\n jsonString = this.saveToLocalStorage();\n if (this.current === jsonString) {\n return;\n }\n return this.undoStack.push(this.current);\n }\n});\n```", "response": "# ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 58, "line_end": 107} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "# ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n return jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->", "response": "jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n _setupRevision: ->\n # @current is a JSON string representing the current state. @undoStack and\n # @redoStack are arrays of such JSON strings.\n @current = @save()\n @undoStack = []\n @redoStack = []\n @maxUndoStackSize = 100\n\n checkpoint: ->\n jsonString = @saveToLocalStorage()\n return if @current == jsonString\n @undoStack.push(@current)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 58, "line_end": 107} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 108, "line_end": 131} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0\n```", "response": "if (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n}\n\nthis.redoStack = [];\n\nthis.current = jsonString;\n\n({\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 108, "line_end": 131} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (this.undoStack.length > this.maxUndoStackSize) {\n this.undoStack.shift();\n}\n\nthis.redoStack = [];\n\nthis.current = jsonString;\n\n({\n undo: function() {\n if (!this.isUndoable()) {\n return;\n }\n this.redoStack.push(this.current);\n this.current = this.undoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n redo: function() {\n if (!this.isRedoable()) {\n return;\n }\n this.undoStack.push(this.current);\n this.current = this.redoStack.pop();\n this.load(this.current);\n return this.saveToLocalStorage();\n },\n isUndoable: function() {\n return this.undoStack.length > 0;\n },\n isRedoable: function() {\n return this.redoStack.length > 0;\n }\n});\n```", "response": "if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 108, "line_end": 131} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:3:completion", "type": "completion", "prompt": "if @undoStack.length > @maxUndoStackSize\n @undoStack.shift()\n @redoStack = []\n @current = jsonString\n\n undo: ->\n return unless @isUndoable()\n @redoStack.push(@current)\n @current = @undoStack.pop()\n @load(@current)\n @saveToLocalStorage()", "response": "redo: ->\n return unless @isRedoable()\n @undoStack.push(@current)\n @current = @redoStack.pop()\n @load(@current)\n @saveToLocalStorage()\n\n isUndoable: ->\n return @undoStack.length > 0\n\n isRedoable: ->\n return @redoStack.length > 0", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "a5d0fda468599b02ead67939236e58b5e5f7133e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/a5d0fda468599b02ead67939236e58b5e5f7133e/src/Model/Editor.coffee", "line_start": 108, "line_end": 131} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n createNewProject() {\n return this.project = new Model.Project();\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n\n// ===========================================================================", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.createNewProject();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n createNewProject() {\n return this.project = new Model.Project();\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n\n// ===========================================================================\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @createNewProject()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->", "response": "builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n createNewProject: ->\n @project = new Model.Project()\n\n\n # ===========================================================================", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 58, "line_end": 97} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo\n```", "response": "// Local Storage\n// ===========================================================================\n({\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 58, "line_end": 97} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Local Storage\n// ===========================================================================\n({\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n loadFromFile: function() {\n return Storage.loadFile((jsonString) => {\n return this.load(jsonString);\n });\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo\n```", "response": "# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 58, "line_end": 97} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System", "response": "# ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n loadFromFile: ->\n Storage.loadFile (jsonString) =>\n @load(jsonString)\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/0bdf63f021ef20f44ff8e4a1b8f5831afddc06a2/src/Model/Editor.coffee", "line_start": 58, "line_end": 97} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "9f376cbe85686e8b2d6e773ae7acb849d664d605", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/9f376cbe85686e8b2d6e773ae7acb849d664d605/src/Model/Editor.coffee", "line_start": 58, "line_end": 93} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo\n```", "response": "// Local Storage\n// ===========================================================================\n({\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "9f376cbe85686e8b2d6e773ae7acb849d664d605", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/9f376cbe85686e8b2d6e773ae7acb849d664d605/src/Model/Editor.coffee", "line_start": 58, "line_end": 93} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Local Storage\n// ===========================================================================\n({\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // File System\n // ===========================================================================\n saveToFile: function() {\n var fileName, jsonString;\n jsonString = this.save();\n fileName = this.project.editingElement.label + \".json\";\n return Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\");\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo\n```", "response": "# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "9f376cbe85686e8b2d6e773ae7acb849d664d605", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/9f376cbe85686e8b2d6e773ae7acb849d664d605/src/Model/Editor.coffee", "line_start": 58, "line_end": 93} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "# Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]", "response": "# ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "9f376cbe85686e8b2d6e773ae7acb849d664d605", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/9f376cbe85686e8b2d6e773ae7acb849d664d605/src/Model/Editor.coffee", "line_start": 58, "line_end": 93} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "cf852f8f3204e99b0b82086a5e12c68ca40a225e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/cf852f8f3204e99b0b82086a5e12c68ca40a225e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n```", "response": "var Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.project = new Model.Project();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n\n// ===========================================================================\n// Local Storage\n// ===========================================================================", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "cf852f8f3204e99b0b82086a5e12c68ca40a225e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/cf852f8f3204e99b0b82086a5e12c68ca40a225e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor,\n hasProp = {}.hasOwnProperty;\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.project = new Model.Project();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n\n// ===========================================================================\n// Local Storage\n// ===========================================================================\n```", "response": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "cf852f8f3204e99b0b82086a5e12c68ca40a225e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/cf852f8f3204e99b0b82086a5e12c68ca40a225e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.", "response": "_builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "cf852f8f3204e99b0b82086a5e12c68ca40a225e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/cf852f8f3204e99b0b82086a5e12c68ca40a225e/src/Model/Editor.coffee", "line_start": 8, "line_end": 57} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "cf852f8f3204e99b0b82086a5e12c68ca40a225e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/cf852f8f3204e99b0b82086a5e12c68ca40a225e/src/Model/Editor.coffee", "line_start": 58, "line_end": 90} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================", "response": "# File System\n # ===========================================================================\n\n saveToFile: ->\n jsonString = @save()\n fileName = @project.editingElement.label + \".json\"\n Storage.saveFile(jsonString, fileName, \"application/json;charset=utf-8\")\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "cf852f8f3204e99b0b82086a5e12c68ca40a225e", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/cf852f8f3204e99b0b82086a5e12c68ca40a225e/src/Model/Editor.coffee", "line_start": 58, "line_end": 90} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n```", "response": "var Dataflow, Editor, Model, Storage, Util, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nDataflow = require(\"../Dataflow/Dataflow\");\n\nModel = require(\"./Model\");\n\nUtil = require(\"../Util/Util\");\n\nStorage = require(\"../Storage/Storage\");\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.project = new Model.Project();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n return jsonString = JSON.stringify(json);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dataflow, Editor, Model, Storage, Util, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nDataflow = require(\"../Dataflow/Dataflow\");\n\nModel = require(\"./Model\");\n\nUtil = require(\"../Util/Util\");\n\nStorage = require(\"../Storage/Storage\");\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.project = new Model.Project();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object, ref;\n builtInObjects = [];\n ref = this._builtIn();\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n object = ref[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n // builtIn returns all of the built in classes and objects that are used as\n // the \"anchors\" for serialization and deserialization. That is, all of the\n // objects and classes which should not themselves be serialized but instead\n // be *referenced* from a serialization. When deserialized, these references\n // are then bound appropriately.\n _builtIn() {\n var builtIn;\n builtIn = _.clone(Model);\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv;\n builtIn[\"Matrix\"] = Util.Matrix;\n return builtIn;\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n return jsonString = JSON.stringify(json);\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n return Editor;\n\n}).call(this);\n```", "response": "_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of @_builtIn()\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)", "response": "# builtIn returns all of the built in classes and objects that are used as\n # the \"anchors\" for serialization and deserialization. That is, all of the\n # objects and classes which should not themselves be serialized but instead\n # be *referenced* from a serialization. When deserialized, these references\n # are then bound appropriately.\n _builtIn: ->\n builtIn = _.clone(Model)\n builtIn[\"SpreadEnv\"] = Dataflow.SpreadEnv\n builtIn[\"Matrix\"] = Util.Matrix\n return builtIn\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 51, "line_end": 80} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreturn jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo\n```", "response": "return jsonString({\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 51, "line_end": 80} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nreturn jsonString({\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n localStorageName: \"apparatus\",\n saveToLocalStorage: function() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n },\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo\n```", "response": "return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 51, "line_end": 80} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n\n loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]", "response": "if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Editor.coffee", "line_start": 51, "line_end": 80} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString\n```", "response": "var Editor, Model, Storage, Util, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nModel = require(\"./Model\");\n\nUtil = require(\"../Util/Util\");\n\nStorage = require(\"../Storage/Storage\");\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.project = new Model.Project();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object;\n builtInObjects = [];\n for (name in Model) {\n if (!hasProp.call(Model, name)) continue;\n object = Model[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n saveToLocalStorage() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n Editor.prototype.localStorageName = \"apparatus\";\n\n return Editor;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor, Model, Storage, Util, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nModel = require(\"./Model\");\n\nUtil = require(\"../Util/Util\");\n\nStorage = require(\"../Storage/Storage\");\n\nmodule.exports = Editor = (function() {\n class Editor {\n constructor() {\n this._setupSerializer();\n this._setupProject();\n }\n\n _setupProject() {\n this.loadFromLocalStorage();\n if (!this.project) {\n return this.project = new Model.Project();\n }\n }\n\n _setupSerializer() {\n var builtInObjects, name, object;\n builtInObjects = [];\n for (name in Model) {\n if (!hasProp.call(Model, name)) continue;\n object = Model[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n load(jsonString) {\n var json;\n json = JSON.parse(jsonString);\n if (json.type === \"Apparatus\" && json.version === this.version) {\n return this.project = this.serializer.dejsonify(json);\n }\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n json.version = this.version;\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n saveToLocalStorage() {\n var jsonString;\n jsonString = this.save();\n return window.localStorage[this.localStorageName] = jsonString;\n }\n\n };\n\n // TODO: get version via build process / ENV variable?\n Editor.prototype.version = \"0.4.0\";\n\n // ===========================================================================\n // Local Storage\n // ===========================================================================\n Editor.prototype.localStorageName = \"apparatus\";\n\n return Editor;\n\n}).call(this);\n```", "response": "_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n # TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @_setupSerializer()\n @_setupProject()\n\n _setupProject: ->\n @loadFromLocalStorage()\n if !@project\n @project = new Model.Project()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)", "response": "# TODO: get version via build process / ENV variable?\n version: \"0.4.0\"\n\n load: (jsonString) ->\n json = JSON.parse(jsonString)\n if json.type == \"Apparatus\" and json.version == @version\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n json.version = @version\n jsonString = JSON.stringify(json)\n return jsonString\n\n\n # ===========================================================================\n # Local Storage\n # ===========================================================================\n\n localStorageName: \"apparatus\"\n\n saveToLocalStorage: ->\n jsonString = @save()\n window.localStorage[@localStorageName] = jsonString", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 51, "line_end": 68} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nloadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo\n```", "response": "({\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 51, "line_end": 68} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n loadFromLocalStorage: function() {\n var jsonString;\n jsonString = window.localStorage[this.localStorageName];\n if (jsonString) {\n return this.load(jsonString);\n }\n },\n resetLocalStorage: function() {\n return delete window.localStorage[this.localStorageName];\n },\n // ===========================================================================\n // Revision History\n // ===========================================================================\n checkpoint: function() {\n return this.saveToLocalStorage();\n }\n});\n\n// TODO: undo, redo\n```", "response": "loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]\n\n\n # ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 51, "line_end": 68} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:2:completion", "type": "completion", "prompt": "loadFromLocalStorage: ->\n jsonString = window.localStorage[@localStorageName]\n if jsonString\n @load(jsonString)\n\n resetLocalStorage: ->\n delete window.localStorage[@localStorageName]", "response": "# ===========================================================================\n # Revision History\n # ===========================================================================\n\n checkpoint: ->\n @saveToLocalStorage()\n\n # TODO: undo, redo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "73bc1a6fafa26fa85ccb696fb08702a23eefa7b8", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/73bc1a6fafa26fa85ccb696fb08702a23eefa7b8/src/Model/Editor.coffee", "line_start": 51, "line_end": 68} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @project = new Model.Project()\n @_setupSerializer()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n\n load: (jsonString) ->\n # TODO: check type and version to ensure it's a valid jsonString.\n json = JSON.parse(jsonString)\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n # TODO: get version via build process / ENV variable?\n json.version = \"0.4.0\"\n jsonString = JSON.stringify(json)\n return jsonString", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "01d0628f253632c227bb0a7fc7afac851870213f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Model/Editor.coffee", "line_start": 1, "line_end": 33} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @project = new Model.Project()\n @_setupSerializer()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n\n load: (jsonString) ->\n # TODO: check type and version to ensure it's a valid jsonString.\n json = JSON.parse(jsonString)\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n # TODO: get version via build process / ENV variable?\n json.version = \"0.4.0\"\n jsonString = JSON.stringify(json)\n return jsonString\n```", "response": "var Editor, Model, Storage, Util, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nModel = require(\"./Model\");\n\nUtil = require(\"../Util/Util\");\n\nStorage = require(\"../Storage/Storage\");\n\nmodule.exports = Editor = class Editor {\n constructor() {\n this.project = new Model.Project();\n this._setupSerializer();\n }\n\n _setupSerializer() {\n var builtInObjects, name, object;\n builtInObjects = [];\n for (name in Model) {\n if (!hasProp.call(Model, name)) continue;\n object = Model[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n load(jsonString) {\n var json;\n // TODO: check type and version to ensure it's a valid jsonString.\n json = JSON.parse(jsonString);\n return this.project = this.serializer.dejsonify(json);\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n // TODO: get version via build process / ENV variable?\n json.version = \"0.4.0\";\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "01d0628f253632c227bb0a7fc7afac851870213f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Model/Editor.coffee", "line_start": 1, "line_end": 33} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Editor, Model, Storage, Util, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nModel = require(\"./Model\");\n\nUtil = require(\"../Util/Util\");\n\nStorage = require(\"../Storage/Storage\");\n\nmodule.exports = Editor = class Editor {\n constructor() {\n this.project = new Model.Project();\n this._setupSerializer();\n }\n\n _setupSerializer() {\n var builtInObjects, name, object;\n builtInObjects = [];\n for (name in Model) {\n if (!hasProp.call(Model, name)) continue;\n object = Model[name];\n if (_.isFunction(object)) {\n object = object.prototype;\n }\n Util.assignId(object, name);\n builtInObjects.push(object);\n }\n return this.serializer = new Storage.Serializer(builtInObjects);\n }\n\n load(jsonString) {\n var json;\n // TODO: check type and version to ensure it's a valid jsonString.\n json = JSON.parse(jsonString);\n return this.project = this.serializer.dejsonify(json);\n }\n\n save() {\n var json, jsonString;\n json = this.serializer.jsonify(this.project);\n json.type = \"Apparatus\";\n // TODO: get version via build process / ENV variable?\n json.version = \"0.4.0\";\n jsonString = JSON.stringify(json);\n return jsonString;\n }\n\n};\n```", "response": "_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @project = new Model.Project()\n @_setupSerializer()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype\n Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n\n load: (jsonString) ->\n # TODO: check type and version to ensure it's a valid jsonString.\n json = JSON.parse(jsonString)\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n # TODO: get version via build process / ENV variable?\n json.version = \"0.4.0\"\n jsonString = JSON.stringify(json)\n return jsonString", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "01d0628f253632c227bb0a7fc7afac851870213f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Model/Editor.coffee", "line_start": 1, "line_end": 33} +{"id": "cdglabs/apparatus:src/Model/Editor.coffee:1:completion", "type": "completion", "prompt": "_ = require \"underscore\"\nModel = require \"./Model\"\nUtil = require \"../Util/Util\"\nStorage = require \"../Storage/Storage\"\n\n\nmodule.exports = class Editor\n constructor: ->\n @project = new Model.Project()\n @_setupSerializer()\n\n _setupSerializer: ->\n builtInObjects = []\n for own name, object of Model\n if _.isFunction(object)\n object = object.prototype", "response": "Util.assignId(object, name)\n builtInObjects.push(object)\n @serializer = new Storage.Serializer(builtInObjects)\n\n\n load: (jsonString) ->\n # TODO: check type and version to ensure it's a valid jsonString.\n json = JSON.parse(jsonString)\n @project = @serializer.dejsonify(json)\n\n save: ->\n json = @serializer.jsonify(@project)\n json.type = \"Apparatus\"\n # TODO: get version via build process / ENV variable?\n json.version = \"0.4.0\"\n jsonString = JSON.stringify(json)\n return jsonString", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Editor.coffee", "license": "MIT", "commit": "01d0628f253632c227bb0a7fc7afac851870213f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Model/Editor.coffee", "line_start": 1, "line_end": 33} +{"id": "jianliaoim/talk-os:talk-web/client/util/reqwest.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if typeof window is 'undefined'\n module.exports = {}\nelse\n module.exports = require 'reqwest'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/reqwest.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/reqwest.coffee", "line_start": 1, "line_end": 4} +{"id": "jianliaoim/talk-os:talk-web/client/util/reqwest.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif typeof window is 'undefined'\n module.exports = {}\nelse\n module.exports = require 'reqwest'\n```", "response": "if (typeof window === 'undefined') {\n module.exports = {};\n} else {\n module.exports = require('reqwest');\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/reqwest.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/reqwest.coffee", "line_start": 1, "line_end": 4} +{"id": "jianliaoim/talk-os:talk-web/client/util/reqwest.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (typeof window === 'undefined') {\n module.exports = {};\n} else {\n module.exports = require('reqwest');\n}\n```", "response": "if typeof window is 'undefined'\n module.exports = {}\nelse\n module.exports = require 'reqwest'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/reqwest.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/reqwest.coffee", "line_start": 1, "line_end": 4} +{"id": "jianliaoim/talk-os:talk-web/client/util/reqwest.coffee:1:completion", "type": "completion", "prompt": "if typeof window is 'undefined'\n module.exports = {}", "response": "else\n module.exports = require 'reqwest'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/reqwest.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/reqwest.coffee", "line_start": 1, "line_end": 4} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'metricsGraphics', ->\n {\n restrict: 'EAC'\n scope:\n data: '='\n options: '='\n\n link: (scope, element) ->\n\n $element = $(element)\n chartWidth = $element.width()\n\n # Generate random element ID\n if _.isEmpty $element.prop('id')\n scope.id = 'mg-' + uuid.v4()\n $element.prop 'id', scope.id\n\n redraw = ->\n return unless scope.data?\n\n options =\n title: null\n height: 200\n width: chartWidth\n target: '#' + scope.id\n data: scope.data\n interpolate: 'cardinal'\n interpolate_tension: 0.95\n\n # Apply passed options\n _.assign options, scope.options\n\n # Wrap mouseover\n if options.mouseover?", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'metricsGraphics', ->\n {\n restrict: 'EAC'\n scope:\n data: '='\n options: '='\n\n link: (scope, element) ->", "response": "$element = $(element)\n chartWidth = $element.width()\n\n # Generate random element ID\n if _.isEmpty $element.prop('id')\n scope.id = 'mg-' + uuid.v4()\n $element.prop 'id', scope.id\n\n redraw = ->\n return unless scope.data?\n\n options =\n title: null\n height: 200\n width: chartWidth\n target: '#' + scope.id\n data: scope.data\n interpolate: 'cardinal'\n interpolate_tension: 0.95\n\n # Apply passed options\n _.assign options, scope.options\n\n # Wrap mouseover\n if options.mouseover?", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "getMouseoverText = options.mouseover\n options.mouseover = (d, i) ->\n text = getMouseoverText(d, i)\n d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)\n\n MG.data_graphic options\n\n scope.$watch 'data', (newData) ->\n redraw()\n\n $element.resize _.debounce ->\n chartWidth = $element.width()\n redraw()\n , 100, { leading: false, maxWait: 300 }\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 51, "line_end": 65} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:2:completion", "type": "completion", "prompt": "getMouseoverText = options.mouseover\n options.mouseover = (d, i) ->\n text = getMouseoverText(d, i)\n d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)\n\n MG.data_graphic options", "response": "scope.$watch 'data', (newData) ->\n redraw()\n\n $element.resize _.debounce ->\n chartWidth = $element.width()\n redraw()\n , 100, { leading: false, maxWait: 300 }\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 51, "line_end": 65} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'metricsGraphics', ->\n {\n restrict: 'EAC'\n scope:\n data: '='\n options: '='\n\n link: (scope, element) ->\n\n $element = $(element)\n chartWidth = $element.width()\n\n # Generate random element ID\n if _.isEmpty $element.prop('id')\n scope.id = 'mg-' + uuid.v4()\n $element.prop 'id', scope.id\n\n redraw = ->\n return unless scope.data?\n\n options =\n title: null\n height: 200\n width: chartWidth\n target: '#' + scope.id\n data: scope.data\n interpolate: 'cardinal'\n interpolate_tension: 0.95\n\n # Apply passed options\n _.assign options, scope.options\n\n # Wrap mouseover\n if options.mouseover?", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "aa249eacd2cdb7409ce6c4581e1cedf99c9471b7", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/aa249eacd2cdb7409ce6c4581e1cedf99c9471b7/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'metricsGraphics', ->\n {\n restrict: 'EAC'\n scope:\n data: '='\n options: '='\n\n link: (scope, element) ->", "response": "$element = $(element)\n chartWidth = $element.width()\n\n # Generate random element ID\n if _.isEmpty $element.prop('id')\n scope.id = 'mg-' + uuid.v4()\n $element.prop 'id', scope.id\n\n redraw = ->\n return unless scope.data?\n\n options =\n title: null\n height: 200\n width: chartWidth\n target: '#' + scope.id\n data: scope.data\n interpolate: 'cardinal'\n interpolate_tension: 0.95\n\n # Apply passed options\n _.assign options, scope.options\n\n # Wrap mouseover\n if options.mouseover?", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "aa249eacd2cdb7409ce6c4581e1cedf99c9471b7", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/aa249eacd2cdb7409ce6c4581e1cedf99c9471b7/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'metricsGraphics', ->\n {\n restrict: 'EAC'\n scope:\n data: '='\n options: '='\n\n link: (scope, element) ->\n\n $element = $(element)\n scope.width = $element.width()\n\n # Generate random element ID\n if _.isEmpty $element.prop('id')\n scope.id = 'mg-' + uuid.v4()\n $element.prop 'id', scope.id\n\n redraw = ->\n return unless scope.data?\n\n options =\n title: null\n height: 200\n width: scope.width\n target: '#' + scope.id\n data: scope.data\n interpolate: 'cardinal'\n interpolate_tension: 0.95\n\n # Apply passed options\n _.assign options, scope.options\n\n # Wrap mouseover\n if options.mouseover?", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'metricsGraphics', ->\n {\n restrict: 'EAC'\n scope:\n data: '='\n options: '='\n\n link: (scope, element) ->", "response": "$element = $(element)\n scope.width = $element.width()\n\n # Generate random element ID\n if _.isEmpty $element.prop('id')\n scope.id = 'mg-' + uuid.v4()\n $element.prop 'id', scope.id\n\n redraw = ->\n return unless scope.data?\n\n options =\n title: null\n height: 200\n width: scope.width\n target: '#' + scope.id\n data: scope.data\n interpolate: 'cardinal'\n interpolate_tension: 0.95\n\n # Apply passed options\n _.assign options, scope.options\n\n # Wrap mouseover\n if options.mouseover?", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "getMouseoverText = options.mouseover\n options.mouseover = (d, i) ->\n text = getMouseoverText(d, i)\n d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)\n\n MG.data_graphic options\n\n scope.$watch 'data', (newData) ->\n redraw()\n\n $element.resize _.debounce ->\n scope.$apply ->\n scope.width = $element.width()\n redraw()\n , 90, { leading: false, maxWait: 200 }\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 51, "line_end": 66} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:2:completion", "type": "completion", "prompt": "getMouseoverText = options.mouseover\n options.mouseover = (d, i) ->\n text = getMouseoverText(d, i)\n d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)\n\n MG.data_graphic options\n\n scope.$watch 'data', (newData) ->", "response": "redraw()\n\n $element.resize _.debounce ->\n scope.$apply ->\n scope.width = $element.width()\n redraw()\n , 90, { leading: false, maxWait: 200 }\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 51, "line_end": 66} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "getMouseoverText = options.mouseover\n options.mouseover = (d, i) ->\n text = getMouseoverText(d, i)\n d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)\n\n MG.data_graphic options\n\n scope.$watch 'data', (newData) ->\n redraw()\n\n $element.resize(_.throttle(->\n scope.$apply ->\n scope.width = $element.width()\n redraw()\n , 65))\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 51, "line_end": 66} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee:2:completion", "type": "completion", "prompt": "getMouseoverText = options.mouseover\n options.mouseover = (d, i) ->\n text = getMouseoverText(d, i)\n d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)\n\n MG.data_graphic options\n\n scope.$watch 'data', (newData) ->", "response": "redraw()\n\n $element.resize(_.throttle(->\n scope.$apply ->\n scope.width = $element.width()\n redraw()\n , 65))\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.metricsGraphics.coffee", "line_start": 51, "line_end": 66} +{"id": "jianliaoim/talk-os:talk-web/client/updater/search-message.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.after = (store, messagesList) ->\n store.update 'searchMessages', (messages) ->\n messages.concat messagesList\n\nexports.before = (store, messagesList) ->\n store.update 'searchMessages', (messages) ->\n messagesList.concat messages\n\nexports.search = (store, messagesList) ->\n store.set 'searchMessages', messagesList", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/search-message.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/search-message.coffee", "line_start": 1, "line_end": 10} +{"id": "jianliaoim/talk-os:talk-web/client/updater/search-message.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.after = (store, messagesList) ->\n store.update 'searchMessages', (messages) ->\n messages.concat messagesList\n\nexports.before = (store, messagesList) ->\n store.update 'searchMessages', (messages) ->\n messagesList.concat messages\n\nexports.search = (store, messagesList) ->\n store.set 'searchMessages', messagesList\n```", "response": "exports.after = function(store, messagesList) {\n return store.update('searchMessages', function(messages) {\n return messages.concat(messagesList);\n });\n};\n\nexports.before = function(store, messagesList) {\n return store.update('searchMessages', function(messages) {\n return messagesList.concat(messages);\n });\n};\n\nexports.search = function(store, messagesList) {\n return store.set('searchMessages', messagesList);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/search-message.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/search-message.coffee", "line_start": 1, "line_end": 10} +{"id": "jianliaoim/talk-os:talk-web/client/updater/search-message.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.after = function(store, messagesList) {\n return store.update('searchMessages', function(messages) {\n return messages.concat(messagesList);\n });\n};\n\nexports.before = function(store, messagesList) {\n return store.update('searchMessages', function(messages) {\n return messagesList.concat(messages);\n });\n};\n\nexports.search = function(store, messagesList) {\n return store.set('searchMessages', messagesList);\n};\n```", "response": "exports.after = (store, messagesList) ->\n store.update 'searchMessages', (messages) ->\n messages.concat messagesList\n\nexports.before = (store, messagesList) ->\n store.update 'searchMessages', (messages) ->\n messagesList.concat messages\n\nexports.search = (store, messagesList) ->\n store.set 'searchMessages', messagesList", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/search-message.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/search-message.coffee", "line_start": 1, "line_end": 10} +{"id": "jianliaoim/talk-os:talk-web/client/updater/search-message.coffee:1:completion", "type": "completion", "prompt": "exports.after = (store, messagesList) ->\n store.update 'searchMessages', (messages) ->\n messages.concat messagesList\n\nexports.before = (store, messagesList) ->", "response": "store.update 'searchMessages', (messages) ->\n messagesList.concat messages\n\nexports.search = (store, messagesList) ->\n store.set 'searchMessages', messagesList", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/search-message.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/search-message.coffee", "line_start": 1, "line_end": 10} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n current++\n done(err) if numOfTests == current", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "89804738ab895209b737fdc8a336e502b36aea6b", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/89804738ab895209b737fdc8a336e502b36aea6b/tasks/pagespeed.coffee", "line_start": 1, "line_end": 28} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n current++\n done(err) if numOfTests == current\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi.output(options.url, options).then(function(response) {\n current++;\n if (numOfTests === current) {\n return done();\n }\n }).catch(function(err) {\n current++;\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "89804738ab895209b737fdc8a336e502b36aea6b", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/89804738ab895209b737fdc8a336e502b36aea6b/tasks/pagespeed.coffee", "line_start": 1, "line_end": 28} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi.output(options.url, options).then(function(response) {\n current++;\n if (numOfTests === current) {\n return done();\n }\n }).catch(function(err) {\n current++;\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n current++\n done(err) if numOfTests == current", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "89804738ab895209b737fdc8a336e502b36aea6b", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/89804738ab895209b737fdc8a336e502b36aea6b/tasks/pagespeed.coffee", "line_start": 1, "line_end": 28} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')", "response": "grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n current++\n done(err) if numOfTests == current", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "89804738ab895209b737fdc8a336e502b36aea6b", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/89804738ab895209b737fdc8a336e502b36aea6b/tasks/pagespeed.coffee", "line_start": 1, "line_end": 28} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n done(err) if numOfTests == current", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "f984c431aefc0bb938b8c6e8e97a9d782d17018c", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/f984c431aefc0bb938b8c6e8e97a9d782d17018c/tasks/pagespeed.coffee", "line_start": 1, "line_end": 27} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n done(err) if numOfTests == current\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi.output(options.url, options).then(function(response) {\n current++;\n if (numOfTests === current) {\n return done();\n }\n }).catch(function(err) {\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "f984c431aefc0bb938b8c6e8e97a9d782d17018c", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/f984c431aefc0bb938b8c6e8e97a9d782d17018c/tasks/pagespeed.coffee", "line_start": 1, "line_end": 27} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi.output(options.url, options).then(function(response) {\n current++;\n if (numOfTests === current) {\n return done();\n }\n }).catch(function(err) {\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n done(err) if numOfTests == current", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "f984c431aefc0bb938b8c6e8e97a9d782d17018c", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/f984c431aefc0bb938b8c6e8e97a9d782d17018c/tasks/pagespeed.coffee", "line_start": 1, "line_end": 27} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt", "response": "psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options).then (response) ->\n current++\n done() if numOfTests == current\n .catch (err) ->\n done(err) if numOfTests == current", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "f984c431aefc0bb938b8c6e8e97a9d782d17018c", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/f984c431aefc0bb938b8c6e8e97a9d782d17018c/tasks/pagespeed.coffee", "line_start": 1, "line_end": 27} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "eb8f0df22039c83887e984ae22c93079550fd958", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/eb8f0df22039c83887e984ae22c93079550fd958/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi.output(options.url, options, function(err, response) {\n current++;\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "eb8f0df22039c83887e984ae22c93079550fd958", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/eb8f0df22039c83887e984ae22c93079550fd958/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi.output(options.url, options, function(err, response) {\n current++;\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "eb8f0df22039c83887e984ae22c93079550fd958", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/eb8f0df22039c83887e984ae22c93079550fd958/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt", "response": "psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi.output(options.url, options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "eb8f0df22039c83887e984ae22c93079550fd958", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/eb8f0df22039c83887e984ae22c93079550fd958/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi(options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "674417c12c51d08f011ed0b45287c68c2555516f", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/674417c12c51d08f011ed0b45287c68c2555516f/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi(options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi(options, function(err, response) {\n current++;\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "674417c12c51d08f011ed0b45287c68c2555516f", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/674417c12c51d08f011ed0b45287c68c2555516f/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var current, done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n current = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi(options, function(err, response) {\n current++;\n if (numOfTests === current) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi(options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "674417c12c51d08f011ed0b45287c68c2555516f", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/674417c12c51d08f011ed0b45287c68c2555516f/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt", "response": "psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n current = 0\n\n for index, options of params\n psi(options, (err, response) ->\n current++\n done(err) if numOfTests == current\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "674417c12c51d08f011ed0b45287c68c2555516f", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/674417c12c51d08f011ed0b45287c68c2555516f/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done(err) if numOfTests == index\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "beaf05085baedaeb45d6900ed4e23a88a4e4c57a", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/beaf05085baedaeb45d6900ed4e23a88a4e4c57a/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done(err) if numOfTests == index\n )\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n index = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi(options, function(err, response) {\n index++;\n if (numOfTests === index) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "beaf05085baedaeb45d6900ed4e23a88a4e4c57a", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/beaf05085baedaeb45d6900ed4e23a88a4e4c57a/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n index = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi(options, function(err, response) {\n index++;\n if (numOfTests === index) {\n return done(err);\n }\n }));\n }\n return results;\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done(err) if numOfTests == index\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "beaf05085baedaeb45d6900ed4e23a88a4e4c57a", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/beaf05085baedaeb45d6900ed4e23a88a4e4c57a/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt", "response": "psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done(err) if numOfTests == index\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "beaf05085baedaeb45d6900ed4e23a88a4e4c57a", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/beaf05085baedaeb45d6900ed4e23a88a4e4c57a/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done() if numOfTests == index\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0656f7f816984227f3fa13002d5e47ca2e92bf02", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0656f7f816984227f3fa13002d5e47ca2e92bf02/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done() if numOfTests == index\n )\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n index = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi(options, function(err, response) {\n index++;\n if (numOfTests === index) {\n return done();\n }\n }));\n }\n return results;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0656f7f816984227f3fa13002d5e47ca2e92bf02", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0656f7f816984227f3fa13002d5e47ca2e92bf02/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, psi;\n config = require('./lib/config').init(grunt);\n psi = require('psi');\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var done, index, numOfTests, options, params, results;\n done = this.async();\n params = config.params(this.options(this.data));\n numOfTests = params.length;\n index = 0;\n results = [];\n for (index in params) {\n options = params[index];\n results.push(psi(options, function(err, response) {\n index++;\n if (numOfTests === index) {\n return done();\n }\n }));\n }\n return results;\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done() if numOfTests == index\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0656f7f816984227f3fa13002d5e47ca2e92bf02", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0656f7f816984227f3fa13002d5e47ca2e92bf02/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt", "response": "psi = require('psi')\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n done = this.async()\n params = config.params this.options(this.data)\n numOfTests = params.length\n index = 0\n\n for index, options of params\n psi(options, (err, response) ->\n index++\n done() if numOfTests == index\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0656f7f816984227f3fa13002d5e47ca2e92bf02", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0656f7f816984227f3fa13002d5e47ca2e92bf02/tasks/pagespeed.coffee", "line_start": 1, "line_end": 26} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n done = this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n pagespeed.run(params, output.process, done)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "8717917f807bdee6719ddc55c69a0e580b9cb6d6", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/8717917f807bdee6719ddc55c69a0e580b9cb6d6/tasks/pagespeed.coffee", "line_start": 1, "line_end": 24} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n done = this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n pagespeed.run(params, output.process, done)\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var done, params;\n grunt.verbose.writeln('Running Pagespeed Insights');\n done = this.async();\n params = config.params(this.options(this.data));\n if (config.threshold()) {\n output.threshold(config.threshold());\n }\n return pagespeed.run(params, output.process, done);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "8717917f807bdee6719ddc55c69a0e580b9cb6d6", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/8717917f807bdee6719ddc55c69a0e580b9cb6d6/tasks/pagespeed.coffee", "line_start": 1, "line_end": 24} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var done, params;\n grunt.verbose.writeln('Running Pagespeed Insights');\n done = this.async();\n params = config.params(this.options(this.data));\n if (config.threshold()) {\n output.threshold(config.threshold());\n }\n return pagespeed.run(params, output.process, done);\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n done = this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n pagespeed.run(params, output.process, done)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "8717917f807bdee6719ddc55c69a0e580b9cb6d6", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/8717917f807bdee6719ddc55c69a0e580b9cb6d6/tasks/pagespeed.coffee", "line_start": 1, "line_end": 24} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->", "response": "config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n done = this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n pagespeed.run(params, output.process, done)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "8717917f807bdee6719ddc55c69a0e580b9cb6d6", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/8717917f807bdee6719ddc55c69a0e580b9cb6d6/tasks/pagespeed.coffee", "line_start": 1, "line_end": 24} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n\n pagespeed.run(params, output.process)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0fd25dcc4148f4e235fdaca820faf0e6a185faa8", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0fd25dcc4148f4e235fdaca820faf0e6a185faa8/tasks/pagespeed.coffee", "line_start": 1, "line_end": 25} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n\n pagespeed.run(params, output.process)\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var params;\n grunt.verbose.writeln('Running Pagespeed Insights');\n this.async();\n params = config.params(this.options(this.data));\n if (config.threshold()) {\n output.threshold(config.threshold());\n }\n return pagespeed.run(params, output.process);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0fd25dcc4148f4e235fdaca820faf0e6a185faa8", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0fd25dcc4148f4e235fdaca820faf0e6a185faa8/tasks/pagespeed.coffee", "line_start": 1, "line_end": 25} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var params;\n grunt.verbose.writeln('Running Pagespeed Insights');\n this.async();\n params = config.params(this.options(this.data));\n if (config.threshold()) {\n output.threshold(config.threshold());\n }\n return pagespeed.run(params, output.process);\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n\n pagespeed.run(params, output.process)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0fd25dcc4148f4e235fdaca820faf0e6a185faa8", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0fd25dcc4148f4e235fdaca820faf0e6a185faa8/tasks/pagespeed.coffee", "line_start": 1, "line_end": 25} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->", "response": "config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n output.threshold(config.threshold()) if config.threshold()\n\n pagespeed.run(params, output.process)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "0fd25dcc4148f4e235fdaca820faf0e6a185faa8", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/0fd25dcc4148f4e235fdaca820faf0e6a185faa8/tasks/pagespeed.coffee", "line_start": 1, "line_end": 25} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n pagespeed.run(params, output.process)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "5664361dc05def5a0710604858244e4a8ab62d70", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/5664361dc05def5a0710604858244e4a8ab62d70/tasks/pagespeed.coffee", "line_start": 1, "line_end": 23} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n pagespeed.run(params, output.process)\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var params;\n grunt.verbose.writeln('Running Pagespeed Insights');\n this.async();\n params = config.params(this.options(this.data));\n return pagespeed.run(params, output.process);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "5664361dc05def5a0710604858244e4a8ab62d70", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/5664361dc05def5a0710604858244e4a8ab62d70/tasks/pagespeed.coffee", "line_start": 1, "line_end": 23} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n var params;\n grunt.verbose.writeln('Running Pagespeed Insights');\n this.async();\n params = config.params(this.options(this.data));\n return pagespeed.run(params, output.process);\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n pagespeed.run(params, output.process)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "5664361dc05def5a0710604858244e4a8ab62d70", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/5664361dc05def5a0710604858244e4a8ab62d70/tasks/pagespeed.coffee", "line_start": 1, "line_end": 23} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->", "response": "config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n params = config.params this.options(this.data)\n pagespeed.run(params, output.process)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "5664361dc05def5a0710604858244e4a8ab62d70", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/5664361dc05def5a0710604858244e4a8ab62d70/tasks/pagespeed.coffee", "line_start": 1, "line_end": 23} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n pagespeed.run(config.params(this.options(this.data)), output.process)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "47d3fa0347b3babdbc341bac60370578add8d204", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/47d3fa0347b3babdbc341bac60370578add8d204/tasks/pagespeed.coffee", "line_start": 1, "line_end": 22} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n pagespeed.run(config.params(this.options(this.data)), output.process)\n```", "response": "// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n grunt.verbose.writeln('Running Pagespeed Insights');\n this.async();\n return pagespeed.run(config.params(this.options(this.data)), output.process);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "47d3fa0347b3babdbc341bac60370578add8d204", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/47d3fa0347b3babdbc341bac60370578add8d204/tasks/pagespeed.coffee", "line_start": 1, "line_end": 22} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// grunt-pagespeed\n// http://www.jamescryer.com/grunt-pagespeed\n\n// Copyright (c) 2013 James Cryer\n// http://www.jamescryer.com\n// Licensed under the MIT license.\n\n'use strict';\nmodule.exports = function(grunt) {\n var config, output, pagespeed;\n config = require('./lib/config').init(grunt);\n pagespeed = require('./lib/pagespeed').init(grunt);\n output = require('./lib/output').init(grunt);\n return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {\n grunt.verbose.writeln('Running Pagespeed Insights');\n this.async();\n return pagespeed.run(config.params(this.options(this.data)), output.process);\n });\n};\n```", "response": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->\n\n config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n pagespeed.run(config.params(this.options(this.data)), output.process)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "47d3fa0347b3babdbc341bac60370578add8d204", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/47d3fa0347b3babdbc341bac60370578add8d204/tasks/pagespeed.coffee", "line_start": 1, "line_end": 22} +{"id": "jrcryer/grunt-pagespeed:tasks/pagespeed.coffee:1:completion", "type": "completion", "prompt": "#\n# grunt-pagespeed\n# http://www.jamescryer.com/grunt-pagespeed\n#\n# Copyright (c) 2013 James Cryer\n# http://www.jamescryer.com\n# Licensed under the MIT license.\n#\n'use strict'\n\nmodule.exports = (grunt) ->", "response": "config = require('./lib/config').init grunt\n pagespeed = require('./lib/pagespeed').init grunt\n output = require('./lib/output').init grunt\n\n grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->\n\n grunt.verbose.writeln 'Running Pagespeed Insights'\n this.async()\n\n pagespeed.run(config.params(this.options(this.data)), output.process)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jrcryer/grunt-pagespeed", "path": "tasks/pagespeed.coffee", "license": "MIT", "commit": "47d3fa0347b3babdbc341bac60370578add8d204", "stars": 459, "source_url": "https://github.com/jrcryer/grunt-pagespeed/blob/47d3fa0347b3babdbc341bac60370578add8d204/tasks/pagespeed.coffee", "line_start": 1, "line_end": 22} +{"id": "jianliaoim/talk-os:talk-web/client/util/notify.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if window.nwDispatcher?.requireNwGui\n nwGui = window.nwDispatcher.requireNwGui()\n nwWin = nwGui.Window.get()\n\n\nformat = require './format'\ntime = require './time'\ntypeUtil = require './type'\n\nif typeof window isnt 'undefined'\n Favico = require 'favico.js'\n favicon = new Favico\n animation: 'none'\n\nexports.desktop = (data, cb) ->\n data.body = data.body.replace /[\\n\\r]+/g, ' '\n if window.MacGap?\n window.MacGap.notify\n title: data.title\n content: data.body or ''\n else if window.macgap?\n window.macgap.growl.notify\n title: data.title\n content: data.body or ''\n else if window.Notification?\n message = new window.Notification data.title, data\n message.onclick = -> cb?()\n time.delay 3000, ->\n message.close()\n\nexports.favicon = (number) ->\n return if typeof window is 'undefined'\n number = Number(number) unless typeUtil.isNumber(number)\n number = format.escape100 number\n if number is @oldNumber\n return\n @oldNumber = number\n\n if window.MacGap?\n window.MacGap.Dock.addBadge number\n else if window.macgap?\n window.macgap.dock.badge = number\n else if nwWin\n nwWin.setBadgeLabel number\n else if window.badge? # private API targeting Electron\n window.badge number\n else\n favicon.badge number", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/notify.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/notify.coffee", "line_start": 1, "line_end": 48} +{"id": "jianliaoim/talk-os:talk-web/client/util/notify.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif window.nwDispatcher?.requireNwGui\n nwGui = window.nwDispatcher.requireNwGui()\n nwWin = nwGui.Window.get()\n\n\nformat = require './format'\ntime = require './time'\ntypeUtil = require './type'\n\nif typeof window isnt 'undefined'\n Favico = require 'favico.js'\n favicon = new Favico\n animation: 'none'\n\nexports.desktop = (data, cb) ->\n data.body = data.body.replace /[\\n\\r]+/g, ' '\n if window.MacGap?\n window.MacGap.notify\n title: data.title\n content: data.body or ''\n else if window.macgap?\n window.macgap.growl.notify\n title: data.title\n content: data.body or ''\n else if window.Notification?\n message = new window.Notification data.title, data\n message.onclick = -> cb?()\n time.delay 3000, ->\n message.close()\n\nexports.favicon = (number) ->\n return if typeof window is 'undefined'\n number = Number(number) unless typeUtil.isNumber(number)\n number = format.escape100 number\n if number is @oldNumber\n return\n @oldNumber = number\n\n if window.MacGap?\n window.MacGap.Dock.addBadge number\n else if window.macgap?\n window.macgap.dock.badge = number\n else if nwWin\n nwWin.setBadgeLabel number\n else if window.badge? # private API targeting Electron\n window.badge number\n else\n favicon.badge number\n```", "response": "var Favico, favicon, format, nwGui, nwWin, ref, time, typeUtil;\n\nif ((ref = window.nwDispatcher) != null ? ref.requireNwGui : void 0) {\n nwGui = window.nwDispatcher.requireNwGui();\n nwWin = nwGui.Window.get();\n}\n\nformat = require('./format');\n\ntime = require('./time');\n\ntypeUtil = require('./type');\n\nif (typeof window !== 'undefined') {\n Favico = require('favico.js');\n favicon = new Favico({\n animation: 'none'\n });\n}\n\nexports.desktop = function(data, cb) {\n var message;\n data.body = data.body.replace(/[\\n\\r]+/g, ' ');\n if (window.MacGap != null) {\n return window.MacGap.notify({\n title: data.title,\n content: data.body || ''\n });\n } else if (window.macgap != null) {\n return window.macgap.growl.notify({\n title: data.title,\n content: data.body || ''\n });\n } else if (window.Notification != null) {\n message = new window.Notification(data.title, data);\n message.onclick = function() {\n return typeof cb === \"function\" ? cb() : void 0;\n };\n return time.delay(3000, function() {\n return message.close();\n });\n }\n};\n\nexports.favicon = function(number) {\n if (typeof window === 'undefined') {\n return;\n }\n if (!typeUtil.isNumber(number)) {\n number = Number(number);\n }\n number = format.escape100(number);\n if (number === this.oldNumber) {\n return;\n }\n this.oldNumber = number;\n if (window.MacGap != null) {\n return window.MacGap.Dock.addBadge(number);\n } else if (window.macgap != null) {\n return window.macgap.dock.badge = number;\n } else if (nwWin) {\n return nwWin.setBadgeLabel(number);\n } else if (window.badge != null) {\n return window.badge(number);\n } else {\n return favicon.badge(number); // private API targeting Electron\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/notify.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/notify.coffee", "line_start": 1, "line_end": 48} +{"id": "jianliaoim/talk-os:talk-web/client/util/notify.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Favico, favicon, format, nwGui, nwWin, ref, time, typeUtil;\n\nif ((ref = window.nwDispatcher) != null ? ref.requireNwGui : void 0) {\n nwGui = window.nwDispatcher.requireNwGui();\n nwWin = nwGui.Window.get();\n}\n\nformat = require('./format');\n\ntime = require('./time');\n\ntypeUtil = require('./type');\n\nif (typeof window !== 'undefined') {\n Favico = require('favico.js');\n favicon = new Favico({\n animation: 'none'\n });\n}\n\nexports.desktop = function(data, cb) {\n var message;\n data.body = data.body.replace(/[\\n\\r]+/g, ' ');\n if (window.MacGap != null) {\n return window.MacGap.notify({\n title: data.title,\n content: data.body || ''\n });\n } else if (window.macgap != null) {\n return window.macgap.growl.notify({\n title: data.title,\n content: data.body || ''\n });\n } else if (window.Notification != null) {\n message = new window.Notification(data.title, data);\n message.onclick = function() {\n return typeof cb === \"function\" ? cb() : void 0;\n };\n return time.delay(3000, function() {\n return message.close();\n });\n }\n};\n\nexports.favicon = function(number) {\n if (typeof window === 'undefined') {\n return;\n }\n if (!typeUtil.isNumber(number)) {\n number = Number(number);\n }\n number = format.escape100(number);\n if (number === this.oldNumber) {\n return;\n }\n this.oldNumber = number;\n if (window.MacGap != null) {\n return window.MacGap.Dock.addBadge(number);\n } else if (window.macgap != null) {\n return window.macgap.dock.badge = number;\n } else if (nwWin) {\n return nwWin.setBadgeLabel(number);\n } else if (window.badge != null) {\n return window.badge(number);\n } else {\n return favicon.badge(number); // private API targeting Electron\n }\n};\n```", "response": "if window.nwDispatcher?.requireNwGui\n nwGui = window.nwDispatcher.requireNwGui()\n nwWin = nwGui.Window.get()\n\n\nformat = require './format'\ntime = require './time'\ntypeUtil = require './type'\n\nif typeof window isnt 'undefined'\n Favico = require 'favico.js'\n favicon = new Favico\n animation: 'none'\n\nexports.desktop = (data, cb) ->\n data.body = data.body.replace /[\\n\\r]+/g, ' '\n if window.MacGap?\n window.MacGap.notify\n title: data.title\n content: data.body or ''\n else if window.macgap?\n window.macgap.growl.notify\n title: data.title\n content: data.body or ''\n else if window.Notification?\n message = new window.Notification data.title, data\n message.onclick = -> cb?()\n time.delay 3000, ->\n message.close()\n\nexports.favicon = (number) ->\n return if typeof window is 'undefined'\n number = Number(number) unless typeUtil.isNumber(number)\n number = format.escape100 number\n if number is @oldNumber\n return\n @oldNumber = number\n\n if window.MacGap?\n window.MacGap.Dock.addBadge number\n else if window.macgap?\n window.macgap.dock.badge = number\n else if nwWin\n nwWin.setBadgeLabel number\n else if window.badge? # private API targeting Electron\n window.badge number\n else\n favicon.badge number", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/notify.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/notify.coffee", "line_start": 1, "line_end": 48} +{"id": "jianliaoim/talk-os:talk-web/client/util/notify.coffee:1:completion", "type": "completion", "prompt": "if window.nwDispatcher?.requireNwGui\n nwGui = window.nwDispatcher.requireNwGui()\n nwWin = nwGui.Window.get()\n\n\nformat = require './format'\ntime = require './time'\ntypeUtil = require './type'\n\nif typeof window isnt 'undefined'\n Favico = require 'favico.js'\n favicon = new Favico\n animation: 'none'\n\nexports.desktop = (data, cb) ->\n data.body = data.body.replace /[\\n\\r]+/g, ' '\n if window.MacGap?\n window.MacGap.notify\n title: data.title\n content: data.body or ''\n else if window.macgap?\n window.macgap.growl.notify\n title: data.title\n content: data.body or ''", "response": "else if window.Notification?\n message = new window.Notification data.title, data\n message.onclick = -> cb?()\n time.delay 3000, ->\n message.close()\n\nexports.favicon = (number) ->\n return if typeof window is 'undefined'\n number = Number(number) unless typeUtil.isNumber(number)\n number = format.escape100 number\n if number is @oldNumber\n return\n @oldNumber = number\n\n if window.MacGap?\n window.MacGap.Dock.addBadge number\n else if window.macgap?\n window.macgap.dock.badge = number\n else if nwWin\n nwWin.setBadgeLabel number\n else if window.badge? # private API targeting Electron\n window.badge number\n else\n favicon.badge number", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/util/notify.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/notify.coffee", "line_start": 1, "line_end": 48} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->\n\t\t$scope.error = ''\n\t\t$scope.name = ''\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = (name) ->\n\t\t\tservice.post name\n\t\t\t, (Resource, getResponseHeaders) ->\n\t\t\t\t$scope.error = ''\n\t\t\t\t$scope.name = ''\n\t\t\t, (obj) ->\n\t\t\t\t($scope.error = obj.data) if obj.status is 403\n\n\t\tservice.get()\n\t]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "a0fe3a453e28b488b6b711d2110bb1eeb574c8eb", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/controllers/people.coffee", "line_start": 1, "line_end": 20} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->\n\t\t$scope.error = ''\n\t\t$scope.name = ''\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = (name) ->\n\t\t\tservice.post name\n\t\t\t, (Resource, getResponseHeaders) ->\n\t\t\t\t$scope.error = ''\n\t\t\t\t$scope.name = ''\n\t\t\t, (obj) ->\n\t\t\t\t($scope.error = obj.data) if obj.status is 403\n\n\t\tservice.get()\n\t]\n```", "response": "/*global define*/\ndefine(['controllers/controllers', 'services/people'], function(controllers) {\n 'use strict';\n return controllers.controller('people', [\n '$scope',\n 'people',\n function($scope,\n service) {\n $scope.error = '';\n $scope.name = '';\n $scope.people = service.people;\n $scope.insertPerson = function(name) {\n return service.post(name,\n function(Resource,\n getResponseHeaders) {\n $scope.error = '';\n return $scope.name = '';\n },\n function(obj) {\n if (obj.status === 403) {\n return $scope.error = obj.data;\n }\n });\n };\n return service.get();\n }\n ]);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "a0fe3a453e28b488b6b711d2110bb1eeb574c8eb", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/controllers/people.coffee", "line_start": 1, "line_end": 20} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*global define*/\ndefine(['controllers/controllers', 'services/people'], function(controllers) {\n 'use strict';\n return controllers.controller('people', [\n '$scope',\n 'people',\n function($scope,\n service) {\n $scope.error = '';\n $scope.name = '';\n $scope.people = service.people;\n $scope.insertPerson = function(name) {\n return service.post(name,\n function(Resource,\n getResponseHeaders) {\n $scope.error = '';\n return $scope.name = '';\n },\n function(obj) {\n if (obj.status === 403) {\n return $scope.error = obj.data;\n }\n });\n };\n return service.get();\n }\n ]);\n});\n```", "response": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->\n\t\t$scope.error = ''\n\t\t$scope.name = ''\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = (name) ->\n\t\t\tservice.post name\n\t\t\t, (Resource, getResponseHeaders) ->\n\t\t\t\t$scope.error = ''\n\t\t\t\t$scope.name = ''\n\t\t\t, (obj) ->\n\t\t\t\t($scope.error = obj.data) if obj.status is 403\n\n\t\tservice.get()\n\t]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "a0fe3a453e28b488b6b711d2110bb1eeb574c8eb", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/controllers/people.coffee", "line_start": 1, "line_end": 20} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:completion", "type": "completion", "prompt": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->\n\t\t$scope.error = ''\n\t\t$scope.name = ''\n\t\t$scope.people = service.people", "response": "$scope.insertPerson = (name) ->\n\t\t\tservice.post name\n\t\t\t, (Resource, getResponseHeaders) ->\n\t\t\t\t$scope.error = ''\n\t\t\t\t$scope.name = ''\n\t\t\t, (obj) ->\n\t\t\t\t($scope.error = obj.data) if obj.status is 403\n\n\t\tservice.get()\n\t]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "a0fe3a453e28b488b6b711d2110bb1eeb574c8eb", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/controllers/people.coffee", "line_start": 1, "line_end": 20} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = ->\n\t\t\tservice.post()\n\n\t\tservice.get()\n\t]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "83e68a53d7c24f7d417b494e4fef7451cf0e3d9b", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/83e68a53d7c24f7d417b494e4fef7451cf0e3d9b/scripts/controllers/people.coffee", "line_start": 1, "line_end": 13} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = ->\n\t\t\tservice.post()\n\n\t\tservice.get()\n\t]\n```", "response": "/*global define*/\ndefine(['controllers/controllers', 'services/people'], function(controllers) {\n 'use strict';\n return controllers.controller('people', [\n '$scope',\n 'people',\n function($scope,\n service) {\n $scope.people = service.people;\n $scope.insertPerson = function() {\n return service.post();\n };\n return service.get();\n }\n ]);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "83e68a53d7c24f7d417b494e4fef7451cf0e3d9b", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/83e68a53d7c24f7d417b494e4fef7451cf0e3d9b/scripts/controllers/people.coffee", "line_start": 1, "line_end": 13} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*global define*/\ndefine(['controllers/controllers', 'services/people'], function(controllers) {\n 'use strict';\n return controllers.controller('people', [\n '$scope',\n 'people',\n function($scope,\n service) {\n $scope.people = service.people;\n $scope.insertPerson = function() {\n return service.post();\n };\n return service.get();\n }\n ]);\n});\n```", "response": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = ->\n\t\t\tservice.post()\n\n\t\tservice.get()\n\t]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "83e68a53d7c24f7d417b494e4fef7451cf0e3d9b", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/83e68a53d7c24f7d417b494e4fef7451cf0e3d9b/scripts/controllers/people.coffee", "line_start": 1, "line_end": 13} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:completion", "type": "completion", "prompt": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', ($scope, service) ->", "response": "$scope.people = service.people\n\n\t\t$scope.insertPerson = ->\n\t\t\tservice.post()\n\n\t\tservice.get()\n\t]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "83e68a53d7c24f7d417b494e4fef7451cf0e3d9b", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/83e68a53d7c24f7d417b494e4fef7451cf0e3d9b/scripts/controllers/people.coffee", "line_start": 1, "line_end": 13} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', '$log', ($scope, service, $log) ->\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = ->\n\t\t\tservice.post()\n\n\t\tservice.get (Resource, getResponseHeaders) ->\n\t\t\treturn\n\t\t\t#$log.info 'people.get success', Resource, getResponseHeaders()\n\t\t, (obj) ->\n\t\t\treturn\n\t\t\t#$log.error 'people.get error', obj.config, obj.headers(), obj.status, obj.data\n\t]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "0ae299ec8a05ddbfb2e26f04898245b95f7ab37c", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/controllers/people.coffee", "line_start": 1, "line_end": 18} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', '$log', ($scope, service, $log) ->\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = ->\n\t\t\tservice.post()\n\n\t\tservice.get (Resource, getResponseHeaders) ->\n\t\t\treturn\n\t\t\t#$log.info 'people.get success', Resource, getResponseHeaders()\n\t\t, (obj) ->\n\t\t\treturn\n\t\t\t#$log.error 'people.get error', obj.config, obj.headers(), obj.status, obj.data\n\t]\n```", "response": "/*global define*/\ndefine(['controllers/controllers', 'services/people'], function(controllers) {\n 'use strict';\n return controllers.controller('people', [\n '$scope',\n 'people',\n '$log',\n function($scope,\n service,\n $log) {\n $scope.people = service.people;\n $scope.insertPerson = function() {\n return service.post();\n };\n return service.get(function(Resource,\n getResponseHeaders) {},\n //$log.info 'people.get success', Resource, getResponseHeaders()\n function(obj) {});\n }\n ]);\n});\n\n//$log.error 'people.get error', obj.config, obj.headers(), obj.status, obj.data", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "0ae299ec8a05ddbfb2e26f04898245b95f7ab37c", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/controllers/people.coffee", "line_start": 1, "line_end": 18} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*global define*/\ndefine(['controllers/controllers', 'services/people'], function(controllers) {\n 'use strict';\n return controllers.controller('people', [\n '$scope',\n 'people',\n '$log',\n function($scope,\n service,\n $log) {\n $scope.people = service.people;\n $scope.insertPerson = function() {\n return service.post();\n };\n return service.get(function(Resource,\n getResponseHeaders) {},\n //$log.info 'people.get success', Resource, getResponseHeaders()\n function(obj) {});\n }\n ]);\n});\n\n//$log.error 'people.get error', obj.config, obj.headers(), obj.status, obj.data\n```", "response": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', '$log', ($scope, service, $log) ->\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = ->\n\t\t\tservice.post()\n\n\t\tservice.get (Resource, getResponseHeaders) ->\n\t\t\treturn\n\t\t\t#$log.info 'people.get success', Resource, getResponseHeaders()\n\t\t, (obj) ->\n\t\t\treturn\n\t\t\t#$log.error 'people.get error', obj.config, obj.headers(), obj.status, obj.data\n\t]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "0ae299ec8a05ddbfb2e26f04898245b95f7ab37c", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/controllers/people.coffee", "line_start": 1, "line_end": 18} +{"id": "CaryLandholt/AngularFun:scripts/controllers/people.coffee:1:completion", "type": "completion", "prompt": "###global define###\n\ndefine ['controllers/controllers', 'services/people'], (controllers) ->\n\t'use strict'\n\n\tcontrollers.controller 'people', ['$scope', 'people', '$log', ($scope, service, $log) ->\n\t\t$scope.people = service.people\n\n\t\t$scope.insertPerson = ->", "response": "service.post()\n\n\t\tservice.get (Resource, getResponseHeaders) ->\n\t\t\treturn\n\t\t\t#$log.info 'people.get success', Resource, getResponseHeaders()\n\t\t, (obj) ->\n\t\t\treturn\n\t\t\t#$log.error 'people.get error', obj.config, obj.headers(), obj.status, obj.data\n\t]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/controllers/people.coffee", "license": "MIT", "commit": "0ae299ec8a05ddbfb2e26f04898245b95f7ab37c", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/controllers/people.coffee", "line_start": 1, "line_end": 18} +{"id": "Pagedraw/pagedraw:html-importer/chrome-plugin/popup.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "getCurrentTabUrl = (callback) ->\n # Query filter to be passed to chrome.tabs.query - see\n # https://developer.chrome.com/extensions/tabs#method-query\n chrome.tabs.query {active: true, currentWindow: true}, (tabs) ->\n url = tabs[0].url\n console.assert(typeof url == 'string', 'tab.url should be a string')\n callback(url)\n\ndocument.addEventListener 'DOMContentLoaded', ->\n # make page DEFAULT_PAGE_WIDTH wide\n chrome.windows.update(chrome.windows.WINDOW_ID_CURRENT, {width: 970})\n\n # load scripts into page\n chrome.tabs.executeScript null, { file: \"vendor/jquery-2.1.4.js\" }, ->\n chrome.tabs.executeScript null, { file: \"vendor/underscore-min.js\" }, ->\n chrome.tabs.executeScript null, { file: \"reader.js\" }\n\n\n$('.output').text(\"loading...\")\n\nchrome.extension.onMessage.addListener (request, sender, response) ->\n $('#url').val(request.url)\n $('.output').text(JSON.stringify(request, null, 2))\n $.ajax {\n method: \"POST\",\n url: \"http://localhost:9000/pages\",\n data: JSON.stringify(request),\n contentType: \"application/json\"\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "html-importer/chrome-plugin/popup.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/popup.coffee", "line_start": 1, "line_end": 29} +{"id": "Pagedraw/pagedraw:html-importer/chrome-plugin/popup.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ngetCurrentTabUrl = (callback) ->\n # Query filter to be passed to chrome.tabs.query - see\n # https://developer.chrome.com/extensions/tabs#method-query\n chrome.tabs.query {active: true, currentWindow: true}, (tabs) ->\n url = tabs[0].url\n console.assert(typeof url == 'string', 'tab.url should be a string')\n callback(url)\n\ndocument.addEventListener 'DOMContentLoaded', ->\n # make page DEFAULT_PAGE_WIDTH wide\n chrome.windows.update(chrome.windows.WINDOW_ID_CURRENT, {width: 970})\n\n # load scripts into page\n chrome.tabs.executeScript null, { file: \"vendor/jquery-2.1.4.js\" }, ->\n chrome.tabs.executeScript null, { file: \"vendor/underscore-min.js\" }, ->\n chrome.tabs.executeScript null, { file: \"reader.js\" }\n\n\n$('.output').text(\"loading...\")\n\nchrome.extension.onMessage.addListener (request, sender, response) ->\n $('#url').val(request.url)\n $('.output').text(JSON.stringify(request, null, 2))\n $.ajax {\n method: \"POST\",\n url: \"http://localhost:9000/pages\",\n data: JSON.stringify(request),\n contentType: \"application/json\"\n }\n```", "response": "var getCurrentTabUrl;\n\ngetCurrentTabUrl = function(callback) {\n // Query filter to be passed to chrome.tabs.query - see\n // https://developer.chrome.com/extensions/tabs#method-query\n return chrome.tabs.query({\n active: true,\n currentWindow: true\n }, function(tabs) {\n var url;\n url = tabs[0].url;\n console.assert(typeof url === 'string', 'tab.url should be a string');\n return callback(url);\n });\n};\n\ndocument.addEventListener('DOMContentLoaded', function() {\n // make page DEFAULT_PAGE_WIDTH wide\n chrome.windows.update(chrome.windows.WINDOW_ID_CURRENT, {\n width: 970\n });\n // load scripts into page\n return chrome.tabs.executeScript(null, {\n file: \"vendor/jquery-2.1.4.js\"\n }, function() {\n return chrome.tabs.executeScript(null, {\n file: \"vendor/underscore-min.js\"\n }, function() {\n return chrome.tabs.executeScript(null, {\n file: \"reader.js\"\n });\n });\n });\n});\n\n$('.output').text(\"loading...\");\n\nchrome.extension.onMessage.addListener(function(request, sender, response) {\n $('#url').val(request.url);\n $('.output').text(JSON.stringify(request, null, 2));\n return $.ajax({\n method: \"POST\",\n url: \"http://localhost:9000/pages\",\n data: JSON.stringify(request),\n contentType: \"application/json\"\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "html-importer/chrome-plugin/popup.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/popup.coffee", "line_start": 1, "line_end": 29} +{"id": "Pagedraw/pagedraw:html-importer/chrome-plugin/popup.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar getCurrentTabUrl;\n\ngetCurrentTabUrl = function(callback) {\n // Query filter to be passed to chrome.tabs.query - see\n // https://developer.chrome.com/extensions/tabs#method-query\n return chrome.tabs.query({\n active: true,\n currentWindow: true\n }, function(tabs) {\n var url;\n url = tabs[0].url;\n console.assert(typeof url === 'string', 'tab.url should be a string');\n return callback(url);\n });\n};\n\ndocument.addEventListener('DOMContentLoaded', function() {\n // make page DEFAULT_PAGE_WIDTH wide\n chrome.windows.update(chrome.windows.WINDOW_ID_CURRENT, {\n width: 970\n });\n // load scripts into page\n return chrome.tabs.executeScript(null, {\n file: \"vendor/jquery-2.1.4.js\"\n }, function() {\n return chrome.tabs.executeScript(null, {\n file: \"vendor/underscore-min.js\"\n }, function() {\n return chrome.tabs.executeScript(null, {\n file: \"reader.js\"\n });\n });\n });\n});\n\n$('.output').text(\"loading...\");\n\nchrome.extension.onMessage.addListener(function(request, sender, response) {\n $('#url').val(request.url);\n $('.output').text(JSON.stringify(request, null, 2));\n return $.ajax({\n method: \"POST\",\n url: \"http://localhost:9000/pages\",\n data: JSON.stringify(request),\n contentType: \"application/json\"\n });\n});\n```", "response": "getCurrentTabUrl = (callback) ->\n # Query filter to be passed to chrome.tabs.query - see\n # https://developer.chrome.com/extensions/tabs#method-query\n chrome.tabs.query {active: true, currentWindow: true}, (tabs) ->\n url = tabs[0].url\n console.assert(typeof url == 'string', 'tab.url should be a string')\n callback(url)\n\ndocument.addEventListener 'DOMContentLoaded', ->\n # make page DEFAULT_PAGE_WIDTH wide\n chrome.windows.update(chrome.windows.WINDOW_ID_CURRENT, {width: 970})\n\n # load scripts into page\n chrome.tabs.executeScript null, { file: \"vendor/jquery-2.1.4.js\" }, ->\n chrome.tabs.executeScript null, { file: \"vendor/underscore-min.js\" }, ->\n chrome.tabs.executeScript null, { file: \"reader.js\" }\n\n\n$('.output').text(\"loading...\")\n\nchrome.extension.onMessage.addListener (request, sender, response) ->\n $('#url').val(request.url)\n $('.output').text(JSON.stringify(request, null, 2))\n $.ajax {\n method: \"POST\",\n url: \"http://localhost:9000/pages\",\n data: JSON.stringify(request),\n contentType: \"application/json\"\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "html-importer/chrome-plugin/popup.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/popup.coffee", "line_start": 1, "line_end": 29} +{"id": "Pagedraw/pagedraw:html-importer/chrome-plugin/popup.coffee:1:completion", "type": "completion", "prompt": "getCurrentTabUrl = (callback) ->\n # Query filter to be passed to chrome.tabs.query - see\n # https://developer.chrome.com/extensions/tabs#method-query\n chrome.tabs.query {active: true, currentWindow: true}, (tabs) ->\n url = tabs[0].url\n console.assert(typeof url == 'string', 'tab.url should be a string')\n callback(url)\n\ndocument.addEventListener 'DOMContentLoaded', ->\n # make page DEFAULT_PAGE_WIDTH wide\n chrome.windows.update(chrome.windows.WINDOW_ID_CURRENT, {width: 970})\n\n # load scripts into page\n chrome.tabs.executeScript null, { file: \"vendor/jquery-2.1.4.js\" }, ->", "response": "chrome.tabs.executeScript null, { file: \"vendor/underscore-min.js\" }, ->\n chrome.tabs.executeScript null, { file: \"reader.js\" }\n\n\n$('.output').text(\"loading...\")\n\nchrome.extension.onMessage.addListener (request, sender, response) ->\n $('#url').val(request.url)\n $('.output').text(JSON.stringify(request, null, 2))\n $.ajax {\n method: \"POST\",\n url: \"http://localhost:9000/pages\",\n data: JSON.stringify(request),\n contentType: \"application/json\"\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "html-importer/chrome-plugin/popup.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/popup.coffee", "line_start": 1, "line_end": 29} +{"id": "Glavin001/atom-beautify:src/beautifiers/jscs.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "\"use strict\"\nBeautifier = require('./beautifier')\n\nChecker = null\ncliConfig = null\nchecker = null\n\nmodule.exports = class JSCSFixer extends Beautifier\n name: \"JSCS Fixer\"\n link: \"https://github.com/jscs-dev/node-jscs/\"\n\n options: {\n JavaScript: false\n }\n\n beautify: (text, language, options) ->\n @verbose(\"JSCS Fixer language #{language}\")\n return new @Promise((resolve, reject) =>\n try\n if !checker?\n cliConfig = require 'jscs/lib/cli-config'\n Checker = require 'jscs'\n checker = new Checker()\n checker.registerDefaultRules()\n editor = atom.workspace.getActiveTextEditor()\n path = if editor? then editor.getPath() else undefined\n config = if path? then cliConfig.load(undefined, atom.project.relativizePath(path)[0]) else undefined\n if !config?\n throw new Error(\"No JSCS config found.\")\n checker.configure(config)\n result = checker.fixString(text, path)\n if result.errors.getErrorCount() > 0\n @error(result.errors.getErrorList().reduce((res, err) ->\n \"#{res}
Line #{err.line}: #{err.message}\"\n , \"JSCS Fixer error:\"))\n\n resolve result.output\n\n catch err\n @error(\"JSCS Fixer error: #{err}\")\n reject(err)\n\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/jscs.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/jscs.coffee", "line_start": 1, "line_end": 43} +{"id": "Glavin001/atom-beautify:src/beautifiers/jscs.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n\"use strict\"\nBeautifier = require('./beautifier')\n\nChecker = null\ncliConfig = null\nchecker = null\n\nmodule.exports = class JSCSFixer extends Beautifier\n name: \"JSCS Fixer\"\n link: \"https://github.com/jscs-dev/node-jscs/\"\n\n options: {\n JavaScript: false\n }\n\n beautify: (text, language, options) ->\n @verbose(\"JSCS Fixer language #{language}\")\n return new @Promise((resolve, reject) =>\n try\n if !checker?\n cliConfig = require 'jscs/lib/cli-config'\n Checker = require 'jscs'\n checker = new Checker()\n checker.registerDefaultRules()\n editor = atom.workspace.getActiveTextEditor()\n path = if editor? then editor.getPath() else undefined\n config = if path? then cliConfig.load(undefined, atom.project.relativizePath(path)[0]) else undefined\n if !config?\n throw new Error(\"No JSCS config found.\")\n checker.configure(config)\n result = checker.fixString(text, path)\n if result.errors.getErrorCount() > 0\n @error(result.errors.getErrorList().reduce((res, err) ->\n \"#{res}
Line #{err.line}: #{err.message}\"\n , \"JSCS Fixer error:\"))\n\n resolve result.output\n\n catch err\n @error(\"JSCS Fixer error: #{err}\")\n reject(err)\n\n )\n```", "response": "\"use strict\";\nvar Beautifier, Checker, JSCSFixer, checker, cliConfig;\n\nBeautifier = require('./beautifier');\n\nChecker = null;\n\ncliConfig = null;\n\nchecker = null;\n\nmodule.exports = JSCSFixer = (function() {\n class JSCSFixer extends Beautifier {\n beautify(text, language, options) {\n this.verbose(`JSCS Fixer language ${language}`);\n return new this.Promise((resolve, reject) => {\n var config, editor, err, path, result;\n try {\n if (checker == null) {\n cliConfig = require('jscs/lib/cli-config');\n Checker = require('jscs');\n checker = new Checker();\n checker.registerDefaultRules();\n }\n editor = atom.workspace.getActiveTextEditor();\n path = editor != null ? editor.getPath() : void 0;\n config = path != null ? cliConfig.load(void 0, atom.project.relativizePath(path)[0]) : void 0;\n if (config == null) {\n throw new Error(\"No JSCS config found.\");\n }\n checker.configure(config);\n result = checker.fixString(text, path);\n if (result.errors.getErrorCount() > 0) {\n this.error(result.errors.getErrorList().reduce(function(res, err) {\n return `${res}
Line ${err.line}: ${err.message}`;\n }, \"JSCS Fixer error:\"));\n }\n return resolve(result.output);\n } catch (error) {\n err = error;\n this.error(`JSCS Fixer error: ${err}`);\n return reject(err);\n }\n });\n }\n\n };\n\n JSCSFixer.prototype.name = \"JSCS Fixer\";\n\n JSCSFixer.prototype.link = \"https://github.com/jscs-dev/node-jscs/\";\n\n JSCSFixer.prototype.options = {\n JavaScript: false\n };\n\n return JSCSFixer;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/jscs.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/jscs.coffee", "line_start": 1, "line_end": 43} +{"id": "Glavin001/atom-beautify:src/beautifiers/jscs.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n\"use strict\";\nvar Beautifier, Checker, JSCSFixer, checker, cliConfig;\n\nBeautifier = require('./beautifier');\n\nChecker = null;\n\ncliConfig = null;\n\nchecker = null;\n\nmodule.exports = JSCSFixer = (function() {\n class JSCSFixer extends Beautifier {\n beautify(text, language, options) {\n this.verbose(`JSCS Fixer language ${language}`);\n return new this.Promise((resolve, reject) => {\n var config, editor, err, path, result;\n try {\n if (checker == null) {\n cliConfig = require('jscs/lib/cli-config');\n Checker = require('jscs');\n checker = new Checker();\n checker.registerDefaultRules();\n }\n editor = atom.workspace.getActiveTextEditor();\n path = editor != null ? editor.getPath() : void 0;\n config = path != null ? cliConfig.load(void 0, atom.project.relativizePath(path)[0]) : void 0;\n if (config == null) {\n throw new Error(\"No JSCS config found.\");\n }\n checker.configure(config);\n result = checker.fixString(text, path);\n if (result.errors.getErrorCount() > 0) {\n this.error(result.errors.getErrorList().reduce(function(res, err) {\n return `${res}
Line ${err.line}: ${err.message}`;\n }, \"JSCS Fixer error:\"));\n }\n return resolve(result.output);\n } catch (error) {\n err = error;\n this.error(`JSCS Fixer error: ${err}`);\n return reject(err);\n }\n });\n }\n\n };\n\n JSCSFixer.prototype.name = \"JSCS Fixer\";\n\n JSCSFixer.prototype.link = \"https://github.com/jscs-dev/node-jscs/\";\n\n JSCSFixer.prototype.options = {\n JavaScript: false\n };\n\n return JSCSFixer;\n\n}).call(this);\n```", "response": "\"use strict\"\nBeautifier = require('./beautifier')\n\nChecker = null\ncliConfig = null\nchecker = null\n\nmodule.exports = class JSCSFixer extends Beautifier\n name: \"JSCS Fixer\"\n link: \"https://github.com/jscs-dev/node-jscs/\"\n\n options: {\n JavaScript: false\n }\n\n beautify: (text, language, options) ->\n @verbose(\"JSCS Fixer language #{language}\")\n return new @Promise((resolve, reject) =>\n try\n if !checker?\n cliConfig = require 'jscs/lib/cli-config'\n Checker = require 'jscs'\n checker = new Checker()\n checker.registerDefaultRules()\n editor = atom.workspace.getActiveTextEditor()\n path = if editor? then editor.getPath() else undefined\n config = if path? then cliConfig.load(undefined, atom.project.relativizePath(path)[0]) else undefined\n if !config?\n throw new Error(\"No JSCS config found.\")\n checker.configure(config)\n result = checker.fixString(text, path)\n if result.errors.getErrorCount() > 0\n @error(result.errors.getErrorList().reduce((res, err) ->\n \"#{res}
Line #{err.line}: #{err.message}\"\n , \"JSCS Fixer error:\"))\n\n resolve result.output\n\n catch err\n @error(\"JSCS Fixer error: #{err}\")\n reject(err)\n\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/jscs.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/jscs.coffee", "line_start": 1, "line_end": 43} +{"id": "Glavin001/atom-beautify:src/beautifiers/jscs.coffee:1:completion", "type": "completion", "prompt": "\"use strict\"\nBeautifier = require('./beautifier')\n\nChecker = null\ncliConfig = null\nchecker = null\n\nmodule.exports = class JSCSFixer extends Beautifier\n name: \"JSCS Fixer\"\n link: \"https://github.com/jscs-dev/node-jscs/\"\n\n options: {\n JavaScript: false\n }\n\n beautify: (text, language, options) ->\n @verbose(\"JSCS Fixer language #{language}\")\n return new @Promise((resolve, reject) =>\n try\n if !checker?\n cliConfig = require 'jscs/lib/cli-config'", "response": "Checker = require 'jscs'\n checker = new Checker()\n checker.registerDefaultRules()\n editor = atom.workspace.getActiveTextEditor()\n path = if editor? then editor.getPath() else undefined\n config = if path? then cliConfig.load(undefined, atom.project.relativizePath(path)[0]) else undefined\n if !config?\n throw new Error(\"No JSCS config found.\")\n checker.configure(config)\n result = checker.fixString(text, path)\n if result.errors.getErrorCount() > 0\n @error(result.errors.getErrorList().reduce((res, err) ->\n \"#{res}
Line #{err.line}: #{err.message}\"\n , \"JSCS Fixer error:\"))\n\n resolve result.output\n\n catch err\n @error(\"JSCS Fixer error: #{err}\")\n reject(err)\n\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/jscs.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/jscs.coffee", "line_start": 1, "line_end": 43} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n class PleaseWait\n @_defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 1, "line_end": 44} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n class PleaseWait\n @_defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"\n```", "response": "(function(root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n factory(exports);\n } else if (typeof define === \"function\" && define.amd) {\n // AMD. Register as an anonymous module.\n define([\"exports\"], factory);\n } else {\n // Browser globals\n factory(root);\n }\n})(this, function(exports) {\n var PleaseWait, getTransitionEvent, transitionEvent;\n getTransitionEvent = function() {\n var el, key, transitions, val;\n el = document.createElement('fakeelement');\n transitions = {\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd',\n 'animation': 'animationend'\n };\n for (key in transitions) {\n val = transitions[key];\n if (el.style[key] != null) {\n return val;\n }\n }\n };\n transitionEvent = getTransitionEvent();\n return PleaseWait = (function() {\n class PleaseWait {};\n\n PleaseWait._defaultOptions = {\n backgroundColor: null,\n logo: null,\n loadingHtml: null,\n template: `
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
`\n };\n\n return PleaseWait;\n\n }).call(this);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 1, "line_end": 44} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function(root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n factory(exports);\n } else if (typeof define === \"function\" && define.amd) {\n // AMD. Register as an anonymous module.\n define([\"exports\"], factory);\n } else {\n // Browser globals\n factory(root);\n }\n})(this, function(exports) {\n var PleaseWait, getTransitionEvent, transitionEvent;\n getTransitionEvent = function() {\n var el, key, transitions, val;\n el = document.createElement('fakeelement');\n transitions = {\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd',\n 'animation': 'animationend'\n };\n for (key in transitions) {\n val = transitions[key];\n if (el.style[key] != null) {\n return val;\n }\n }\n };\n transitionEvent = getTransitionEvent();\n return PleaseWait = (function() {\n class PleaseWait {};\n\n PleaseWait._defaultOptions = {\n backgroundColor: null,\n logo: null,\n loadingHtml: null,\n template: `
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
`\n };\n\n return PleaseWait;\n\n }).call(this);\n});\n```", "response": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n class PleaseWait\n @_defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 1, "line_end": 44} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:completion", "type": "completion", "prompt": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions", "response": "return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n class PleaseWait\n @_defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 1, "line_end": 44} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "constructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n # This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]\n # Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 46, "line_end": 85} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nconstructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n # This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]\n # Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n```", "response": "({\n constructor: function(options) {\n var defaultOptions, k, listener, logoElem, v;\n defaultOptions = this.constructor._defaultOptions;\n this.options = {};\n// Set initial options, merging given options with the defaults\n for (k in defaultOptions) {\n v = defaultOptions[k];\n this.options[k] = options[k] != null ? options[k] : v;\n }\n // Create the loading screen element\n this._loadingElem = document.createElement(\"div\");\n // Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n // we'll be displaying to the screen\n this._loadingHtmlToDisplay = [];\n // Add a global class for easy styling\n this._loadingElem.className = \"pg-loading-screen\";\n if (this.options.backgroundColor != null) {\n // Set the background color of the loading screen, if supplied\n this._loadingElem.style.backgroundColor = this.options.backgroundColor;\n }\n // Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n this._loadingElem.innerHTML = this.options.template;\n // Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n // This can be changed via updateLoadingHtml\n this._loadingHtmlElem = this._loadingElem.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtmlElem != null) {\n // Set the initial loading HTML, if supplied\n this._loadingHtmlElem.innerHTML = this.options.loadingHtml;\n }\n // Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n // If true, we can transition immediately to a new message/HTML\n this._readyToShowLoadingHtml = false;\n // Find the element that displays the loading logo and set the src if supplied\n logoElem = this._loadingElem.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logoElem != null) {\n logoElem.src = this.options.logo;\n }\n // Add the loading screen to the body\n document.body.appendChild(this._loadingElem);\n // Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n this._loadingElem.className += \" pg-loading\";\n // Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n return listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 46, "line_end": 85} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n constructor: function(options) {\n var defaultOptions, k, listener, logoElem, v;\n defaultOptions = this.constructor._defaultOptions;\n this.options = {};\n// Set initial options, merging given options with the defaults\n for (k in defaultOptions) {\n v = defaultOptions[k];\n this.options[k] = options[k] != null ? options[k] : v;\n }\n // Create the loading screen element\n this._loadingElem = document.createElement(\"div\");\n // Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n // we'll be displaying to the screen\n this._loadingHtmlToDisplay = [];\n // Add a global class for easy styling\n this._loadingElem.className = \"pg-loading-screen\";\n if (this.options.backgroundColor != null) {\n // Set the background color of the loading screen, if supplied\n this._loadingElem.style.backgroundColor = this.options.backgroundColor;\n }\n // Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n this._loadingElem.innerHTML = this.options.template;\n // Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n // This can be changed via updateLoadingHtml\n this._loadingHtmlElem = this._loadingElem.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtmlElem != null) {\n // Set the initial loading HTML, if supplied\n this._loadingHtmlElem.innerHTML = this.options.loadingHtml;\n }\n // Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n // If true, we can transition immediately to a new message/HTML\n this._readyToShowLoadingHtml = false;\n // Find the element that displays the loading logo and set the src if supplied\n logoElem = this._loadingElem.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logoElem != null) {\n logoElem.src = this.options.logo;\n }\n // Add the loading screen to the body\n document.body.appendChild(this._loadingElem);\n // Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n this._loadingElem.className += \" pg-loading\";\n // Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n return listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n }\n});\n```", "response": "constructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n # This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]\n # Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 46, "line_end": 85} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:completion", "type": "completion", "prompt": "constructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)", "response": "# This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]\n # Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 46, "line_end": 85} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if @_loadingHtmlElem?\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n # Define listeners for the transtioning out and in of new loading HTML/messages\n @_loadingHtmlListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n @_removingHtmlListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, @_loadingHtmlListener)\n else\n @_loadingHtmlListener()\n\n finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 87, "line_end": 125} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif @_loadingHtmlElem?\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n # Define listeners for the transtioning out and in of new loading HTML/messages\n @_loadingHtmlListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n @_removingHtmlListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, @_loadingHtmlListener)\n else\n @_loadingHtmlListener()\n\n finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null\n```", "response": "if (this._loadingHtmlElem != null) {\n // Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.addEventListener(transitionEvent, listener);\n } else {\n listener();\n }\n // Define listeners for the transtioning out and in of new loading HTML/messages\n this._loadingHtmlListener = () => {\n // New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n this._readyToShowLoadingHtml = true;\n // Remove the CSS class that triggered the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._loadingHtmlListener);\n }\n // Check if there's still HTML left in the queue to display. If so, let's show it\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n this._removingHtmlListener = () => {\n // Last loading HTML to display has fully transitioned out. Time to transition the new in\n this._loadingHtmlElem.innerHTML = this._loadingHtmlToDisplay.shift();\n // Add the CSS class to trigger the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._removingHtmlListener);\n return this._loadingHtmlElem.addEventListener(transitionEvent, this._loadingHtmlListener);\n } else {\n return this._loadingHtmlListener();\n }\n };\n}\n\n({\n finish: function() {\n var listener;\n if (this._loadingElem == null) {\n return;\n }\n // Again, define a listener to run once the loading screen has fully transitioned out\n return listener = () => {\n // Remove the loading screen from the body\n document.body.removeChild(this._loadingElem);\n // Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingElem.removeEventListener(transitionEvent, listener);\n }\n // Reset the loading screen element since it's no longer attached to the DOM\n return this._loadingElem = null;\n };\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 87, "line_end": 125} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (this._loadingHtmlElem != null) {\n // Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.addEventListener(transitionEvent, listener);\n } else {\n listener();\n }\n // Define listeners for the transtioning out and in of new loading HTML/messages\n this._loadingHtmlListener = () => {\n // New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n this._readyToShowLoadingHtml = true;\n // Remove the CSS class that triggered the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._loadingHtmlListener);\n }\n // Check if there's still HTML left in the queue to display. If so, let's show it\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n this._removingHtmlListener = () => {\n // Last loading HTML to display has fully transitioned out. Time to transition the new in\n this._loadingHtmlElem.innerHTML = this._loadingHtmlToDisplay.shift();\n // Add the CSS class to trigger the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._removingHtmlListener);\n return this._loadingHtmlElem.addEventListener(transitionEvent, this._loadingHtmlListener);\n } else {\n return this._loadingHtmlListener();\n }\n };\n}\n\n({\n finish: function() {\n var listener;\n if (this._loadingElem == null) {\n return;\n }\n // Again, define a listener to run once the loading screen has fully transitioned out\n return listener = () => {\n // Remove the loading screen from the body\n document.body.removeChild(this._loadingElem);\n // Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingElem.removeEventListener(transitionEvent, listener);\n }\n // Reset the loading screen element since it's no longer attached to the DOM\n return this._loadingElem = null;\n };\n }\n});\n```", "response": "if @_loadingHtmlElem?\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n # Define listeners for the transtioning out and in of new loading HTML/messages\n @_loadingHtmlListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n @_removingHtmlListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, @_loadingHtmlListener)\n else\n @_loadingHtmlListener()\n\n finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 87, "line_end": 125} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:completion", "type": "completion", "prompt": "if @_loadingHtmlElem?\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n # Define listeners for the transtioning out and in of new loading HTML/messages\n @_loadingHtmlListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n @_removingHtmlListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in", "response": "@_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, @_loadingHtmlListener)\n else\n @_loadingHtmlListener()\n\n finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 87, "line_end": 125} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n unless @_loadingHtmlElem? then throw new Error(\"The loading template does not have an element of class 'pg-loading-html'\")\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n # Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n # Remove any old event listeners that may still be attached to the DOM\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n # Remove any old CSS transition classes that may still be on the element\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace( \" pg-removing \", \"\")\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, @_removingHtmlListener)\n else\n @_removingHtmlListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 127, "line_end": 165} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:completion", "type": "completion", "prompt": "# Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n unless @_loadingHtmlElem? then throw new Error(\"The loading template does not have an element of class 'pg-loading-html'\")\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML", "response": "if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n # Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n # Remove any old event listeners that may still be attached to the DOM\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n # Remove any old CSS transition classes that may still be on the element\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace( \" pg-removing \", \"\")\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, @_removingHtmlListener)\n else\n @_removingHtmlListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/d99216f87ac8fbfecaa335fa8bd9bd1a5581f67c/src/please-wait.coffee", "line_start": 127, "line_end": 165} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n # Define listeners for the transtioning out and in of new loading HTML/messages\n @_loadingHtmlListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n @_removingHtmlListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, @_loadingHtmlListener)\n else\n @_loadingHtmlListener()\n\n finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null\n\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "7e8c4799ab00b94d00d6f0bef1478566b100806d", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/7e8c4799ab00b94d00d6f0bef1478566b100806d/src/please-wait.coffee", "line_start": 87, "line_end": 133} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:completion", "type": "completion", "prompt": "# Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n # Define listeners for the transtioning out and in of new loading HTML/messages\n @_loadingHtmlListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n @_removingHtmlListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)", "response": "@_loadingHtmlElem.addEventListener(transitionEvent, @_loadingHtmlListener)\n else\n @_loadingHtmlListener()\n\n finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null\n\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "7e8c4799ab00b94d00d6f0bef1478566b100806d", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/7e8c4799ab00b94d00d6f0bef1478566b100806d/src/please-wait.coffee", "line_start": 87, "line_end": 133} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n # Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n # Remove any old event listeners that may still be attached to the DOM\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n # Remove any old CSS transition classes that may still be on the element\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace( \" pg-removing \", \"\")\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, @_removingHtmlListener)\n else\n @_removingHtmlListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "7e8c4799ab00b94d00d6f0bef1478566b100806d", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/7e8c4799ab00b94d00d6f0bef1478566b100806d/src/please-wait.coffee", "line_start": 135, "line_end": 166} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nupdateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n # Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n # Remove any old event listeners that may still be attached to the DOM\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n # Remove any old CSS transition classes that may still be on the element\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace( \" pg-removing \", \"\")\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, @_removingHtmlListener)\n else\n @_removingHtmlListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait\n```", "response": "var pleaseWait;\n\n({\n updateLoadingHtml: function(loadingHtml, immediately = false) {\n if (immediately) {\n // Ignore any loading HTML that may be queued up. Show this immediately\n this._loadingHtmlToDisplay = [loadingHtml];\n this._readyToShowLoadingHtml = true;\n } else {\n // Add to an array of HTML to display to the user\n this._loadingHtmlToDisplay.push(loadingHtml);\n }\n // If ready, let's display the new loading HTML\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n // Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: function() {\n this._readyToShowLoadingHtml = false;\n // Remove any old event listeners that may still be attached to the DOM\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._loadingHtmlListener);\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._removingHtmlListener);\n // Remove any old CSS transition classes that may still be on the element\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace(\" pg-removing \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n // Add the CSS class that will cause the HTML to fade out\n this._loadingHtmlElem.className += \" pg-removing \";\n return this._loadingHtmlElem.addEventListener(transitionEvent, this._removingHtmlListener);\n } else {\n return this._removingHtmlListener();\n }\n }\n});\n\npleaseWait = function(options = {}) {\n return new PleaseWait(options);\n};\n\nexports.pleaseWait = pleaseWait;\n\nreturn pleaseWait;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "7e8c4799ab00b94d00d6f0bef1478566b100806d", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/7e8c4799ab00b94d00d6f0bef1478566b100806d/src/please-wait.coffee", "line_start": 135, "line_end": 166} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar pleaseWait;\n\n({\n updateLoadingHtml: function(loadingHtml, immediately = false) {\n if (immediately) {\n // Ignore any loading HTML that may be queued up. Show this immediately\n this._loadingHtmlToDisplay = [loadingHtml];\n this._readyToShowLoadingHtml = true;\n } else {\n // Add to an array of HTML to display to the user\n this._loadingHtmlToDisplay.push(loadingHtml);\n }\n // If ready, let's display the new loading HTML\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n // Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: function() {\n this._readyToShowLoadingHtml = false;\n // Remove any old event listeners that may still be attached to the DOM\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._loadingHtmlListener);\n this._loadingHtmlElem.removeEventListener(transitionEvent, this._removingHtmlListener);\n // Remove any old CSS transition classes that may still be on the element\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace(\" pg-removing \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n // Add the CSS class that will cause the HTML to fade out\n this._loadingHtmlElem.className += \" pg-removing \";\n return this._loadingHtmlElem.addEventListener(transitionEvent, this._removingHtmlListener);\n } else {\n return this._removingHtmlListener();\n }\n }\n});\n\npleaseWait = function(options = {}) {\n return new PleaseWait(options);\n};\n\nexports.pleaseWait = pleaseWait;\n\nreturn pleaseWait;\n```", "response": "updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n # Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n # Remove any old event listeners that may still be attached to the DOM\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n # Remove any old CSS transition classes that may still be on the element\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace( \" pg-removing \", \"\")\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, @_removingHtmlListener)\n else\n @_removingHtmlListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "7e8c4799ab00b94d00d6f0bef1478566b100806d", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/7e8c4799ab00b94d00d6f0bef1478566b100806d/src/please-wait.coffee", "line_start": 135, "line_end": 166} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:completion", "type": "completion", "prompt": "updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n # Private method to immediately change the loading HTML displayed\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n # Remove any old event listeners that may still be attached to the DOM\n @_loadingHtmlElem.removeEventListener(transitionEvent, @_loadingHtmlListener)", "response": "@_loadingHtmlElem.removeEventListener(transitionEvent, @_removingHtmlListener)\n # Remove any old CSS transition classes that may still be on the element\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\").replace( \" pg-removing \", \"\")\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, @_removingHtmlListener)\n else\n @_removingHtmlListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "7e8c4799ab00b94d00d6f0bef1478566b100806d", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/7e8c4799ab00b94d00d6f0bef1478566b100806d/src/please-wait.coffee", "line_start": 135, "line_end": 166} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "constructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n # This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]\n # Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 46, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nconstructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n # This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]\n # Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()\n```", "response": "({\n constructor: function(options) {\n var defaultOptions, k, listener, logoElem, v;\n defaultOptions = this.constructor._defaultOptions;\n this.options = {};\n// Set initial options, merging given options with the defaults\n for (k in defaultOptions) {\n v = defaultOptions[k];\n this.options[k] = options[k] != null ? options[k] : v;\n }\n // Create the loading screen element\n this._loadingElem = document.createElement(\"div\");\n // Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n // we'll be displaying to the screen\n this._loadingHtmlToDisplay = [];\n // Add a global class for easy styling\n this._loadingElem.className = \"pg-loading-screen\";\n if (this.options.backgroundColor != null) {\n // Set the background color of the loading screen, if supplied\n this._loadingElem.style.backgroundColor = this.options.backgroundColor;\n }\n // Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n this._loadingElem.innerHTML = this.options.template;\n // Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n // This can be changed via updateLoadingHtml\n this._loadingHtmlElem = this._loadingElem.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtmlElem != null) {\n // Set the initial loading HTML, if supplied\n this._loadingHtmlElem.innerHTML = this.options.loadingHtml;\n }\n // Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n // If true, we can transition immediately to a new message/HTML\n this._readyToShowLoadingHtml = false;\n // Find the element that displays the loading logo and set the src if supplied\n logoElem = this._loadingElem.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logoElem != null) {\n logoElem.src = this.options.logo;\n }\n // Add the loading screen to the body\n document.body.appendChild(this._loadingElem);\n // Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n this._loadingElem.className += \" pg-loading\";\n // Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n // Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n return this._loadingHtmlElem.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 46, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n constructor: function(options) {\n var defaultOptions, k, listener, logoElem, v;\n defaultOptions = this.constructor._defaultOptions;\n this.options = {};\n// Set initial options, merging given options with the defaults\n for (k in defaultOptions) {\n v = defaultOptions[k];\n this.options[k] = options[k] != null ? options[k] : v;\n }\n // Create the loading screen element\n this._loadingElem = document.createElement(\"div\");\n // Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n // we'll be displaying to the screen\n this._loadingHtmlToDisplay = [];\n // Add a global class for easy styling\n this._loadingElem.className = \"pg-loading-screen\";\n if (this.options.backgroundColor != null) {\n // Set the background color of the loading screen, if supplied\n this._loadingElem.style.backgroundColor = this.options.backgroundColor;\n }\n // Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n this._loadingElem.innerHTML = this.options.template;\n // Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n // This can be changed via updateLoadingHtml\n this._loadingHtmlElem = this._loadingElem.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtmlElem != null) {\n // Set the initial loading HTML, if supplied\n this._loadingHtmlElem.innerHTML = this.options.loadingHtml;\n }\n // Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n // If true, we can transition immediately to a new message/HTML\n this._readyToShowLoadingHtml = false;\n // Find the element that displays the loading logo and set the src if supplied\n logoElem = this._loadingElem.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logoElem != null) {\n logoElem.src = this.options.logo;\n }\n // Add the loading screen to the body\n document.body.appendChild(this._loadingElem);\n // Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n this._loadingElem.className += \" pg-loading\";\n // Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n // Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n return this._loadingHtmlElem.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n }\n});\n```", "response": "constructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n # This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]\n # Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 46, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:completion", "type": "completion", "prompt": "constructor: (options) ->\n defaultOptions = @constructor._defaultOptions\n @options = {}\n\n # Set initial options, merging given options with the defaults\n for k, v of defaultOptions\n @options[k] = if options[k]? then options[k] else v\n\n # Create the loading screen element\n @_loadingElem = document.createElement(\"div\")\n # Create an empty array to store the potential list of loading HTML (messages, spinners, etc)\n # we'll be displaying to the screen\n @_loadingHtmlToDisplay = []\n # Add a global class for easy styling\n @_loadingElem.className = \"pg-loading-screen\"\n # Set the background color of the loading screen, if supplied\n @_loadingElem.style.backgroundColor = @options.backgroundColor if @options.backgroundColor?\n # Initialize the loading screen's HTML with the defined template. The default can be overwritten via options\n @_loadingElem.innerHTML = @options.template\n # Find the element that will contain the loading HTML displayed to the user (typically a spinner/message)\n # This can be changed via updateLoadingHtml\n @_loadingHtmlElem = @_loadingElem.getElementsByClassName(\"pg-loading-html\")[0]", "response": "# Set the initial loading HTML, if supplied\n @_loadingHtmlElem.innerHTML = @options.loadingHtml if @_loadingHtmlElem?\n # Set a flag that lets us know if the transitioning between loading HTML elements is finished.\n # If true, we can transition immediately to a new message/HTML\n @_readyToShowLoadingHtml = false\n # Find the element that displays the loading logo and set the src if supplied\n logoElem = @_loadingElem.getElementsByClassName(\"pg-loading-logo\")[0]\n logoElem.src = @options.logo if logoElem?\n # Add the loading screen to the body\n document.body.appendChild(@_loadingElem)\n # Add the CSS class that will trigger the initial transitions of the logo/loading HTML\n @_loadingElem.className += \" pg-loading\"\n # Define a listener to look for any new loading HTML that needs to be displayed after the intiial transition finishes\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n @_loadingHtmlElem.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 46, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null\n\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, loadingListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 91, "line_end": 133} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfinish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null\n\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, loadingListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n```", "response": "({\n finish: function() {\n var listener;\n if (this._loadingElem == null) {\n return;\n }\n // Again, define a listener to run once the loading screen has fully transitioned out\n listener = () => {\n // Remove the loading screen from the body\n document.body.removeChild(this._loadingElem);\n // Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingElem.removeEventListener(transitionEvent, listener);\n }\n // Reset the loading screen element since it's no longer attached to the DOM\n return this._loadingElem = null;\n };\n // Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n // Set a class on the loading screen to trigger a fadeout animation\n this._loadingElem.className += \" pg-loaded\";\n // When the loading screen is finished fading out, we'll remove it from the DOM\n return this._loadingElem.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n updateLoadingHtml: function(loadingHtml, immediately = false) {\n if (immediately) {\n // Ignore any loading HTML that may be queued up. Show this immediately\n this._loadingHtmlToDisplay = [loadingHtml];\n this._readyToShowLoadingHtml = true;\n } else {\n // Add to an array of HTML to display to the user\n this._loadingHtmlToDisplay.push(loadingHtml);\n }\n // If ready, let's display the new loading HTML\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n _changeLoadingHtml: function() {\n var loadingListener;\n this._readyToShowLoadingHtml = false;\n return loadingListener = () => {\n // New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n this._readyToShowLoadingHtml = true;\n // Remove the CSS class that triggered the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, loadingListener);\n }\n // Check if there's still HTML left in the queue to display. If so, let's show it\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 91, "line_end": 133} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n finish: function() {\n var listener;\n if (this._loadingElem == null) {\n return;\n }\n // Again, define a listener to run once the loading screen has fully transitioned out\n listener = () => {\n // Remove the loading screen from the body\n document.body.removeChild(this._loadingElem);\n // Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingElem.removeEventListener(transitionEvent, listener);\n }\n // Reset the loading screen element since it's no longer attached to the DOM\n return this._loadingElem = null;\n };\n // Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n // Set a class on the loading screen to trigger a fadeout animation\n this._loadingElem.className += \" pg-loaded\";\n // When the loading screen is finished fading out, we'll remove it from the DOM\n return this._loadingElem.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n updateLoadingHtml: function(loadingHtml, immediately = false) {\n if (immediately) {\n // Ignore any loading HTML that may be queued up. Show this immediately\n this._loadingHtmlToDisplay = [loadingHtml];\n this._readyToShowLoadingHtml = true;\n } else {\n // Add to an array of HTML to display to the user\n this._loadingHtmlToDisplay.push(loadingHtml);\n }\n // If ready, let's display the new loading HTML\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n _changeLoadingHtml: function() {\n var loadingListener;\n this._readyToShowLoadingHtml = false;\n return loadingListener = () => {\n // New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n this._readyToShowLoadingHtml = true;\n // Remove the CSS class that triggered the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, loadingListener);\n }\n // Check if there's still HTML left in the queue to display. If so, let's show it\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n }\n});\n```", "response": "finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null\n\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, loadingListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 91, "line_end": 133} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:completion", "type": "completion", "prompt": "finish: ->\n return unless @_loadingElem?\n # Again, define a listener to run once the loading screen has fully transitioned out\n listener = =>\n # Remove the loading screen from the body\n document.body.removeChild(@_loadingElem)\n # Add a class to the body to signal that the loading screen has finished and the app is ready\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingElem.removeEventListener(transitionEvent, listener)\n # Reset the loading screen element since it's no longer attached to the DOM\n @_loadingElem = null\n\n # Detect CSS animation support. If not found, we'll call the listener immediately. Otherwise, we'll wait\n if transitionEvent?\n # Set a class on the loading screen to trigger a fadeout animation\n @_loadingElem.className += \" pg-loaded\"\n # When the loading screen is finished fading out, we'll remove it from the DOM\n @_loadingElem.addEventListener(transitionEvent, listener)\n else\n listener()", "response": "updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n # Ignore any loading HTML that may be queued up. Show this immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n # Add to an array of HTML to display to the user\n @_loadingHtmlToDisplay.push(loadingHtml)\n # If ready, let's display the new loading HTML\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n # New loading HTML has fully transitioned in. We're now ready to show a new message/HTML\n @_readyToShowLoadingHtml = true\n # Remove the CSS class that triggered the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtmlElem.removeEventListener(transitionEvent, loadingListener)\n # Check if there's still HTML left in the queue to display. If so, let's show it\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 91, "line_end": 133} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "removingListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, removingListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 135, "line_end": 157} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nremovingListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, removingListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait\n```", "response": "var pleaseWait, removingListener;\n\nremovingListener = () => {\n // Last loading HTML to display has fully transitioned out. Time to transition the new in\n this._loadingHtmlElem.innerHTML = this._loadingHtmlToDisplay.shift();\n // Add the CSS class to trigger the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, removingListener);\n return this._loadingHtmlElem.addEventListener(transitionEvent, loadingListener);\n } else {\n return loadingListener();\n }\n};\n\nif (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n // Add the CSS class that will cause the HTML to fade out\n this._loadingHtmlElem.className += \" pg-removing \";\n this._loadingHtmlElem.addEventListener(transitionEvent, removingListener);\n} else {\n removingListener();\n}\n\npleaseWait = function(options = {}) {\n return new PleaseWait(options);\n};\n\nexports.pleaseWait = pleaseWait;\n\nreturn pleaseWait;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 135, "line_end": 157} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar pleaseWait, removingListener;\n\nremovingListener = () => {\n // Last loading HTML to display has fully transitioned out. Time to transition the new in\n this._loadingHtmlElem.innerHTML = this._loadingHtmlToDisplay.shift();\n // Add the CSS class to trigger the fade in animation\n this._loadingHtmlElem.className = this._loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtmlElem.removeEventListener(transitionEvent, removingListener);\n return this._loadingHtmlElem.addEventListener(transitionEvent, loadingListener);\n } else {\n return loadingListener();\n }\n};\n\nif (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n // Add the CSS class that will cause the HTML to fade out\n this._loadingHtmlElem.className += \" pg-removing \";\n this._loadingHtmlElem.addEventListener(transitionEvent, removingListener);\n} else {\n removingListener();\n}\n\npleaseWait = function(options = {}) {\n return new PleaseWait(options);\n};\n\nexports.pleaseWait = pleaseWait;\n\nreturn pleaseWait;\n```", "response": "removingListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, removingListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 135, "line_end": 157} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:completion", "type": "completion", "prompt": "removingListener = =>\n # Last loading HTML to display has fully transitioned out. Time to transition the new in\n @_loadingHtmlElem.innerHTML = @_loadingHtmlToDisplay.shift()\n # Add the CSS class to trigger the fade in animation\n @_loadingHtmlElem.className = @_loadingHtmlElem.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtmlElem.removeEventListener(transitionEvent, removingListener)\n @_loadingHtmlElem.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()", "response": "if transitionEvent?\n # Add the CSS class that will cause the HTML to fade out\n @_loadingHtmlElem.className += \" pg-removing \"\n @_loadingHtmlElem.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n pleaseWait = (options = {}) ->\n new PleaseWait(options)\n\n exports.pleaseWait = pleaseWait\n return pleaseWait", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "a619fde4ea75ea695b1546a302e220ed065d5ff0", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/a619fde4ea75ea695b1546a302e220ed065d5ff0/src/please-wait.coffee", "line_start": 135, "line_end": 157} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 1, "line_end": 45} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"\n```", "response": "(function(root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n factory(exports);\n } else if (typeof define === \"function\" && define.amd) {\n // AMD. Register as an anonymous module.\n define([\"exports\"], factory);\n } else {\n // Browser globals\n factory(root);\n }\n})(this, function(exports) {\n var PleaseWait;\n return PleaseWait = function() {\n var _pleaseWait, getTransitionEvent, transitionEvent;\n getTransitionEvent = function() {\n var el, key, transitions, val;\n el = document.createElement('fakeelement');\n transitions = {\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd',\n 'animation': 'animationend'\n };\n for (key in transitions) {\n val = transitions[key];\n if (el.style[key] != null) {\n return val;\n }\n }\n };\n transitionEvent = getTransitionEvent();\n return _pleaseWait = {\n defaultOptions: {\n backgroundColor: null,\n logo: null,\n loadingHtml: null,\n template: `
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
`\n }\n };\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 1, "line_end": 45} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function(root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n factory(exports);\n } else if (typeof define === \"function\" && define.amd) {\n // AMD. Register as an anonymous module.\n define([\"exports\"], factory);\n } else {\n // Browser globals\n factory(root);\n }\n})(this, function(exports) {\n var PleaseWait;\n return PleaseWait = function() {\n var _pleaseWait, getTransitionEvent, transitionEvent;\n getTransitionEvent = function() {\n var el, key, transitions, val;\n el = document.createElement('fakeelement');\n transitions = {\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd',\n 'animation': 'animationend'\n };\n for (key in transitions) {\n val = transitions[key];\n if (el.style[key] != null) {\n return val;\n }\n }\n };\n transitionEvent = getTransitionEvent();\n return _pleaseWait = {\n defaultOptions: {\n backgroundColor: null,\n logo: null,\n loadingHtml: null,\n template: `
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
`\n }\n };\n };\n});\n```", "response": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 1, "line_end": 45} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:completion", "type": "completion", "prompt": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'", "response": "for key, val of transitions\n return val if el.style[key]?\n\n transitionEvent = getTransitionEvent()\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n logo: null\n loadingHtml: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 1, "line_end": 45} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "done: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n @_loadingHtmlToDisplay.push(loadingHtml)\n\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")\n @_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndone: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n @_loadingHtmlToDisplay.push(loadingHtml)\n\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")\n @_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n```", "response": "({\n done: function() {\n var listener;\n if (this._loadingDiv == null) {\n return;\n }\n listener = () => {\n document.body.removeChild(this._loadingDiv);\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n return this._loadingDiv = null;\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.className += \" pg-loaded\";\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n updateLoadingHtml: function(loadingHtml, immediately = false) {\n if (immediately) {\n this._loadingHtmlToDisplay = [loadingHtml];\n this._readyToShowLoadingHtml = true;\n } else {\n this._loadingHtmlToDisplay.push(loadingHtml);\n }\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n load: function(options = {}) {\n var listener, logo;\n options = this._createOptions(options);\n this._loadingDiv || (this._loadingDiv = document.createElement(\"header\"));\n this._loadingHtmlToDisplay = [];\n this._loadingDiv.className = \"pg-loading-screen\";\n if (options.backgroundColor != null) {\n this._loadingDiv.style.backgroundColor = options.backgroundColor;\n }\n this._loadingDiv.innerHTML = options.template;\n this._loadingHtml = this._loadingDiv.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtml != null) {\n this._loadingHtml.innerHTML = options.loadingHtml;\n }\n this._readyToShowLoadingHtml = false;\n logo = this._loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logo != null) {\n logo.src = options.logo;\n }\n document.body.appendChild(this._loadingDiv);\n this._loadingDiv.className += \" pg-loading\";\n return listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n done: function() {\n var listener;\n if (this._loadingDiv == null) {\n return;\n }\n listener = () => {\n document.body.removeChild(this._loadingDiv);\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n return this._loadingDiv = null;\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.className += \" pg-loaded\";\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n updateLoadingHtml: function(loadingHtml, immediately = false) {\n if (immediately) {\n this._loadingHtmlToDisplay = [loadingHtml];\n this._readyToShowLoadingHtml = true;\n } else {\n this._loadingHtmlToDisplay.push(loadingHtml);\n }\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n load: function(options = {}) {\n var listener, logo;\n options = this._createOptions(options);\n this._loadingDiv || (this._loadingDiv = document.createElement(\"header\"));\n this._loadingHtmlToDisplay = [];\n this._loadingDiv.className = \"pg-loading-screen\";\n if (options.backgroundColor != null) {\n this._loadingDiv.style.backgroundColor = options.backgroundColor;\n }\n this._loadingDiv.innerHTML = options.template;\n this._loadingHtml = this._loadingDiv.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtml != null) {\n this._loadingHtml.innerHTML = options.loadingHtml;\n }\n this._readyToShowLoadingHtml = false;\n logo = this._loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logo != null) {\n logo.src = options.logo;\n }\n document.body.appendChild(this._loadingDiv);\n this._loadingDiv.className += \" pg-loading\";\n return listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n }\n});\n```", "response": "done: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n @_loadingHtmlToDisplay.push(loadingHtml)\n\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")\n @_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:completion", "type": "completion", "prompt": "done: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml, immediately=false) ->\n if immediately\n @_loadingHtmlToDisplay = [loadingHtml]\n @_readyToShowLoadingHtml = true\n else\n @_loadingHtmlToDisplay.push(loadingHtml)", "response": "if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")\n @_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if transitionEvent?\n @_loadingHtml.addEventListener(transitionEvent, listener)\n else\n listener()\n\n return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 91, "line_end": 130} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif transitionEvent?\n @_loadingHtml.addEventListener(transitionEvent, listener)\n else\n listener()\n\n return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n```", "response": "if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.addEventListener(transitionEvent, listener);\n} else {\n listener();\n}\n\nreturn this._loadingDiv;\n\n({\n _createOptions: function(options = {}) {\n var defaultOptions, k, newOptions, v;\n defaultOptions = this.defaultOptions;\n newOptions = {};\n// Set options\n for (k in defaultOptions) {\n v = defaultOptions[k];\n newOptions[k] = options[k] != null ? options[k] : v;\n }\n return newOptions;\n },\n _changeLoadingHtml: function() {\n var loadingListener, removingListener;\n this._readyToShowLoadingHtml = false;\n loadingListener = () => {\n this._readyToShowLoadingHtml = true;\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, loadingListener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n removingListener = () => {\n this._loadingHtml.innerHTML = this._loadingHtmlToDisplay.shift();\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, removingListener);\n return this._loadingHtml.addEventListener(transitionEvent, loadingListener);\n } else {\n return loadingListener();\n }\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.className += \" pg-removing \";\n return this._loadingHtml.addEventListener(transitionEvent, removingListener);\n } else {\n return removingListener();\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 91, "line_end": 130} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.addEventListener(transitionEvent, listener);\n} else {\n listener();\n}\n\nreturn this._loadingDiv;\n\n({\n _createOptions: function(options = {}) {\n var defaultOptions, k, newOptions, v;\n defaultOptions = this.defaultOptions;\n newOptions = {};\n// Set options\n for (k in defaultOptions) {\n v = defaultOptions[k];\n newOptions[k] = options[k] != null ? options[k] : v;\n }\n return newOptions;\n },\n _changeLoadingHtml: function() {\n var loadingListener, removingListener;\n this._readyToShowLoadingHtml = false;\n loadingListener = () => {\n this._readyToShowLoadingHtml = true;\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, loadingListener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n removingListener = () => {\n this._loadingHtml.innerHTML = this._loadingHtmlToDisplay.shift();\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, removingListener);\n return this._loadingHtml.addEventListener(transitionEvent, loadingListener);\n } else {\n return loadingListener();\n }\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.className += \" pg-removing \";\n return this._loadingHtml.addEventListener(transitionEvent, removingListener);\n } else {\n return removingListener();\n }\n }\n});\n```", "response": "if transitionEvent?\n @_loadingHtml.addEventListener(transitionEvent, listener)\n else\n listener()\n\n return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 91, "line_end": 130} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:completion", "type": "completion", "prompt": "if transitionEvent?\n @_loadingHtml.addEventListener(transitionEvent, listener)\n else\n listener()\n\n return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false", "response": "loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 91, "line_end": 130} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()\n updateLoadingHtml: (html) -> _pleaseWait.updateLoadingHtml(html)\n }\n\n exports.pleaseWait = new PleaseWait()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 132, "line_end": 138} +{"id": "Pathgather/please-wait:src/please-wait.coffee:4:completion", "type": "completion", "prompt": "return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()", "response": "updateLoadingHtml: (html) -> _pleaseWait.updateLoadingHtml(html)\n }\n\n exports.pleaseWait = new PleaseWait()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "2a936837089956ff8350e421f9604ece2ebafd78", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/2a936837089956ff8350e421f9604ece2ebafd78/src/please-wait.coffee", "line_start": 132, "line_end": 138} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "done: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml) ->\n @_loadingHtmlToDisplay.push(options.loadingHtml)\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")\n @_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n if transitionEvent?\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndone: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml) ->\n @_loadingHtmlToDisplay.push(options.loadingHtml)\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")\n @_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n if transitionEvent?\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n```", "response": "({\n done: function() {\n var listener;\n if (this._loadingDiv == null) {\n return;\n }\n listener = () => {\n document.body.removeChild(this._loadingDiv);\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n return this._loadingDiv = null;\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.className += \" pg-loaded\";\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n updateLoadingHtml: function(loadingHtml) {\n this._loadingHtmlToDisplay.push(options.loadingHtml);\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n load: function(options = {}) {\n var listener, logo;\n options = this._createOptions(options);\n this._loadingDiv || (this._loadingDiv = document.createElement(\"header\"));\n this._loadingHtmlToDisplay = [];\n this._loadingDiv.className = \"pg-loading-screen\";\n if (options.backgroundColor != null) {\n this._loadingDiv.style.backgroundColor = options.backgroundColor;\n }\n this._loadingDiv.innerHTML = options.template;\n this._loadingHtml = this._loadingDiv.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtml != null) {\n this._loadingHtml.innerHTML = options.loadingHtml;\n }\n this._readyToShowLoadingHtml = false;\n logo = this._loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logo != null) {\n logo.src = options.logo;\n }\n document.body.appendChild(this._loadingDiv);\n this._loadingDiv.className += \" pg-loading\";\n listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n done: function() {\n var listener;\n if (this._loadingDiv == null) {\n return;\n }\n listener = () => {\n document.body.removeChild(this._loadingDiv);\n document.body.className += \" pg-loaded\";\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n return this._loadingDiv = null;\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.className += \" pg-loaded\";\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n updateLoadingHtml: function(loadingHtml) {\n this._loadingHtmlToDisplay.push(options.loadingHtml);\n if (this._readyToShowLoadingHtml) {\n return this._changeLoadingHtml();\n }\n },\n load: function(options = {}) {\n var listener, logo;\n options = this._createOptions(options);\n this._loadingDiv || (this._loadingDiv = document.createElement(\"header\"));\n this._loadingHtmlToDisplay = [];\n this._loadingDiv.className = \"pg-loading-screen\";\n if (options.backgroundColor != null) {\n this._loadingDiv.style.backgroundColor = options.backgroundColor;\n }\n this._loadingDiv.innerHTML = options.template;\n this._loadingHtml = this._loadingDiv.getElementsByClassName(\"pg-loading-html\")[0];\n if (this._loadingHtml != null) {\n this._loadingHtml.innerHTML = options.loadingHtml;\n }\n this._readyToShowLoadingHtml = false;\n logo = this._loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0];\n if (logo != null) {\n logo.src = options.logo;\n }\n document.body.appendChild(this._loadingDiv);\n this._loadingDiv.className += \" pg-loading\";\n listener = () => {\n this._readyToShowLoadingHtml = true;\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n }\n});\n```", "response": "done: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml) ->\n @_loadingHtmlToDisplay.push(options.loadingHtml)\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")\n @_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n if transitionEvent?\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:completion", "type": "completion", "prompt": "done: ->\n return unless @_loadingDiv?\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n updateLoadingHtml: (loadingHtml) ->\n @_loadingHtmlToDisplay.push(options.loadingHtml)\n if @_readyToShowLoadingHtml then @_changeLoadingHtml()\n\n load: (options = {}) ->\n options = @_createOptions(options)\n @_loadingDiv ||= document.createElement(\"header\")", "response": "@_loadingHtmlToDisplay = []\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = options.backgroundColor if options.backgroundColor?\n @_loadingDiv.innerHTML = options.template\n @_loadingHtml = @_loadingDiv.getElementsByClassName(\"pg-loading-html\")[0]\n @_loadingHtml.innerHTML = options.loadingHtml if @_loadingHtml?\n @_readyToShowLoadingHtml = false\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n logo.src = options.logo if logo?\n\n document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n\n listener = =>\n @_readyToShowLoadingHtml = true\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n if transitionEvent?\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 47, "line_end": 89} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()\n updateLoadingHtml: (html) -> _pleaseWait.updateLoadingHtml(html)\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 91, "line_end": 131} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreturn @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()\n updateLoadingHtml: (html) -> _pleaseWait.updateLoadingHtml(html)\n }\n```", "response": "return this._loadingDiv({\n _createOptions: function(options = {}) {\n var defaultOptions, k, newOptions, v;\n defaultOptions = this.defaultOptions;\n newOptions = {};\n// Set options\n for (k in defaultOptions) {\n v = defaultOptions[k];\n newOptions[k] = options[k] != null ? options[k] : v;\n }\n return newOptions;\n },\n _changeLoadingHtml: function() {\n var loadingListener, removingListener;\n this._readyToShowLoadingHtml = false;\n loadingListener = () => {\n this._readyToShowLoadingHtml = true;\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, loadingListener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n removingListener = () => {\n this._loadingHtml.innerHTML = this._loadingHtmlToDisplay.shift();\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, removingListener);\n return this._loadingHtml.addEventListener(transitionEvent, loadingListener);\n } else {\n return loadingListener();\n }\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.className += \" pg-removing \";\n return this._loadingHtml.addEventListener(transitionEvent, removingListener);\n } else {\n return removingListener();\n }\n }\n});\n\nreturn {\n start: function(options = {}) {\n return _pleaseWait.load(options);\n },\n finish: function() {\n return _pleaseWait.done();\n },\n updateLoadingHtml: function(html) {\n return _pleaseWait.updateLoadingHtml(html);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 91, "line_end": 131} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nreturn this._loadingDiv({\n _createOptions: function(options = {}) {\n var defaultOptions, k, newOptions, v;\n defaultOptions = this.defaultOptions;\n newOptions = {};\n// Set options\n for (k in defaultOptions) {\n v = defaultOptions[k];\n newOptions[k] = options[k] != null ? options[k] : v;\n }\n return newOptions;\n },\n _changeLoadingHtml: function() {\n var loadingListener, removingListener;\n this._readyToShowLoadingHtml = false;\n loadingListener = () => {\n this._readyToShowLoadingHtml = true;\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-loading \", \"\");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, loadingListener);\n }\n if (this._loadingHtmlToDisplay.length > 0) {\n return this._changeLoadingHtml();\n }\n };\n removingListener = () => {\n this._loadingHtml.innerHTML = this._loadingHtmlToDisplay.shift();\n this._loadingHtml.className = this._loadingHtml.className.replace(\" pg-removing \", \" pg-loading \");\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.removeEventListener(transitionEvent, removingListener);\n return this._loadingHtml.addEventListener(transitionEvent, loadingListener);\n } else {\n return loadingListener();\n }\n };\n if (typeof transitionEvent !== \"undefined\" && transitionEvent !== null) {\n this._loadingHtml.className += \" pg-removing \";\n return this._loadingHtml.addEventListener(transitionEvent, removingListener);\n } else {\n return removingListener();\n }\n }\n});\n\nreturn {\n start: function(options = {}) {\n return _pleaseWait.load(options);\n },\n finish: function() {\n return _pleaseWait.done();\n },\n updateLoadingHtml: function(html) {\n return _pleaseWait.updateLoadingHtml(html);\n }\n};\n```", "response": "return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()\n\n removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()\n updateLoadingHtml: (html) -> _pleaseWait.updateLoadingHtml(html)\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 91, "line_end": 131} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:completion", "type": "completion", "prompt": "return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n _changeLoadingHtml: ->\n @_readyToShowLoadingHtml = false\n\n loadingListener = =>\n @_readyToShowLoadingHtml = true\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-loading \", \"\")\n if transitionEvent? then @_loadingHtml.removeEventListener(transitionEvent, loadingListener)\n if @_loadingHtmlToDisplay.length > 0 then @_changeLoadingHtml()", "response": "removingListener = =>\n @_loadingHtml.innerHTML = @_loadingHtmlToDisplay.shift()\n @_loadingHtml.className = @_loadingHtml.className.replace(\" pg-removing \", \" pg-loading \")\n if transitionEvent?\n @_loadingHtml.removeEventListener(transitionEvent, removingListener)\n @_loadingHtml.addEventListener(transitionEvent, loadingListener)\n else\n loadingListener()\n\n if transitionEvent?\n @_loadingHtml.className += \" pg-removing \"\n @_loadingHtml.addEventListener(transitionEvent, removingListener)\n else\n removingListener()\n\n return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()\n updateLoadingHtml: (html) -> _pleaseWait.updateLoadingHtml(html)\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "189d95b2c23eefe977465a3332b551ffa4fd58f3", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/189d95b2c23eefe977465a3332b551ffa4fd58f3/src/please-wait.coffee", "line_start": 91, "line_end": 131} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n message: null\n showEllipsis: true\n logo: null\n spinnerTemplate: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n

\n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 1, "line_end": 47} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n message: null\n showEllipsis: true\n logo: null\n spinnerTemplate: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n

\n

\n
\n
\n
\n
\n
\n \"\"\"\n```", "response": "(function(root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n factory(exports);\n } else if (typeof define === \"function\" && define.amd) {\n // AMD. Register as an anonymous module.\n define([\"exports\"], factory);\n } else {\n // Browser globals\n factory(root);\n }\n})(this, function(exports) {\n var PleaseWait;\n return PleaseWait = function() {\n var _pleaseWait, getTransitionEvent;\n getTransitionEvent = function() {\n var el, key, transitions, val;\n el = document.createElement('fakeelement');\n transitions = {\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd',\n 'animation': 'animationend'\n };\n for (key in transitions) {\n val = transitions[key];\n if (el.style[key] != null) {\n return val;\n }\n }\n };\n return _pleaseWait = {\n defaultOptions: {\n backgroundColor: null,\n message: null,\n showEllipsis: true,\n logo: null,\n spinnerTemplate: null,\n template: `
\n
\n
\n

\n \n

\n

\n

\n
\n
\n
\n
\n
`\n }\n };\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 1, "line_end": 47} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function(root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n factory(exports);\n } else if (typeof define === \"function\" && define.amd) {\n // AMD. Register as an anonymous module.\n define([\"exports\"], factory);\n } else {\n // Browser globals\n factory(root);\n }\n})(this, function(exports) {\n var PleaseWait;\n return PleaseWait = function() {\n var _pleaseWait, getTransitionEvent;\n getTransitionEvent = function() {\n var el, key, transitions, val;\n el = document.createElement('fakeelement');\n transitions = {\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd',\n 'animation': 'animationend'\n };\n for (key in transitions) {\n val = transitions[key];\n if (el.style[key] != null) {\n return val;\n }\n }\n };\n return _pleaseWait = {\n defaultOptions: {\n backgroundColor: null,\n message: null,\n showEllipsis: true,\n logo: null,\n spinnerTemplate: null,\n template: `
\n
\n
\n

\n \n

\n

\n

\n
\n
\n
\n
\n
`\n }\n };\n };\n});\n```", "response": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions\n return val if el.style[key]?\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n message: null\n showEllipsis: true\n logo: null\n spinnerTemplate: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n

\n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 1, "line_end": 47} +{"id": "Pathgather/please-wait:src/please-wait.coffee:1:completion", "type": "completion", "prompt": "((root, factory) ->\n if typeof exports is \"object\"\n # CommonJS\n factory exports\n else if typeof define is \"function\" and define.amd\n # AMD. Register as an anonymous module.\n define [\"exports\"], factory\n else\n # Browser globals\n factory root\n return\n) this, (exports) ->\n PleaseWait = ->\n getTransitionEvent = ->\n el = document.createElement('fakeelement')\n transitions =\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd'\n 'animation' : 'animationend'\n\n for key, val of transitions", "response": "return val if el.style[key]?\n\n _pleaseWait =\n defaultOptions:\n backgroundColor: null\n message: null\n showEllipsis: true\n logo: null\n spinnerTemplate: null\n template: \"\"\"\n
\n
\n
\n

\n \n

\n

\n

\n
\n
\n
\n
\n
\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 1, "line_end": 47} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "done: ->\n return unless @_loadingDiv?\n transitionEvent = getTransitionEvent()\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n load: (options = {}) ->\n @_options = @_createOptions(options)\n @_loadingDiv = document.createElement(\"header\")\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = @_options.backgroundColor if @_options.backgroundColor?\n @_loadingDiv.innerHTML = @_options.template\n spinnerDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-spinner\")[0]\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n messageDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-message\")[0]\n\n if logo?\n logo.src = @_options.logo\n\n if spinnerDiv?\n if @_options.spinnerTemplate?\n spinnerDiv.innerHTML = @_options.spinnerTemplate\n else\n spinnerDiv.style.display = 'none'\n\n if messageDiv?\n if @_options.message?\n messageDiv.innerHTML = if @_options.showEllipsis\n \"\"\"\n #{@_options.message}\n .\n .\n .\n \"\"\"\n else\n @_options.message\n else\n messageDiv.style.display = 'none'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 49, "line_end": 95} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndone: ->\n return unless @_loadingDiv?\n transitionEvent = getTransitionEvent()\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n load: (options = {}) ->\n @_options = @_createOptions(options)\n @_loadingDiv = document.createElement(\"header\")\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = @_options.backgroundColor if @_options.backgroundColor?\n @_loadingDiv.innerHTML = @_options.template\n spinnerDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-spinner\")[0]\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n messageDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-message\")[0]\n\n if logo?\n logo.src = @_options.logo\n\n if spinnerDiv?\n if @_options.spinnerTemplate?\n spinnerDiv.innerHTML = @_options.spinnerTemplate\n else\n spinnerDiv.style.display = 'none'\n\n if messageDiv?\n if @_options.message?\n messageDiv.innerHTML = if @_options.showEllipsis\n \"\"\"\n #{@_options.message}\n .\n .\n .\n \"\"\"\n else\n @_options.message\n else\n messageDiv.style.display = 'none'\n```", "response": "({\n done: function() {\n var listener, transitionEvent;\n if (this._loadingDiv == null) {\n return;\n }\n transitionEvent = getTransitionEvent();\n listener = () => {\n document.body.removeChild(this._loadingDiv);\n document.body.className += \" pg-loaded\";\n if (transitionEvent != null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n return this._loadingDiv = null;\n };\n if (transitionEvent != null) {\n this._loadingDiv.className += \" pg-loaded\";\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n load: function(options = {}) {\n var logo, messageDiv, spinnerDiv;\n this._options = this._createOptions(options);\n this._loadingDiv = document.createElement(\"header\");\n this._loadingDiv.className = \"pg-loading-screen\";\n if (this._options.backgroundColor != null) {\n this._loadingDiv.style.backgroundColor = this._options.backgroundColor;\n }\n this._loadingDiv.innerHTML = this._options.template;\n spinnerDiv = this._loadingDiv.getElementsByClassName(\"pg-loading-spinner\")[0];\n logo = this._loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0];\n messageDiv = this._loadingDiv.getElementsByClassName(\"pg-loading-message\")[0];\n if (logo != null) {\n logo.src = this._options.logo;\n }\n if (spinnerDiv != null) {\n if (this._options.spinnerTemplate != null) {\n spinnerDiv.innerHTML = this._options.spinnerTemplate;\n } else {\n spinnerDiv.style.display = 'none';\n }\n }\n if (messageDiv != null) {\n if (this._options.message != null) {\n return messageDiv.innerHTML = this._options.showEllipsis ? `${this._options.message}\n.\n.\n.` : this._options.message;\n } else {\n return messageDiv.style.display = 'none';\n }\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 49, "line_end": 95} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n done: function() {\n var listener, transitionEvent;\n if (this._loadingDiv == null) {\n return;\n }\n transitionEvent = getTransitionEvent();\n listener = () => {\n document.body.removeChild(this._loadingDiv);\n document.body.className += \" pg-loaded\";\n if (transitionEvent != null) {\n this._loadingDiv.removeEventListener(transitionEvent, listener);\n }\n return this._loadingDiv = null;\n };\n if (transitionEvent != null) {\n this._loadingDiv.className += \" pg-loaded\";\n return this._loadingDiv.addEventListener(transitionEvent, listener);\n } else {\n return listener();\n }\n },\n load: function(options = {}) {\n var logo, messageDiv, spinnerDiv;\n this._options = this._createOptions(options);\n this._loadingDiv = document.createElement(\"header\");\n this._loadingDiv.className = \"pg-loading-screen\";\n if (this._options.backgroundColor != null) {\n this._loadingDiv.style.backgroundColor = this._options.backgroundColor;\n }\n this._loadingDiv.innerHTML = this._options.template;\n spinnerDiv = this._loadingDiv.getElementsByClassName(\"pg-loading-spinner\")[0];\n logo = this._loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0];\n messageDiv = this._loadingDiv.getElementsByClassName(\"pg-loading-message\")[0];\n if (logo != null) {\n logo.src = this._options.logo;\n }\n if (spinnerDiv != null) {\n if (this._options.spinnerTemplate != null) {\n spinnerDiv.innerHTML = this._options.spinnerTemplate;\n } else {\n spinnerDiv.style.display = 'none';\n }\n }\n if (messageDiv != null) {\n if (this._options.message != null) {\n return messageDiv.innerHTML = this._options.showEllipsis ? `${this._options.message}\n.\n.\n.` : this._options.message;\n } else {\n return messageDiv.style.display = 'none';\n }\n }\n }\n});\n```", "response": "done: ->\n return unless @_loadingDiv?\n transitionEvent = getTransitionEvent()\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n load: (options = {}) ->\n @_options = @_createOptions(options)\n @_loadingDiv = document.createElement(\"header\")\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = @_options.backgroundColor if @_options.backgroundColor?\n @_loadingDiv.innerHTML = @_options.template\n spinnerDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-spinner\")[0]\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]\n messageDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-message\")[0]\n\n if logo?\n logo.src = @_options.logo\n\n if spinnerDiv?\n if @_options.spinnerTemplate?\n spinnerDiv.innerHTML = @_options.spinnerTemplate\n else\n spinnerDiv.style.display = 'none'\n\n if messageDiv?\n if @_options.message?\n messageDiv.innerHTML = if @_options.showEllipsis\n \"\"\"\n #{@_options.message}\n .\n .\n .\n \"\"\"\n else\n @_options.message\n else\n messageDiv.style.display = 'none'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 49, "line_end": 95} +{"id": "Pathgather/please-wait:src/please-wait.coffee:2:completion", "type": "completion", "prompt": "done: ->\n return unless @_loadingDiv?\n transitionEvent = getTransitionEvent()\n listener = =>\n document.body.removeChild(@_loadingDiv)\n document.body.className += \" pg-loaded\"\n if transitionEvent? then @_loadingDiv.removeEventListener(transitionEvent, listener)\n @_loadingDiv = null\n\n if transitionEvent?\n @_loadingDiv.className += \" pg-loaded\"\n @_loadingDiv.addEventListener(transitionEvent, listener)\n else\n listener()\n\n load: (options = {}) ->\n @_options = @_createOptions(options)\n @_loadingDiv = document.createElement(\"header\")\n @_loadingDiv.className = \"pg-loading-screen\"\n @_loadingDiv.style.backgroundColor = @_options.backgroundColor if @_options.backgroundColor?\n @_loadingDiv.innerHTML = @_options.template\n spinnerDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-spinner\")[0]\n logo = @_loadingDiv.getElementsByClassName(\"pg-loading-logo\")[0]", "response": "messageDiv = @_loadingDiv.getElementsByClassName(\"pg-loading-message\")[0]\n\n if logo?\n logo.src = @_options.logo\n\n if spinnerDiv?\n if @_options.spinnerTemplate?\n spinnerDiv.innerHTML = @_options.spinnerTemplate\n else\n spinnerDiv.style.display = 'none'\n\n if messageDiv?\n if @_options.message?\n messageDiv.innerHTML = if @_options.showEllipsis\n \"\"\"\n #{@_options.message}\n .\n .\n .\n \"\"\"\n else\n @_options.message\n else\n messageDiv.style.display = 'none'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 49, "line_end": 95} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions\n newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()\n }\n\n exports.pleaseWait = new PleaseWait()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 97, "line_end": 116} +{"id": "Pathgather/please-wait:src/please-wait.coffee:3:completion", "type": "completion", "prompt": "document.body.appendChild(@_loadingDiv)\n @_loadingDiv.className += \" pg-loading\"\n return @_loadingDiv\n\n _createOptions: (options = {}) ->\n defaultOptions = @defaultOptions\n newOptions = {}\n\n # Set options\n for k, v of defaultOptions", "response": "newOptions[k] = if options[k]? then options[k] else v\n\n newOptions\n\n return {\n start : (options = {}) -> _pleaseWait.load(options)\n finish : -> _pleaseWait.done()\n }\n\n exports.pleaseWait = new PleaseWait()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pathgather/please-wait", "path": "src/please-wait.coffee", "license": "MIT", "commit": "34cdadf989d209e8f622bc2880654c018ea5af8f", "stars": 1583, "source_url": "https://github.com/Pathgather/please-wait/blob/34cdadf989d209e8f622bc2880654c018ea5af8f/src/please-wait.coffee", "line_start": 97, "line_end": 116} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()\n # Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n R.findDOMNode(@).focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = R.findDOMNode(@)\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = R.findDOMNode(@)\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()\n # Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n R.findDOMNode(@).focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = R.findDOMNode(@)\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = R.findDOMNode(@)\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()\n```", "response": "var R, _;\n\n_ = require(\"underscore\");\n\nR = require(\"../R\");\n\nR.create(\"EditableText\", {\n propTypes: {\n value: String,\n setValue: Function\n },\n shouldComponentUpdate: function(nextProps) {\n return this._isDirty || nextProps.value !== this.props.value;\n },\n render: function() {\n var props;\n props = {\n contentEditable: true,\n onInput: this._onInput,\n onKeyDown: this._onKeyDown\n };\n _.defaults(props, this.props);\n return R.div(props);\n },\n componentDidMount: function() {\n this._refresh();\n // Autofocus if empty string value.\n if (this.props.value === \"\" || !this.props.value) {\n return R.findDOMNode(this).focus();\n }\n },\n componentDidUpdate: function() {\n return this._refresh();\n },\n _refresh: function() {\n var el;\n el = R.findDOMNode(this);\n if (el.textContent !== this.props.value) {\n el.textContent = this.props.value;\n }\n return this._isDirty = false;\n },\n _onInput: function() {\n var el, newValue;\n this._isDirty = true;\n el = R.findDOMNode(this);\n newValue = el.textContent;\n return this.props.setValue(newValue);\n },\n _onKeyDown: function(e) {\n if (e.keyCode === 13) { // Enter\n return e.preventDefault();\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar R, _;\n\n_ = require(\"underscore\");\n\nR = require(\"../R\");\n\nR.create(\"EditableText\", {\n propTypes: {\n value: String,\n setValue: Function\n },\n shouldComponentUpdate: function(nextProps) {\n return this._isDirty || nextProps.value !== this.props.value;\n },\n render: function() {\n var props;\n props = {\n contentEditable: true,\n onInput: this._onInput,\n onKeyDown: this._onKeyDown\n };\n _.defaults(props, this.props);\n return R.div(props);\n },\n componentDidMount: function() {\n this._refresh();\n // Autofocus if empty string value.\n if (this.props.value === \"\" || !this.props.value) {\n return R.findDOMNode(this).focus();\n }\n },\n componentDidUpdate: function() {\n return this._refresh();\n },\n _refresh: function() {\n var el;\n el = R.findDOMNode(this);\n if (el.textContent !== this.props.value) {\n el.textContent = this.props.value;\n }\n return this._isDirty = false;\n },\n _onInput: function() {\n var el, newValue;\n this._isDirty = true;\n el = R.findDOMNode(this);\n newValue = el.textContent;\n return this.props.setValue(newValue);\n },\n _onKeyDown: function(e) {\n if (e.keyCode === 13) { // Enter\n return e.preventDefault();\n }\n }\n});\n```", "response": "_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()\n # Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n R.findDOMNode(@).focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = R.findDOMNode(@)\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = R.findDOMNode(@)\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:completion", "type": "completion", "prompt": "_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()", "response": "# Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n R.findDOMNode(@).focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = R.findDOMNode(@)\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = R.findDOMNode(@)\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()\n # Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n @getDOMNode().focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = @getDOMNode()\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = @getDOMNode()\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "44bda500915b664456170b39144f1d5a40e73d24", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/44bda500915b664456170b39144f1d5a40e73d24/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()\n # Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n @getDOMNode().focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = @getDOMNode()\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = @getDOMNode()\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()\n```", "response": "var R, _;\n\n_ = require(\"underscore\");\n\nR = require(\"../R\");\n\nR.create(\"EditableText\", {\n propTypes: {\n value: String,\n setValue: Function\n },\n shouldComponentUpdate: function(nextProps) {\n return this._isDirty || nextProps.value !== this.props.value;\n },\n render: function() {\n var props;\n props = {\n contentEditable: true,\n onInput: this._onInput,\n onKeyDown: this._onKeyDown\n };\n _.defaults(props, this.props);\n return R.div(props);\n },\n componentDidMount: function() {\n this._refresh();\n // Autofocus if empty string value.\n if (this.props.value === \"\" || !this.props.value) {\n return this.getDOMNode().focus();\n }\n },\n componentDidUpdate: function() {\n return this._refresh();\n },\n _refresh: function() {\n var el;\n el = this.getDOMNode();\n if (el.textContent !== this.props.value) {\n el.textContent = this.props.value;\n }\n return this._isDirty = false;\n },\n _onInput: function() {\n var el, newValue;\n this._isDirty = true;\n el = this.getDOMNode();\n newValue = el.textContent;\n return this.props.setValue(newValue);\n },\n _onKeyDown: function(e) {\n if (e.keyCode === 13) { // Enter\n return e.preventDefault();\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "44bda500915b664456170b39144f1d5a40e73d24", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/44bda500915b664456170b39144f1d5a40e73d24/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar R, _;\n\n_ = require(\"underscore\");\n\nR = require(\"../R\");\n\nR.create(\"EditableText\", {\n propTypes: {\n value: String,\n setValue: Function\n },\n shouldComponentUpdate: function(nextProps) {\n return this._isDirty || nextProps.value !== this.props.value;\n },\n render: function() {\n var props;\n props = {\n contentEditable: true,\n onInput: this._onInput,\n onKeyDown: this._onKeyDown\n };\n _.defaults(props, this.props);\n return R.div(props);\n },\n componentDidMount: function() {\n this._refresh();\n // Autofocus if empty string value.\n if (this.props.value === \"\" || !this.props.value) {\n return this.getDOMNode().focus();\n }\n },\n componentDidUpdate: function() {\n return this._refresh();\n },\n _refresh: function() {\n var el;\n el = this.getDOMNode();\n if (el.textContent !== this.props.value) {\n el.textContent = this.props.value;\n }\n return this._isDirty = false;\n },\n _onInput: function() {\n var el, newValue;\n this._isDirty = true;\n el = this.getDOMNode();\n newValue = el.textContent;\n return this.props.setValue(newValue);\n },\n _onKeyDown: function(e) {\n if (e.keyCode === 13) { // Enter\n return e.preventDefault();\n }\n }\n});\n```", "response": "_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()\n # Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n @getDOMNode().focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = @getDOMNode()\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = @getDOMNode()\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "44bda500915b664456170b39144f1d5a40e73d24", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/44bda500915b664456170b39144f1d5a40e73d24/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "cdglabs/apparatus:src/View/Generic/EditableText.coffee:1:completion", "type": "completion", "prompt": "_ = require \"underscore\"\nR = require \"../R\"\n\nR.create \"EditableText\",\n propTypes:\n value: String\n setValue: Function\n\n shouldComponentUpdate: (nextProps) ->\n return @_isDirty or nextProps.value != @props.value\n\n render: ->\n props = {\n contentEditable: true\n onInput: @_onInput\n onKeyDown: @_onKeyDown\n }\n _.defaults(props, @props)\n R.div props\n\n componentDidMount: ->\n @_refresh()", "response": "# Autofocus if empty string value.\n if @props.value == \"\" or !@props.value\n @getDOMNode().focus()\n\n componentDidUpdate: ->\n @_refresh()\n\n _refresh: ->\n el = @getDOMNode()\n if el.textContent != @props.value\n el.textContent = @props.value\n @_isDirty = false\n\n _onInput: ->\n @_isDirty = true\n el = @getDOMNode()\n newValue = el.textContent\n @props.setValue(newValue)\n\n _onKeyDown: (e) ->\n if e.keyCode == 13 # Enter\n e.preventDefault()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/View/Generic/EditableText.coffee", "license": "MIT", "commit": "44bda500915b664456170b39144f1d5a40e73d24", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/44bda500915b664456170b39144f1d5a40e73d24/src/View/Generic/EditableText.coffee", "line_start": 1, "line_end": 44} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Parser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts), opts)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "873ab44f13a863c6783f3c90993541f1df6a0320", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/873ab44f13a863c6783f3c90993541f1df6a0320/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nParser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts), opts)\n```", "response": "var Parser, serialise;\n\nParser = require('./parser');\n\nserialise = require('./serialiser');\n\nmodule.exports.transform = function(code, opts) {\n return serialise(new Parser().parse(code, opts), opts);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "873ab44f13a863c6783f3c90993541f1df6a0320", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/873ab44f13a863c6783f3c90993541f1df6a0320/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Parser, serialise;\n\nParser = require('./parser');\n\nserialise = require('./serialiser');\n\nmodule.exports.transform = function(code, opts) {\n return serialise(new Parser().parse(code, opts), opts);\n};\n```", "response": "Parser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts), opts)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "873ab44f13a863c6783f3c90993541f1df6a0320", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/873ab44f13a863c6783f3c90993541f1df6a0320/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:completion", "type": "completion", "prompt": "Parser = require './parser'\nserialise = require './serialiser'", "response": "module.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts), opts)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "873ab44f13a863c6783f3c90993541f1df6a0320", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/873ab44f13a863c6783f3c90993541f1df6a0320/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Parser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts))", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "4db08bfaf81c7d4092ea28342aa77de042dba7e9", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/4db08bfaf81c7d4092ea28342aa77de042dba7e9/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nParser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts))\n```", "response": "var Parser, serialise;\n\nParser = require('./parser');\n\nserialise = require('./serialiser');\n\nmodule.exports.transform = function(code, opts) {\n return serialise(new Parser().parse(code, opts));\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "4db08bfaf81c7d4092ea28342aa77de042dba7e9", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/4db08bfaf81c7d4092ea28342aa77de042dba7e9/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Parser, serialise;\n\nParser = require('./parser');\n\nserialise = require('./serialiser');\n\nmodule.exports.transform = function(code, opts) {\n return serialise(new Parser().parse(code, opts));\n};\n```", "response": "Parser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts))", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "4db08bfaf81c7d4092ea28342aa77de042dba7e9", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/4db08bfaf81c7d4092ea28342aa77de042dba7e9/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:completion", "type": "completion", "prompt": "Parser = require './parser'\nserialise = require './serialiser'", "response": "module.exports.transform = (code, opts) ->\n serialise(new Parser().parse(code, opts))", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "4db08bfaf81c7d4092ea28342aa77de042dba7e9", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/4db08bfaf81c7d4092ea28342aa77de042dba7e9/src/transformer.coffee", "line_start": 1, "line_end": 5} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Import the helpers we need.\n{count, starts, compact, last, repeat,\nlocationDataToString, throwSyntaxError} = require './helpers'\n\nParser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise new Parser().parse code, opts", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "054a384873f9ee6dd7e20ef83b98e9899a042718", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/054a384873f9ee6dd7e20ef83b98e9899a042718/src/transformer.coffee", "line_start": 1, "line_end": 9} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Import the helpers we need.\n{count, starts, compact, last, repeat,\nlocationDataToString, throwSyntaxError} = require './helpers'\n\nParser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise new Parser().parse code, opts\n```", "response": "// Import the helpers we need.\nvar Parser, compact, count, last, locationDataToString, repeat, serialise, starts, throwSyntaxError;\n\n({count, starts, compact, last, repeat, locationDataToString, throwSyntaxError} = require('./helpers'));\n\nParser = require('./parser');\n\nserialise = require('./serialiser');\n\nmodule.exports.transform = function(code, opts) {\n return serialise(new Parser().parse(code, opts));\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "054a384873f9ee6dd7e20ef83b98e9899a042718", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/054a384873f9ee6dd7e20ef83b98e9899a042718/src/transformer.coffee", "line_start": 1, "line_end": 9} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Import the helpers we need.\nvar Parser, compact, count, last, locationDataToString, repeat, serialise, starts, throwSyntaxError;\n\n({count, starts, compact, last, repeat, locationDataToString, throwSyntaxError} = require('./helpers'));\n\nParser = require('./parser');\n\nserialise = require('./serialiser');\n\nmodule.exports.transform = function(code, opts) {\n return serialise(new Parser().parse(code, opts));\n};\n```", "response": "# Import the helpers we need.\n{count, starts, compact, last, repeat,\nlocationDataToString, throwSyntaxError} = require './helpers'\n\nParser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise new Parser().parse code, opts", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "054a384873f9ee6dd7e20ef83b98e9899a042718", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/054a384873f9ee6dd7e20ef83b98e9899a042718/src/transformer.coffee", "line_start": 1, "line_end": 9} +{"id": "jsdf/coffee-react-transform:src/transformer.coffee:1:completion", "type": "completion", "prompt": "# Import the helpers we need.\n{count, starts, compact, last, repeat,\nlocationDataToString, throwSyntaxError} = require './helpers'", "response": "Parser = require './parser'\nserialise = require './serialiser'\n\nmodule.exports.transform = (code, opts) ->\n serialise new Parser().parse code, opts", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jsdf/coffee-react-transform", "path": "src/transformer.coffee", "license": "MIT", "commit": "054a384873f9ee6dd7e20ef83b98e9899a042718", "stars": 431, "source_url": "https://github.com/jsdf/coffee-react-transform/blob/054a384873f9ee6dd7e20ef83b98e9899a042718/src/transformer.coffee", "line_start": 1, "line_end": 9} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|`|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'`\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|`|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'`\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|`|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'`\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, j, len, len1, res, v, variableNamesWithPrefix, variableNamesWithoutPrefix, withPrefixes, withoutPrefixes;\n variableNamesWithPrefix = [];\n variableNamesWithoutPrefix = [];\n withPrefixes = variables.filter(function(v) {\n return !v.noNamePrefix;\n });\n withoutPrefixes = variables.filter(function(v) {\n return v.noNamePrefix;\n });\n res = [];\n if (withPrefixes.length > 0) {\n for (i = 0, len = withPrefixes.length; i < len; i++) {\n v = withPrefixes[i];\n variableNamesWithPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`((?:${namePrefixes})(${variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))`);\n }\n if (withoutPrefixes.length > 0) {\n for (j = 0, len1 = withoutPrefixes.length; j < len1; j++) {\n v = withoutPrefixes[j];\n variableNamesWithoutPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`(${variableNamesWithoutPrefix.join('|')})`);\n }\n return res.join('|');\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|`|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'`\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, j, len, len1, res, v, variableNamesWithPrefix, variableNamesWithoutPrefix, withPrefixes, withoutPrefixes;\n variableNamesWithPrefix = [];\n variableNamesWithoutPrefix = [];\n withPrefixes = variables.filter(function(v) {\n return !v.noNamePrefix;\n });\n withoutPrefixes = variables.filter(function(v) {\n return v.noNamePrefix;\n });\n res = [];\n if (withPrefixes.length > 0) {\n for (i = 0, len = withPrefixes.length; i < len; i++) {\n v = withPrefixes[i];\n variableNamesWithPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`((?:${namePrefixes})(${variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))`);\n }\n if (withoutPrefixes.length > 0) {\n for (j = 0, len1 = withoutPrefixes.length; j < len1; j++) {\n v = withoutPrefixes[j];\n variableNamesWithoutPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`(${variableNamesWithoutPrefix.join('|')})`);\n }\n return res.join('|');\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|`|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'`\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|`|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'`\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes", "response": "createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "fccbdeb8e6b926940f667b37d9d593f158261d10", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/fccbdeb8e6b926940f667b37d9d593f158261d10/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, j, len, len1, res, v, variableNamesWithPrefix, variableNamesWithoutPrefix, withPrefixes, withoutPrefixes;\n variableNamesWithPrefix = [];\n variableNamesWithoutPrefix = [];\n withPrefixes = variables.filter(function(v) {\n return !v.noNamePrefix;\n });\n withoutPrefixes = variables.filter(function(v) {\n return v.noNamePrefix;\n });\n res = [];\n if (withPrefixes.length > 0) {\n for (i = 0, len = withPrefixes.length; i < len; i++) {\n v = withPrefixes[i];\n variableNamesWithPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`((?:${namePrefixes})(${variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))`);\n }\n if (withoutPrefixes.length > 0) {\n for (j = 0, len1 = withoutPrefixes.length; j < len1; j++) {\n v = withoutPrefixes[j];\n variableNamesWithoutPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`(${variableNamesWithoutPrefix.join('|')})`);\n }\n return res.join('|');\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "fccbdeb8e6b926940f667b37d9d593f158261d10", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/fccbdeb8e6b926940f667b37d9d593f158261d10/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, j, len, len1, res, v, variableNamesWithPrefix, variableNamesWithoutPrefix, withPrefixes, withoutPrefixes;\n variableNamesWithPrefix = [];\n variableNamesWithoutPrefix = [];\n withPrefixes = variables.filter(function(v) {\n return !v.noNamePrefix;\n });\n withoutPrefixes = variables.filter(function(v) {\n return v.noNamePrefix;\n });\n res = [];\n if (withPrefixes.length > 0) {\n for (i = 0, len = withPrefixes.length; i < len; i++) {\n v = withPrefixes[i];\n variableNamesWithPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`((?:${namePrefixes})(${variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))`);\n }\n if (withoutPrefixes.length > 0) {\n for (j = 0, len1 = withoutPrefixes.length; j < len1; j++) {\n v = withoutPrefixes[j];\n variableNamesWithoutPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n res.push(`(${variableNamesWithoutPrefix.join('|')})`);\n }\n return res.join('|');\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "fccbdeb8e6b926940f667b37d9d593f158261d10", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/fccbdeb8e6b926940f667b37d9d593f158261d10/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes", "response": "createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n res = []\n\n if withPrefixes.length > 0\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))\"\n\n if withoutPrefixes.length > 0\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n res.push \"(#{variableNamesWithoutPrefix.join('|')})\"\n\n res.join('|')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "fccbdeb8e6b926940f667b37d9d593f158261d10", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/fccbdeb8e6b926940f667b37d9d593f158261d10/lib/regexes.coffee", "line_start": 1, "line_end": 42} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))|(#{variableNamesWithoutPrefix.join('|')})\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "a2ae863f0bee366d797cc98fa97a8c378aed688e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/a2ae863f0bee366d797cc98fa97a8c378aed688e/lib/regexes.coffee", "line_start": 1, "line_end": 34} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))|(#{variableNamesWithoutPrefix.join('|')})\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, j, len, len1, v, variableNamesWithPrefix, variableNamesWithoutPrefix, withPrefixes, withoutPrefixes;\n variableNamesWithPrefix = [];\n variableNamesWithoutPrefix = [];\n withPrefixes = variables.filter(function(v) {\n return !v.noNamePrefix;\n });\n withoutPrefixes = variables.filter(function(v) {\n return v.noNamePrefix;\n });\n for (i = 0, len = withPrefixes.length; i < len; i++) {\n v = withPrefixes[i];\n variableNamesWithPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n for (j = 0, len1 = withoutPrefixes.length; j < len1; j++) {\n v = withoutPrefixes[j];\n variableNamesWithoutPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n return `((?:${namePrefixes})(${variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))|(${variableNamesWithoutPrefix.join('|')})`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "a2ae863f0bee366d797cc98fa97a8c378aed688e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/a2ae863f0bee366d797cc98fa97a8c378aed688e/lib/regexes.coffee", "line_start": 1, "line_end": 34} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, j, len, len1, v, variableNamesWithPrefix, variableNamesWithoutPrefix, withPrefixes, withoutPrefixes;\n variableNamesWithPrefix = [];\n variableNamesWithoutPrefix = [];\n withPrefixes = variables.filter(function(v) {\n return !v.noNamePrefix;\n });\n withoutPrefixes = variables.filter(function(v) {\n return v.noNamePrefix;\n });\n for (i = 0, len = withPrefixes.length; i < len; i++) {\n v = withPrefixes[i];\n variableNamesWithPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n for (j = 0, len1 = withoutPrefixes.length; j < len1; j++) {\n v = withoutPrefixes[j];\n variableNamesWithoutPrefix.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n return `((?:${namePrefixes})(${variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))|(${variableNamesWithoutPrefix.join('|')})`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))|(#{variableNamesWithoutPrefix.join('|')})\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "a2ae863f0bee366d797cc98fa97a8c378aed688e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/a2ae863f0bee366d797cc98fa97a8c378aed688e/lib/regexes.coffee", "line_start": 1, "line_end": 34} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'", "response": "ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNamesWithPrefix = []\n variableNamesWithoutPrefix = []\n withPrefixes = variables.filter (v) -> not v.noNamePrefix\n withoutPrefixes = variables.filter (v) -> v.noNamePrefix\n\n for v in withPrefixes\n variableNamesWithPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n for v in withoutPrefixes\n variableNamesWithoutPrefix.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n\n \"((?:#{namePrefixes})(#{variableNamesWithPrefix.join('|')})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=]))|(#{variableNamesWithoutPrefix.join('|')})\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "a2ae863f0bee366d797cc98fa97a8c378aed688e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/a2ae863f0bee366d797cc98fa97a8c378aed688e/lib/regexes.coffee", "line_start": 1, "line_end": 34} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{|>'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"", "response": "comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/941fc7a34f1fb3a5072defb3a5f7b04b0a3dcf97/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "7a735c05386dd147bcd190b93744397602e9b9c0", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/7a735c05386dd147bcd190b93744397602e9b9c0/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "7a735c05386dd147bcd190b93744397602e9b9c0", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/7a735c05386dd147bcd190b93744397602e9b9c0/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "7a735c05386dd147bcd190b93744397602e9b9c0", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/7a735c05386dd147bcd190b93744397602e9b9c0/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"", "response": "comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(\\\\s+!default)?(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "7a735c05386dd147bcd190b93744397602e9b9c0", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/7a735c05386dd147bcd190b93744397602e9b9c0/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "07117e1fe1c5215bc921085dd516ce72d6af6604", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/07117e1fe1c5215bc921085dd516ce72d6af6604/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "07117e1fe1c5215bc921085dd516ce72d6af6604", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/07117e1fe1c5215bc921085dd516ce72d6af6604/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n\\\\r]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "07117e1fe1c5215bc921085dd516ce72d6af6604", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/07117e1fe1c5215bc921085dd516ce72d6af6604/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"", "response": "comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n\\\\r]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "07117e1fe1c5215bc921085dd516ce72d6af6604", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/07117e1fe1c5215bc921085dd516ce72d6af6604/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "114b772bf26b5217ff66cca1b42978fbca3a0fba", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/114b772bf26b5217ff66cca1b42978fbca3a0fba/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "114b772bf26b5217ff66cca1b42978fbca3a0fba", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/114b772bf26b5217ff66cca1b42978fbca3a0fba/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "114b772bf26b5217ff66cca1b42978fbca3a0fba", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/114b772bf26b5217ff66cca1b42978fbca3a0fba/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |\\\\t|:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"", "response": "comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "114b772bf26b5217ff66cca1b42978fbca3a0fba", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/114b772bf26b5217ff66cca1b42978fbca3a0fba/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "75b059e09045bf7e060c3f9791dd7d98a44df133", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/75b059e09045bf7e060c3f9791dd7d98a44df133/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "75b059e09045bf7e060c3f9791dd7d98a44df133", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/75b059e09045bf7e060c3f9791dd7d98a44df133/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}${decimal}|${int}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "75b059e09045bf7e060c3f9791dd7d98a44df133", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/75b059e09045bf7e060c3f9791dd7d98a44df133/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}#{decimal}|#{int}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"", "response": "comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "75b059e09045bf7e060c3f9791dd7d98a44df133", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/75b059e09045bf7e060c3f9791dd7d98a44df133/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6f47fab8df7e559308590a1e6fbed46a70251418", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6f47fab8df7e559308590a1e6fbed46a70251418/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}|${int}${decimal}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6f47fab8df7e559308590a1e6fbed46a70251418", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6f47fab8df7e559308590a1e6fbed46a70251418/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}|${int}${decimal}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(?:${percent}|${int})`,\n floatOrPercent: `(?:${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(?:${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6f47fab8df7e559308590a1e6fbed46a70251418", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6f47fab8df7e559308590a1e6fbed46a70251418/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(?:@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(?:#{percent}|#{int})\"\n floatOrPercent: \"(?:#{percent}|#{float})\"", "response": "comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(?:#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6f47fab8df7e559308590a1e6fbed46a70251418", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6f47fab8df7e559308590a1e6fbed46a70251418/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(#{percent}|#{int})\"\n floatOrPercent: \"(#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nint = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(#{percent}|#{int})\"\n floatOrPercent: \"(#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"\n```", "response": "var decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}|${int}${decimal}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(${percent}|${int})`,\n floatOrPercent: `(${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar decimal, float, int, namePrefixes, percent, variables;\n\nint = '\\\\d+';\n\ndecimal = `\\\\.${int}`;\n\nfloat = `(?:${int}|${int}${decimal}|${decimal})`;\n\npercent = `${float}%`;\n\nvariables = '(@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)';\n\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{';\n\nmodule.exports = {\n int: int,\n float: float,\n percent: percent,\n optionalPercent: `${float}%?`,\n intOrPercent: `(${percent}|${int})`,\n floatOrPercent: `(${percent}|${float})`,\n comma: '\\\\s*,\\\\s*',\n notQuote: \"[^\\\"'\\\\n]+\",\n hexadecimal: '[\\\\da-fA-F]',\n ps: '\\\\(\\\\s*',\n pe: '\\\\s*\\\\)',\n variables: variables,\n namePrefixes: namePrefixes,\n createVariableRegExpString: function(variables) {\n var i, len, v, variableNames;\n variableNames = [];\n for (i = 0, len = variables.length; i < len; i++) {\n v = variables[i];\n variableNames.push(v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"));\n }\n variableNames = variableNames.join('|');\n return `(${namePrefixes})(${variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])`;\n }\n};\n```", "response": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(#{percent}|#{int})\"\n floatOrPercent: \"(#{percent}|#{float})\"\n comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "abe33/atom-pigments:lib/regexes.coffee:1:completion", "type": "completion", "prompt": "int = '\\\\d+'\ndecimal = \"\\\\.#{int}\"\nfloat = \"(?:#{int}|#{int}#{decimal}|#{decimal})\"\npercent = \"#{float}%\"\nvariables = '(@[a-zA-Z0-9\\\\-_]+|\\\\$[a-zA-Z0-9\\\\-_]+|[a-zA-Z_][a-zA-Z0-9\\\\-_]*)'\nnamePrefixes = '^| |:|=|,|\\\\n|\\'|\"|\\\\(|\\\\[|\\\\{'\n\nmodule.exports =\n int: int\n float: float\n percent: percent\n optionalPercent: \"#{float}%?\"\n intOrPercent: \"(#{percent}|#{int})\"\n floatOrPercent: \"(#{percent}|#{float})\"", "response": "comma: '\\\\s*,\\\\s*'\n notQuote: \"[^\\\"'\\\\n]+\"\n hexadecimal: '[\\\\da-fA-F]'\n ps: '\\\\(\\\\s*'\n pe: '\\\\s*\\\\)'\n variables: variables\n namePrefixes: namePrefixes\n createVariableRegExpString: (variables) ->\n variableNames = []\n for v in variables\n variableNames.push v.name.replace(/[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\")\n variableNames = variableNames.join('|')\n\n \"(#{namePrefixes})(#{variableNames})(?!_|-|\\\\w|\\\\d|[ \\\\t]*[\\\\.:=])\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/regexes.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/regexes.coffee", "line_start": 1, "line_end": 28} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) ->\n Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) ->\n Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection\n```", "response": "Houston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n changed: function(document) {\n return Houston._collections.collections.update({name}, {\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n changed: function(document) {\n return Houston._collections.collections.update({name}, {\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};\n```", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) ->\n Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "response": "collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) ->\n Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n Houston._admins.insert {exists: true}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n unless Houston._user_is_admin @userId\n return Houston._admins.find {exists: true}\n return Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n if Houston._admins.find().count() > 0 and !Houston._admins.findOne({exists: true})\n Houston._admins.insert {exists: true}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 49, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n Houston._admins.insert {exists: true}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n unless Houston._user_is_admin @userId\n return Houston._admins.find {exists: true}\n return Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n if Houston._admins.find().count() > 0 and !Houston._admins.findOne({exists: true})\n Houston._admins.insert {exists: true}\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, collection, collections, i, len, mongo_driver, ref, ref1;\n Houston._admins.findOne(); // TODO Why is this here?\n collections = {};\n ref1 = (ref = Mongo.Collection.getAll()) != null ? ref : [];\n for (i = 0, len = ref1.length; i < len; i++) {\n collection = ref1[i];\n collections[collection.name] = collection.instance;\n }\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var j, len1, results;\n results = [];\n for (j = 0, len1 = collections_db.length; j < len1; j++) {\n col = collections_db[j];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n if (collections[name] != null) {\n return Houston._setup_collection(collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n Houston._admins.insert({\n exists: true\n });\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n exists: true\n });\n }\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n sync_collections();\n if (Houston._admins.find().count() > 0 && !Houston._admins.findOne({\n exists: true\n })) {\n return Houston._admins.insert({\n exists: true\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 49, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, collection, collections, i, len, mongo_driver, ref, ref1;\n Houston._admins.findOne(); // TODO Why is this here?\n collections = {};\n ref1 = (ref = Mongo.Collection.getAll()) != null ? ref : [];\n for (i = 0, len = ref1.length; i < len; i++) {\n collection = ref1[i];\n collections[collection.name] = collection.instance;\n }\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var j, len1, results;\n results = [];\n for (j = 0, len1 = collections_db.length; j < len1; j++) {\n col = collections_db[j];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n if (collections[name] != null) {\n return Houston._setup_collection(collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n Houston._admins.insert({\n exists: true\n });\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n exists: true\n });\n }\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n sync_collections();\n if (Houston._admins.find().count() > 0 && !Houston._admins.findOne({\n exists: true\n })) {\n return Houston._admins.insert({\n exists: true\n });\n }\n});\n```", "response": "sync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n Houston._admins.insert {exists: true}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n unless Houston._user_is_admin @userId\n return Houston._admins.find {exists: true}\n return Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n if Houston._admins.find().count() > 0 and !Houston._admins.findOne({exists: true})\n Houston._admins.insert {exists: true}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 49, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->", "response": "check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n Houston._admins.insert {exists: true}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n unless Houston._user_is_admin @userId\n return Houston._admins.find {exists: true}\n return Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n if Houston._admins.find().count() > 0 and !Houston._admins.findOne({exists: true})\n Houston._admins.insert {exists: true}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/server/publications.coffee", "line_start": 49, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, collection, collections, i, len, mongo_driver, ref, ref1;\n Houston._admins.findOne(); // TODO Why is this here?\n collections = {};\n ref1 = (ref = Mongo.Collection.getAll()) != null ? ref : [];\n for (i = 0, len = ref1.length; i < len; i++) {\n collection = ref1[i];\n collections[collection.name] = collection.instance;\n }\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var j, len1, results;\n results = [];\n for (j = 0, len1 = collections_db.length; j < len1; j++) {\n col = collections_db[j];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n if (collections[name] != null) {\n return Houston._setup_collection(collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, collection, collections, i, len, mongo_driver, ref, ref1;\n Houston._admins.findOne(); // TODO Why is this here?\n collections = {};\n ref1 = (ref = Mongo.Collection.getAll()) != null ? ref : [];\n for (i = 0, len = ref1.length; i < len; i++) {\n collection = ref1[i];\n collections[collection.name] = collection.instance;\n }\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var j, len1, results;\n results = [];\n for (j = 0, len1 = collections_db.length; j < len1; j++) {\n col = collections_db[j];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n if (collections[name] != null) {\n return Houston._setup_collection(collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "sync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Houston._admins.findOne() # TODO Why is this here?\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections", "response": "Meteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a01e5b4c1464c7b33b31fe1be6bec43e22dd3f8d/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Houston._admins.findOne()\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Houston._admins.findOne()\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, collection, collections, i, len, mongo_driver, ref, ref1;\n Houston._admins.findOne();\n collections = {};\n ref1 = (ref = Mongo.Collection.getAll()) != null ? ref : [];\n for (i = 0, len = ref1.length; i < len; i++) {\n collection = ref1[i];\n collections[collection.name] = collection.instance;\n }\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var j, len1, results;\n results = [];\n for (j = 0, len1 = collections_db.length; j < len1; j++) {\n col = collections_db[j];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n if (collections[name] != null) {\n return Houston._setup_collection(collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, collection, collections, i, len, mongo_driver, ref, ref1;\n Houston._admins.findOne();\n collections = {};\n ref1 = (ref = Mongo.Collection.getAll()) != null ? ref : [];\n for (i = 0, len = ref1.length; i < len; i++) {\n collection = ref1[i];\n collections[collection.name] = collection.instance;\n }\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var j, len1, results;\n results = [];\n for (j = 0, len1 = collections_db.length; j < len1; j++) {\n col = collections_db[j];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n if (collections[name] != null) {\n return Houston._setup_collection(collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "sync_collections = ->\n Houston._admins.findOne()\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Houston._admins.findOne()\n\n collections = {}\n for collection in (Mongo.Collection.getAll() ? [])\n collections[collection.name] = collection.instance\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n Houston._setup_collection(collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections", "response": "Meteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f0e3d957d8dbc2f1796c5570b8ea7a9f6fdf5397/server/publications.coffee", "line_start": 49, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9e66f6adc9e835faa3d14c77409147d1393dabc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9e66f6adc9e835faa3d14c77409147d1393dabc/server/publications.coffee", "line_start": 9, "line_end": 46} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection\n```", "response": "Houston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n changed: function(document) {\n return Houston._collections.collections.update({name}, {\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9e66f6adc9e835faa3d14c77409147d1393dabc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9e66f6adc9e835faa3d14c77409147d1393dabc/server/publications.coffee", "line_start": 9, "line_end": 46} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n changed: function(document) {\n return Houston._collections.collections.update({name}, {\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};\n```", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9e66f6adc9e835faa3d14c77409147d1393dabc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9e66f6adc9e835faa3d14c77409147d1393dabc/server/publications.coffee", "line_start": 9, "line_end": 46} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "response": "collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9e66f6adc9e835faa3d14c77409147d1393dabc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9e66f6adc9e835faa3d14c77409147d1393dabc/server/publications.coffee", "line_start": 9, "line_end": 46} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n console.log(name)\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "64a267beba7d744420fae3663cff272f38247bc7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/64a267beba7d744420fae3663cff272f38247bc7/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n console.log(name)\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection\n```", "response": "Houston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n console.log(name);\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n changed: function(document) {\n return Houston._collections.collections.update({name}, {\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "64a267beba7d744420fae3663cff272f38247bc7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/64a267beba7d744420fae3663cff272f38247bc7/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n console.log(name);\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n changed: function(document) {\n return Houston._collections.collections.update({name}, {\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};\n```", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n console.log(name)\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "64a267beba7d744420fae3663cff272f38247bc7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/64a267beba7d744420fae3663cff272f38247bc7/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n console.log(name)\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "response": "collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n changed: (document) ->\n Houston._collections.collections.update {name},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "64a267beba7d744420fae3663cff272f38247bc7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/64a267beba7d744420fae3663cff272f38247bc7/server/publications.coffee", "line_start": 9, "line_end": 47} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 48, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Houston._admins.findOne();\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 48, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Houston._admins.findOne();\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n return Houston._collections.collections.find();\n});\n```", "response": "sync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 48, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or", "response": "(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n unless Houston._user_is_admin @userId\n @ready()\n return\n Houston._collections.collections.find()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 48, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 98, "line_end": 104} +{"id": "gterrono/houston:server/publications.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 98, "line_end": 104} +{"id": "gterrono/houston:server/publications.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 98, "line_end": 104} +{"id": "gterrono/houston:server/publications.coffee:4:completion", "type": "completion", "prompt": "# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}", "response": "Meteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "beb31b46dbf5811b883e4ff25270b73ea67bbfa8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/beb31b46dbf5811b883e4ff25270b73ea67bbfa8/server/publications.coffee", "line_start": 98, "line_end": 104} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "2183bc16871b6de4df0dbe0c6ab1eb09be6e531a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2183bc16871b6de4df0dbe0c6ab1eb09be6e531a/server/publications.coffee", "line_start": 9, "line_end": 43} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection\n```", "response": "Houston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "2183bc16871b6de4df0dbe0c6ab1eb09be6e531a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2183bc16871b6de4df0dbe0c6ab1eb09be6e531a/server/publications.coffee", "line_start": 9, "line_end": 43} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n this.ready();\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};\n```", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "2183bc16871b6de4df0dbe0c6ab1eb09be6e531a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2183bc16871b6de4df0dbe0c6ab1eb09be6e531a/server/publications.coffee", "line_start": 9, "line_end": 43} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n unless Houston._user_is_admin @userId\n @ready()\n return\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e", "response": "console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "2183bc16871b6de4df0dbe0c6ab1eb09be6e531a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2183bc16871b6de4df0dbe0c6ab1eb09be6e531a/server/publications.coffee", "line_start": 9, "line_end": 43} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9eb40369d9b923cf0ebb33f504697ead89954ea0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9eb40369d9b923cf0ebb33f504697ead89954ea0/server/publications.coffee", "line_start": 9, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n```", "response": "Houston._setup_collection = function(collection) {\n var methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n check(doc, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n check(id, Match.Any);\n check(update_dict, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id) {\n check(id, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n return collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9eb40369d9b923cf0ebb33f504697ead89954ea0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9eb40369d9b923cf0ebb33f504697ead89954ea0/server/publications.coffee", "line_start": 9, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n check(doc, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n check(id, Match.Any);\n check(update_dict, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id) {\n check(id, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n return collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9eb40369d9b923cf0ebb33f504697ead89954ea0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9eb40369d9b923cf0ebb33f504697ead89954ea0/server/publications.coffee", "line_start": 9, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)", "response": "collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9eb40369d9b923cf0ebb33f504697ead89954ea0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9eb40369d9b923cf0ebb33f504697ead89954ea0/server/publications.coffee", "line_start": 9, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9eb40369d9b923cf0ebb33f504697ead89954ea0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9eb40369d9b923cf0ebb33f504697ead89954ea0/server/publications.coffee", "line_start": 59, "line_end": 66} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c", "response": "Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9eb40369d9b923cf0ebb33f504697ead89954ea0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9eb40369d9b923cf0ebb33f504697ead89954ea0/server/publications.coffee", "line_start": 59, "line_end": 66} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 9, "line_end": 41} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection\n```", "response": "Houston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 9, "line_end": 41} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, count, fields, name;\n name = collection._name;\n if (name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};\n```", "response": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 9, "line_end": 41} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n name = collection._name\n return if name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "response": "collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 9, "line_end": 41} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 43, "line_end": 92} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Houston._admins.findOne();\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 43, "line_end": 92} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Houston._admins.findOne();\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\n```", "response": "sync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 43, "line_end": 92} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Houston._admins.findOne()\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or", "response": "(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 43, "line_end": 92} +{"id": "gterrono/houston:server/publications.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 93, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "Houston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 93, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "Houston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 93, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:4:completion", "type": "completion", "prompt": "Houston._publish 'admin_user', ->\n Houston._admins.find {}", "response": "Meteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b4a46e43f3ed061be17c56c577d6f5ba73995bc6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b4a46e43f3ed061be17c56c577d6f5ba73995bc6/server/publications.coffee", "line_start": 93, "line_end": 97} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8d5f8c9307a1af844b98e36909ac06d444a87c4a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8d5f8c9307a1af844b98e36909ac06d444a87c4a/server/publications.coffee", "line_start": 9, "line_end": 40} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection\n```", "response": "Houston._setup_collection = function(collection) {\n var c, count, fields;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8d5f8c9307a1af844b98e36909ac06d444a87c4a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8d5f8c9307a1af844b98e36909ac06d444a87c4a/server/publications.coffee", "line_start": 9, "line_end": 40} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, count, fields;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n Houston._setup_collection_methods(collection);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n _suppress_initial: true, // fixes houston for large initial datasets\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_fields_from_collection(collection);\n c = Houston._collections.collections.findOne({name});\n count = collection.find().count();\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {count, fields}\n });\n } else {\n Houston._collections.collections.insert({name, count, fields});\n }\n return ADDED_COLLECTIONS[name] = collection;\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8d5f8c9307a1af844b98e36909ac06d444a87c4a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8d5f8c9307a1af844b98e36909ac06d444a87c4a/server/publications.coffee", "line_start": 9, "line_end": 40} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n Houston._setup_collection_methods(collection)\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "response": "collection.find().observe\n _suppress_initial: true # fixes houston for large initial datasets\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields_from_collection(collection)\n c = Houston._collections.collections.findOne {name}\n count = collection.find().count()\n if c\n Houston._collections.collections.update c._id, {$set: {count, fields}}\n else\n Houston._collections.collections.insert {name, count, fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8d5f8c9307a1af844b98e36909ac06d444a87c4a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8d5f8c9307a1af844b98e36909ac06d444a87c4a/server/publications.coffee", "line_start": 9, "line_end": 40} +{"id": "gterrono/houston:server/publications.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "41c5fcf9d8f42ed9b8d338372cae2031a88e95b6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/41c5fcf9d8f42ed9b8d338372cae2031a88e95b6/server/publications.coffee", "line_start": 70, "line_end": 119} +{"id": "gterrono/houston:server/publications.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "41c5fcf9d8f42ed9b8d338372cae2031a88e95b6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/41c5fcf9d8f42ed9b8d338372cae2031a88e95b6/server/publications.coffee", "line_start": 70, "line_end": 119} +{"id": "gterrono/houston:server/publications.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in Houston._HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "41c5fcf9d8f42ed9b8d338372cae2031a88e95b6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/41c5fcf9d8f42ed9b8d338372cae2031a88e95b6/server/publications.coffee", "line_start": 70, "line_end": 119} +{"id": "gterrono/houston:server/publications.coffee:4:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of Houston._HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or", "response": "(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "41c5fcf9d8f42ed9b8d338372cae2031a88e95b6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/41c5fcf9d8f42ed9b8d338372cae2031a88e95b6/server/publications.coffee", "line_start": 70, "line_end": 119} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields(collection.find().fetch())", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "610792505b6af1a34d4e0a3f846df923f114d531", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/610792505b6af1a34d4e0a3f846df923f114d531/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields(collection.find().fetch())\n```", "response": "Houston._setup_collection = function(collection) {\n var fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n check(doc, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n check(id, Match.Any);\n check(update_dict, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id) {\n check(id, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n return fields = Houston._get_fields(collection.find().fetch());\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "610792505b6af1a34d4e0a3f846df923f114d531", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/610792505b6af1a34d4e0a3f846df923f114d531/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n check(doc, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n check(id, Match.Any);\n check(update_dict, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id) {\n check(id, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_fields([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n return fields = Houston._get_fields(collection.find().fetch());\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields(collection.find().fetch())", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "610792505b6af1a34d4e0a3f846df923f114d531", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/610792505b6af1a34d4e0a3f846df923f114d531/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)", "response": "else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_fields([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_fields(collection.find().fetch())", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "610792505b6af1a34d4e0a3f846df923f114d531", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/610792505b6af1a34d4e0a3f846df923f114d531/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "610792505b6af1a34d4e0a3f846df923f114d531", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/610792505b6af1a34d4e0a3f846df923f114d531/server/publications.coffee", "line_start": 61, "line_end": 66} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}", "response": "else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "610792505b6af1a34d4e0a3f846df923f114d531", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/610792505b6af1a34d4e0a3f846df923f114d531/server/publications.coffee", "line_start": 61, "line_end": 66} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "6c8017af343a6de6eb6ef616d0de13dba04eda29", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/6c8017af343a6de6eb6ef616d0de13dba04eda29/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n```", "response": "Houston._setup_collection = function(collection) {\n var fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n check(doc, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n check(id, Match.Any);\n check(update_dict, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id) {\n check(id, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n return fields = Houston._get_field_names(collection.find().fetch());\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "6c8017af343a6de6eb6ef616d0de13dba04eda29", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/6c8017af343a6de6eb6ef616d0de13dba04eda29/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n check(doc, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n check(id, Match.Any);\n check(update_dict, Object);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id) {\n check(id, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit, unknown_arg) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n check(unknown_arg, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n return fields = Houston._get_field_names(collection.find().fetch());\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "6c8017af343a6de6eb6ef616d0de13dba04eda29", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/6c8017af343a6de6eb6ef616d0de13dba04eda29/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n check doc, Object\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n check id, Match.Any\n check update_dict, Object\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id) ->\n check id, Match.Any\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)", "response": "else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit, unknown_arg) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n check unknown_arg, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "6c8017af343a6de6eb6ef616d0de13dba04eda29", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/6c8017af343a6de6eb6ef616d0de13dba04eda29/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "62588db41fa572526d01f25843f32addd4f0eb1d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/62588db41fa572526d01f25843f32addd4f0eb1d/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n```", "response": "Houston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "62588db41fa572526d01f25843f32addd4f0eb1d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/62588db41fa572526d01f25843f32addd4f0eb1d/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Match.Optional(Object));\n check(filter, Match.Optional(Object));\n check(limit, Match.Optional(Number));\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "62588db41fa572526d01f25843f32addd4f0eb1d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/62588db41fa572526d01f25843f32addd4f0eb1d/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Optional(Object)\n check filter, Match.Optional(Object)\n check limit, Match.Optional(Number)\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "62588db41fa572526d01f25843f32addd4f0eb1d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/62588db41fa572526d01f25843f32addd4f0eb1d/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e60d6cc4b3150262e34672baf6ac4b7a2193b71f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e60d6cc4b3150262e34672baf6ac4b7a2193b71f/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e60d6cc4b3150262e34672baf6ac4b7a2193b71f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e60d6cc4b3150262e34672baf6ac4b7a2193b71f/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(user_id, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e60d6cc4b3150262e34672baf6ac4b7a2193b71f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e60d6cc4b3150262e34672baf6ac4b7a2193b71f/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:4:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or", "response": "(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check user_id, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e60d6cc4b3150262e34672baf6ac4b7a2193b71f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e60d6cc4b3150262e34672baf6ac4b7a2193b71f/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check userId, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check userId, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(userId, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n check(userId, String);\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check userId, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:4:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or", "response": "(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n check userId, String\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c79a4d08ec66ce4c52d1e5a8bf29b0f79956e418/server/publications.coffee", "line_start": 63, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Object\n check filter, Object\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "03e16f4ac8263d902f245d3edebaa09d54382329", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/03e16f4ac8263d902f245d3edebaa09d54382329/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Object\n check filter, Object\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n```", "response": "Houston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Object);\n check(filter, Object);\n check(limit, Number);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "03e16f4ac8263d902f245d3edebaa09d54382329", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/03e16f4ac8263d902f245d3edebaa09d54382329/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Object);\n check(filter, Object);\n check(limit, Number);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Object\n check filter, Object\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "03e16f4ac8263d902f245d3edebaa09d54382329", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/03e16f4ac8263d902f245d3edebaa09d54382329/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Object\n check filter, Object\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "03e16f4ac8263d902f245d3edebaa09d54382329", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/03e16f4ac8263d902f245d3edebaa09d54382329/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 11, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n ADDED_COLLECTIONS[name] = collection\n```", "response": "Houston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n return ADDED_COLLECTIONS[name] = collection;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 11, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n return ADDED_COLLECTIONS[name] = collection;\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 11, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n ADDED_COLLECTIONS[name] = collection", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 11, "line_end": 58} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === (value != null ? value._name : void 0)) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value?._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or", "response": "(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 110, "line_end": 113} +{"id": "gterrono/houston:server/publications.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "Houston._admins.find({});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 110, "line_end": 113} +{"id": "gterrono/houston:server/publications.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._admins.find({});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 110, "line_end": 113} +{"id": "gterrono/houston:server/publications.coffee:4:completion", "type": "completion", "prompt": "Houston._admins.find {}", "response": "Meteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/f4fae47b2e1a20bb2c44c506a2e226c158a4ce8a/server/publications.coffee", "line_start": 110, "line_end": 113} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9dcb66a44e3caadcdd2384c8721d041bd880de3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9dcb66a44e3caadcdd2384c8721d041bd880de3/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n```", "response": "Houston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Match.Any);\n check(filter, Match.Any);\n check(limit, Number);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9dcb66a44e3caadcdd2384c8721d041bd880de3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9dcb66a44e3caadcdd2384c8721d041bd880de3/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Match.Any);\n check(filter, Match.Any);\n check(limit, Number);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9dcb66a44e3caadcdd2384c8721d041bd880de3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9dcb66a44e3caadcdd2384c8721d041bd880de3/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Number\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b9dcb66a44e3caadcdd2384c8721d041bd880de3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b9dcb66a44e3caadcdd2384c8721d041bd880de3/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ed68291dd9f7704f64df48b59b19f0f59dcdce87", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ed68291dd9f7704f64df48b59b19f0f59dcdce87/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n```", "response": "Houston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Match.Any);\n check(filter, Match.Any);\n check(limit, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ed68291dd9f7704f64df48b59b19f0f59dcdce87", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ed68291dd9f7704f64df48b59b19f0f59dcdce87/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._setup_collection = function(collection) {\n var c, fields, methods, name;\n if (collection._name in ADDED_COLLECTIONS) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n check(sort, Match.Any);\n check(filter, Match.Any);\n check(limit, Match.Any);\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ed68291dd9f7704f64df48b59b19f0f59dcdce87", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ed68291dd9f7704f64df48b59b19f0f59dcdce87/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name of ADDED_COLLECTIONS\n\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n check sort, Match.Any\n check filter, Match.Any\n check limit, Match.Any\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ed68291dd9f7704f64df48b59b19f0f59dcdce87", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ed68291dd9f7704f64df48b59b19f0f59dcdce87/server/publications.coffee", "line_start": 11, "line_end": 60} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "95ce4b30967eb84acda672c81fea04c55e366e99", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/95ce4b30967eb84acda672c81fea04c55e366e99/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "95ce4b30967eb84acda672c81fea04c55e366e99", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/95ce4b30967eb84acda672c81fea04c55e366e99/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, new_collection, value;\n if (!(name in ADDED_COLLECTIONS || name in HIDDEN_COLLECTIONS)) {\n new_collection = null;\n try {\n new_collection = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n new_collection = value;\n }\n }\n }\n if (new_collection != null) {\n return Houston._setup_collection(new_collection);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`); // found it!\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "95ce4b30967eb84acda672c81fea04c55e366e99", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/95ce4b30967eb84acda672c81fea04c55e366e99/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of ADDED_COLLECTIONS or name of HIDDEN_COLLECTIONS\n new_collection = null\n try\n new_collection = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n new_collection = value\n\n if new_collection? # found it!\n Houston._setup_collection(new_collection)\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or", "response": "(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "95ce4b30967eb84acda672c81fea04c55e366e99", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/95ce4b30967eb84acda672c81fea04c55e366e99/server/publications.coffee", "line_start": 60, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._setup_collection = (collection) ->\n return if collection._name in collections\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 12, "line_end": 57} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._setup_collection = (collection) ->\n return if collection._name in collections\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n```", "response": "var indexOf = [].indexOf;\n\nHouston._setup_collection = function(collection) {\n var c, fields, methods, name, ref;\n if (ref = collection._name, indexOf.call(collections, ref) >= 0) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 12, "line_end": 57} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar indexOf = [].indexOf;\n\nHouston._setup_collection = function(collection) {\n var c, fields, methods, name, ref;\n if (ref = collection._name, indexOf.call(collections, ref) >= 0) {\n return;\n }\n name = collection._name;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n```", "response": "Houston._setup_collection = (collection) ->\n return if collection._name in collections\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 12, "line_end": 57} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "Houston._setup_collection = (collection) ->\n return if collection._name in collections\n name = collection._name\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 12, "line_end": 57} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n\n if name of collections # found it!\n Houston._setup_collection(collections[name])\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n\n if name of collections # found it!\n Houston._setup_collection(collections[name])\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections || name in hidden_collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n collections[name] = value;\n }\n }\n }\n if (name in collections) { // found it!\n return Houston._setup_collection(collections[name]);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections || name in hidden_collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n collections[name] = value;\n }\n }\n }\n if (name in collections) { // found it!\n return Houston._setup_collection(collections[name]);\n } else {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n\n if name of collections # found it!\n Houston._setup_collection(collections[name])\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n\n if name of collections # found it!\n Houston._setup_collection(collections[name])\n else\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection", "response": "\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "89b884a6728e9da926151103ed136593aac30c9d", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/89b884a6728e9da926151103ed136593aac30c9d/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n Houston._setup_collection(collections[name])\n\n unless name of collections\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "11aeed77b3c7238ecfe30a37f7a1ebc250789adf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/11aeed77b3c7238ecfe30a37f7a1ebc250789adf/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n Houston._setup_collection(collections[name])\n\n unless name of collections\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections || name in hidden_collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n collections[name] = value;\n Houston._setup_collection(collections[name]);\n }\n }\n if (!(name in collections)) {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`);\n }\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "11aeed77b3c7238ecfe30a37f7a1ebc250789adf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/11aeed77b3c7238ecfe30a37f7a1ebc250789adf/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections || name in hidden_collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) { // TODO here - typecheck also?\n collections[name] = value;\n Houston._setup_collection(collections[name]);\n }\n }\n if (!(name in collections)) {\n return console.log(`Houston: couldn't find access to the ${name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection`);\n }\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n Houston._setup_collection(collections[name])\n\n unless name of collections\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection\n\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "11aeed77b3c7238ecfe30a37f7a1ebc250789adf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/11aeed77b3c7238ecfe30a37f7a1ebc250789adf/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name # TODO here - typecheck also?\n collections[name] = value\n Houston._setup_collection(collections[name])\n\n unless name of collections\n console.log \"\"\"\nHouston: couldn't find access to the #{name} collection.\nIf you'd like to access the collection from Houston, either\n(1) make sure it is available as a global (top-level namespace) within the server or\n(2) add the collection manually via Houston.add_collection", "response": "\"\"\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "11aeed77b3c7238ecfe30a37f7a1ebc250789adf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/11aeed77b3c7238ecfe30a37f7a1ebc250789adf/server/publications.coffee", "line_start": 59, "line_end": 108} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant\n```", "response": "var collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users //TODO verify this is still relevant\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users //TODO verify this is still relevant\n};\n```", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods", "response": "Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 54, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n console.log(e);\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 54, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n console.log(e);\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 54, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"", "response": "# MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/227fa0e254151bcdf3c2a163f7f0ff4a9d3a31c4/server/publications.coffee", "line_start": 54, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\nhidden_collections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}\ncollections = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\nhidden_collections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}\ncollections = {}\n```", "response": "var collections, hidden_collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\nhidden_collections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0\n};\n\ncollections = {};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar collections, hidden_collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\nhidden_collections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0\n};\n\ncollections = {};\n```", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\nhidden_collections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}\ncollections = {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods", "response": "Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\nhidden_collections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}\ncollections = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 55, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections || name in hidden_collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n if (collections[name] != null) {\n return setup_collection(name, collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 55, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections || name in hidden_collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n if (collections[name] != null) {\n return setup_collection(name, collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 55, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections or name of hidden_collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"", "response": "# MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "35dd6c055fcbbede8c2e00bc5f73b42e90effa98", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/35dd6c055fcbbede8c2e00bc5f73b42e90effa98/server/publications.coffee", "line_start": 55, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}\n```", "response": "var collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0\n};\n```", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods", "response": "Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 8, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n if (collections[name] != null) {\n return setup_collection(name, collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n if (collections[name] != null) {\n return setup_collection(name, collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"", "response": "# MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "8b1d9f2bf910a38c1a6645f11c5dfd4512226d34", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/8b1d9f2bf910a38c1a6645f11c5dfd4512226d34/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7eb4e053da1414fd572c841d4f26a07eb73dea58", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7eb4e053da1414fd572c841d4f26a07eb73dea58/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}\n```", "response": "var collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n console.log(name, collection);\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7eb4e053da1414fd572c841d4f26a07eb73dea58", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7eb4e053da1414fd572c841d4f26a07eb73dea58/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n console.log(name, collection);\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0\n};\n```", "response": "setup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7eb4e053da1414fd572c841d4f26a07eb73dea58", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7eb4e053da1414fd572c841d4f26a07eb73dea58/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "setup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7eb4e053da1414fd572c841d4f26a07eb73dea58", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7eb4e053da1414fd572c841d4f26a07eb73dea58/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined} #TODO verify this is still relevant", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4da2e20614ad93be4e94a65c65752e6f231ea9fb", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4da2e20614ad93be4e94a65c65752e6f231ea9fb/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined} #TODO verify this is still relevant\n```", "response": "var collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n console.log(name, collection);\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0 //TODO verify this is still relevant\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4da2e20614ad93be4e94a65c65752e6f231ea9fb", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4da2e20614ad93be4e94a65c65752e6f231ea9fb/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n console.log(name, collection);\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n};\n\ncollections = {\n 'users': Meteor.users,\n 'meteor_accounts_loginServiceConfiguration': void 0 //TODO verify this is still relevant\n};\n```", "response": "setup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined} #TODO verify this is still relevant", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4da2e20614ad93be4e94a65c65752e6f231ea9fb", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4da2e20614ad93be4e94a65c65752e6f231ea9fb/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "setup_collection = (name, collection) ->\n console.log name, collection\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\ncollections = {'users': Meteor.users, 'meteor_accounts_loginServiceConfiguration': undefined} #TODO verify this is still relevant", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4da2e20614ad93be4e94a65c65752e6f231ea9fb", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4da2e20614ad93be4e94a65c65752e6f231ea9fb/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log Meteor\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c17c375d08fddee02ae19fd234e24f6d04bfaf46", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c17c375d08fddee02ae19fd234e24f6d04bfaf46/server/publications.coffee", "line_start": 55, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log Meteor\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n console.log(Meteor);\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n if (collections[name] != null) {\n return setup_collection(name, collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c17c375d08fddee02ae19fd234e24f6d04bfaf46", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c17c375d08fddee02ae19fd234e24f6d04bfaf46/server/publications.coffee", "line_start": 55, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n console.log(Meteor);\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n if (collections[name] != null) {\n return setup_collection(name, collections[name]);\n }\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log Meteor\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c17c375d08fddee02ae19fd234e24f6d04bfaf46", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c17c375d08fddee02ae19fd234e24f6d04bfaf46/server/publications.coffee", "line_start": 55, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n console.log Meteor\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name]) if collections[name]?\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"", "response": "# MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c17c375d08fddee02ae19fd234e24f6d04bfaf46", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c17c375d08fddee02ae19fd234e24f6d04bfaf46/server/publications.coffee", "line_start": 55, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a2fcc5917a05b5e46e6a434ede172034f0cbcda7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a2fcc5917a05b5e46e6a434ede172034f0cbcda7/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a2fcc5917a05b5e46e6a434ede172034f0cbcda7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a2fcc5917a05b5e46e6a434ede172034f0cbcda7/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.methods({\n _houston_make_admin: function(user_id) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({user_id});\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// TODO address inherent security issue\nHouston._publish('admin_user', function() {\n return Houston._admins.find({});\n});\n\nMeteor.startup(function() {\n return sync_collections();\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a2fcc5917a05b5e46e6a434ede172034f0cbcda7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a2fcc5917a05b5e46e6a434ede172034f0cbcda7/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"", "response": "# MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.methods\n _houston_make_admin: (user_id) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert {user_id}\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# TODO address inherent security issue\nHouston._publish 'admin_user', ->\n Houston._admins.find {}\n\nMeteor.startup ->\n sync_collections()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a2fcc5917a05b5e46e6a434ede172034f0cbcda7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a2fcc5917a05b5e46e6a434ede172034f0cbcda7/server/publications.coffee", "line_start": 54, "line_end": 98} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b872b6d21b080b40715e3478e83a6ffd22f83b73", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b872b6d21b080b40715e3478e83a6ffd22f83b73/server/publications.coffee", "line_start": 54, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.startup(function() {\n return sync_collections();\n});\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b872b6d21b080b40715e3478e83a6ffd22f83b73", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b872b6d21b080b40715e3478e83a6ffd22f83b73/server/publications.coffee", "line_start": 54, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.startup(function() {\n return sync_collections();\n});\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b872b6d21b080b40715e3478e83a6ffd22f83b73", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b872b6d21b080b40715e3478e83a6ffd22f83b73/server/publications.coffee", "line_start": 54, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5", "response": "mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "b872b6d21b080b40715e3478e83a6ffd22f83b73", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b872b6d21b080b40715e3478e83a6ffd22f83b73/server/publications.coffee", "line_start": 54, "line_end": 100} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant\n```", "response": "var collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n return console.log(`synced ${name}`);\n};\n\ncollections = {\n 'users': Meteor.users //TODO verify this is still relevant\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar collections, setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n return console.log(`synced ${name}`);\n};\n\ncollections = {\n 'users': Meteor.users //TODO verify this is still relevant\n};\n```", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods", "response": "Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"\n\ncollections = {'users': Meteor.users} #TODO verify this is still relevant", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 8, "line_end": 54} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true\n```", "response": "var sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n return console.log(\"sync collections done\");\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.startup(function() {\n return sync_collections();\n});\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function() {\n var _sync_collections, bound_sync_collections, mongo_driver;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n _sync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n return console.log(\"sync collections done\");\n };\n bound_sync_collections = Meteor.bindEnvironment(_sync_collections, function(e) {\n return console.log(`Failed while syncing collections for reason: ${e}`);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(bound_sync_collections);\n};\n\nMeteor.startup(function() {\n return sync_collections();\n});\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n sync_collections(); // reloads collections in case of new app\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});\n```", "response": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n _sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\n bound_sync_collections = Meteor.bindEnvironment _sync_collections, (e) ->\n console.log \"Failed while syncing collections for reason: #{e}\"\n\n # MongoInternals is the 'right' solution as of 0.6.5", "response": "mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections bound_sync_collections\n\nMeteor.startup ->\n sync_collections()\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n sync_collections() # reloads collections in case of new app\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "9036c3045bf008d08dc4ffef1717965986a8cc33", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/9036c3045bf008d08dc4ffef1717965986a8cc33/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 9, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"\n```", "response": "var setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n return console.log(`synced ${name}`);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 9, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar setup_collection;\n\nsetup_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n return console.log(`synced ${name}`);\n};\n```", "response": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 9, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "setup_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n console.log \"synced #{name}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 9, "line_end": 53} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\nMeteor.startup ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n # TODO put bindEnvironment as part of syncCollections\n sync_fn = Meteor.bindEnvironment sync_collections, (e) ->\n console.log \"sync error\"\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections sync_fn\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n console.log \"making admin: #{userId}\"\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\nMeteor.startup ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n # TODO put bindEnvironment as part of syncCollections\n sync_fn = Meteor.bindEnvironment sync_collections, (e) ->\n console.log \"sync error\"\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections sync_fn\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n console.log \"making admin: #{userId}\"\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true\n```", "response": "var sync_collections;\n\nsync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n return console.log(\"sync collections done\");\n};\n\nMeteor.startup(function() {\n var mongo_driver, sync_fn;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n\n // TODO put bindEnvironment as part of syncCollections\n sync_fn = Meteor.bindEnvironment(sync_collections, function(e) {\n console.log(\"sync error\");\n return console.log(e);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(sync_fn);\n});\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n console.log(`making admin: ${userId}`);\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar sync_collections;\n\nsync_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return setup_collection(name, collections[name]);\n }\n });\n return console.log(\"sync collections done\");\n};\n\nMeteor.startup(function() {\n var mongo_driver, sync_fn;\n Dummy.findOne(); // hack. TODO: verify this is still necessary\n\n // TODO put bindEnvironment as part of syncCollections\n sync_fn = Meteor.bindEnvironment(sync_collections, function(e) {\n console.log(\"sync error\");\n return console.log(e);\n });\n // MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n return mongo_driver.mongo.db.collections(sync_fn);\n});\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n console.log(`making admin: ${userId}`);\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n return true;\n }\n});\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});\n```", "response": "sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\nMeteor.startup ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n # TODO put bindEnvironment as part of syncCollections\n sync_fn = Meteor.bindEnvironment sync_collections, (e) ->\n console.log \"sync error\"\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections sync_fn\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n console.log \"making admin: #{userId}\"\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "sync_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n setup_collection(name, collections[name])\n console.log \"sync collections done\"\n\nMeteor.startup ->\n Dummy.findOne() # hack. TODO: verify this is still necessary\n\n # TODO put bindEnvironment as part of syncCollections\n sync_fn = Meteor.bindEnvironment sync_collections, (e) ->\n console.log \"sync error\"", "response": "console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections sync_fn\n\nMeteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n console.log \"making admin: #{userId}\"\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/server/publications.coffee", "line_start": 55, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n```", "response": "Houston._publish = function(name, func) {\n return Meteor.publish(Houston._houstonize(name), func);\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n set_up_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function([doc]) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function([id, update_dict]) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function([id, update_dict]) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n };\n return Dummy.findOne(); // hack\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._publish = function(name, func) {\n return Meteor.publish(Houston._houstonize(name), func);\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n set_up_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function([doc]) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function([id, update_dict]) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function([id, update_dict]) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n };\n return Dummy.findOne(); // hack\n});\n```", "response": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsave_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true\n```", "response": "var fn, mongo_driver, save_collections;\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function([userId]) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n return true;\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fn, mongo_driver, save_collections;\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function([userId]) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n return true;\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});\n```", "response": "save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}", "response": "Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n```", "response": "Houston._publish = function(name, func) {\n return Meteor.publish(Houston._houstonize(name), func);\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n set_up_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n };\n return Dummy.findOne(); // hack\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._publish = function(name, func) {\n return Meteor.publish(Houston._houstonize(name), func);\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n set_up_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function(doc) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function(id, update_dict) {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n c = Houston._collections.collections.findOne({name});\n if (c) {\n return Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n } else {\n return Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n }\n };\n return Dummy.findOne(); // hack\n});\n```", "response": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = (doc) ->\n return unless Houston._user_is_admin @userId\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = (id, update_dict) ->\n return unless Houston._user_is_admin @userId\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)", "response": "Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n return unless Houston._user_is_admin @userId\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsave_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true\n```", "response": "var fn, mongo_driver, save_collections;\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n return true;\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fn, mongo_driver, save_collections;\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Houston._admins.findOne({\n 'user_id': {\n $exists: true\n }\n })) {\n return;\n }\n Houston._admins.insert({\n user_id: userId\n });\n return true;\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our analysis of the app's collections\nHouston._publish('collections', function() {\n if (!Houston._user_is_admin(this.userId)) {\n return;\n }\n return Houston._collections.collections.find();\n});\n\n// used by login page to see if admin has been created yet\nHouston._publish('admin_user', function() {\n if (Houston._user_is_admin(this.userId)) {\n return Houston._admins.find({\n user_id: this.userId\n });\n }\n return Houston._admins.find({\n user_id: {\n $exists: true\n }\n }, {\n fields: {\n _id: true\n }\n });\n});\n```", "response": "save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}\n Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Houston._admins.findOne {'user_id': $exists: true}", "response": "Houston._admins.insert user_id: userId\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our analysis of the app's collections\nHouston._publish 'collections', ->\n return unless Houston._user_is_admin @userId\n Houston._collections.collections.find()\n\n\n# used by login page to see if admin has been created yet\nHouston._publish 'admin_user', ->\n if Houston._user_is_admin @userId\n return Houston._admins.find user_id: @userId\n Houston._admins.find {user_id: $exists: true}, fields: _id: true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ac73043990093b2ecd87e947bd30c1fe3dba1de6", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ac73043990093b2ecd87e947bd30c1fe3dba1de6/server/publications.coffee", "line_start": 56, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHouston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n```", "response": "Houston._publish = function(name, func) {\n return Meteor.publish(Houston._houstonize(name), func);\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function([doc]) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function([id, update_dict]) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function([id, update_dict]) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n return c = Houston._collections.collections.findOne({name});\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHouston._publish = function(name, func) {\n return Meteor.publish(Houston._houstonize(name), func);\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var c, fields, methods;\n methods = {};\n methods[Houston._houstonize(`${name}_insert`)] = function([doc]) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[Houston._houstonize(`${name}_update`)] = function([id, update_dict]) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[Houston._houstonize(`${name}_delete`)] = function([id, update_dict]) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n Houston._publish(name, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n collection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n });\n fields = Houston._get_field_names(collection.find().fetch());\n return c = Houston._collections.collections.findOne({name});\n };\n});\n```", "response": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "Houston._publish = (name, func) ->\n Meteor.publish Houston._houstonize(name), func\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[Houston._houstonize \"#{name}_insert\"] = ([doc]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[Houston._houstonize \"#{name}_update\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[Houston._houstonize \"#{name}_delete\"] = ([id, update_dict]) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)", "response": "return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Houston._publish name, (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n\n collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 6, "line_end": 55} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nHouston._publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 56, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nHouston._publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)\n```", "response": "var fn, mongo_driver, save_collections;\n\nif (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function([userId]) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.collections.find();\n }\n});\n\nHouston._publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 56, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fn, mongo_driver, save_collections;\n\nif (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function([userId]) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.collections.find();\n }\n});\n\nHouston._publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});\n```", "response": "if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nHouston._publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 56, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])", "response": "Meteor.methods\n _houston_make_admin: ([userId]) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nHouston._publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/server/publications.coffee", "line_start": 56, "line_end": 102} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nroot = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n```", "response": "var Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`_houston_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`_houston_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`_houston_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`_houston_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`_houston_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`_houston_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`_houston_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`_houston_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});\n```", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else", "response": "id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n```", "response": "var c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = Houston._get_field_names(collection.find().fetch());\n\nc = Houston._collections.collections.findOne({name});\n\nif (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: Houston._get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Houston._collections.collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = Houston._get_field_names(collection.find().fetch());\n\nc = Houston._collections.collections.findOne({name});\n\nif (c) {\n Houston._collections.collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});\n```", "response": "collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) ->\n Houston._collections.collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.collections.findOne {name}\n if c\n Houston._collections.collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and", "response": "(col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)\n```", "response": "var fn, mongo_driver;\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.collections.find();\n }\n});\n\nMeteor.publish('_houston_adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fn, mongo_driver;\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.collections.find();\n }\n});\n\nMeteor.publish('_houston_adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});\n```", "response": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn", "response": "# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.findOne {name}\n if c\n Houston._collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.findOne {name}\n if c\n Houston._collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n```", "response": "var c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: Houston._get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = Houston._get_field_names(collection.find().fetch());\n\nc = Houston._collections.findOne({name});\n\nif (c) {\n Houston._collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: Houston._get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = Houston._get_field_names(collection.find().fetch());\n\nc = Houston._collections.findOne({name});\n\nif (c) {\n Houston._collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});\n```", "response": "collection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.findOne {name}\n if c\n Houston._collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n\n fields = Houston._get_field_names(collection.find().fetch())\n c = Houston._collections.findOne {name}\n if c\n Houston._collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and", "response": "(col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)\n```", "response": "var fn, mongo_driver;\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.find();\n }\n});\n\nMeteor.publish('_houston_adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fn, mongo_driver;\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.find();\n }\n});\n\nMeteor.publish('_houston_adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});\n```", "response": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn", "response": "# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3fa4b927aee4e23c39e194ee4e97fadbf627c39c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3fa4b927aee4e23c39e194ee4e97fadbf627c39c/server/publications.coffee", "line_start": 84, "line_end": 99} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)\n```", "response": "var fn, mongo_driver;\n\n({\n _houston_setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.find();\n }\n});\n\nMeteor.publish('_houston_adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fn, mongo_driver;\n\n({\n _houston_setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish('_houston', function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Houston._collections.find();\n }\n});\n\nMeteor.publish('_houston_adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});\n```", "response": "_houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "_houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])", "response": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nroot = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n```", "response": "var Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`admin_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`admin_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`admin_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`admin_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`admin_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`admin_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`admin_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`admin_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});\n```", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else", "response": "id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit) ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n```", "response": "var c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nc = Collections.findOne({name});\n\nif (c) {\n Collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: {\n $each: get_field_names([document])\n }\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nc = Collections.findOne({name});\n\nif (c) {\n Collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});\n```", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: $each: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and", "response": "(col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsetupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)\n```", "response": "var fn, mongo_driver;\n\n({\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish(\"admin\", function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Collections.find();\n }\n});\n\nMeteor.publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fn, mongo_driver;\n\n({\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n }\n});\n\nfn = Meteor.bindEnvironment(save_collections, function(e) {\n return console.log(e);\n});\n\n// MongoInternals is the 'right' solution as of 0.6.5\nmongo_driver = (typeof MongoInternals !== \"undefined\" && MongoInternals !== null ? MongoInternals.defaultRemoteCollectionDriver() : void 0) || Meteor._RemoteCollectionDriver;\n\nmongo_driver.mongo.db.collections(fn);\n\n// publish our own internal state\nMeteor.publish(\"admin\", function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Collections.find();\n }\n});\n\nMeteor.publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});\n```", "response": "setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])", "response": "fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "e652379d68f6c94ff5ac4cd9f4dccafc62c185cf", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e652379d68f6c94ff5ac4cd9f4dccafc62c185cf/server/publications.coffee", "line_start": 84, "line_end": 114} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nroot = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n```", "response": "var Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`_houston_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`_houston_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`_houston_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`_houston_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`_houston_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`_houston_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`_houston_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`_houston_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});\n```", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"_houston_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"_houston_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else", "response": "id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"_houston_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"_houston_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n fields = Houston._get_field_names(collection.find().fetch())\n if Houston._collections.findOne {name}\n Houston._collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n _houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n fields = Houston._get_field_names(collection.find().fetch())\n if Houston._collections.findOne {name}\n Houston._collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n _houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n```", "response": "var fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: Houston._get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = Houston._get_field_names(collection.find().fetch());\n\nif (Houston._collections.findOne({name})) {\n Houston._collections.update({name}, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return True;\n },\n _houston_setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: Houston._get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Houston._collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = Houston._get_field_names(collection.find().fetch());\n\nif (Houston._collections.findOne({name})) {\n Houston._collections.update({name}, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Houston._collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"houston_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n _houston_make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return True;\n },\n _houston_setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});\n```", "response": "collection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n fields = Houston._get_field_names(collection.find().fetch())\n if Houston._collections.findOne {name}\n Houston._collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n _houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) ->\n Houston._collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: Houston._get_field_names([document])\n removed: (document) -> Houston._collections.update {name}, {$inc: {count: -1}}\n fields = Houston._get_field_names(collection.find().fetch())\n if Houston._collections.findOne {name}\n Houston._collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Houston._collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"houston_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root", "response": "if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n _houston_make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n _houston_setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 95, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn", "response": "# publish our own internal state\nMeteor.publish '_houston', ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Houston._collections.find()\n\n\nMeteor.publish '_houston_adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/server/publications.coffee", "line_start": 95, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7e4aad8f9e664f8439e4b61705ba5af449be99cc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7e4aad8f9e664f8439e4b61705ba5af449be99cc/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n```", "response": "var c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nc = Collections.findOne({name});\n\nif (c) {\n Collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7e4aad8f9e664f8439e4b61705ba5af449be99cc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7e4aad8f9e664f8439e4b61705ba5af449be99cc/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar c, fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nc = Collections.findOne({name});\n\nif (c) {\n Collections.update(c._id, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n }\n});\n```", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7e4aad8f9e664f8439e4b61705ba5af449be99cc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7e4aad8f9e664f8439e4b61705ba5af449be99cc/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n\n fields = get_field_names(collection.find().fetch())\n c = Collections.findOne {name}\n if c\n Collections.update c._id, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n Dummy.findOne() # hack\n\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and", "response": "(col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7e4aad8f9e664f8439e4b61705ba5af449be99cc", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7e4aad8f9e664f8439e4b61705ba5af449be99cc/server/publications.coffee", "line_start": 44, "line_end": 82} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7cce4b29f5b59e631855fdc915e97958ec3693b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7cce4b29f5b59e631855fdc915e97958ec3693b7/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n```", "response": "var fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nif (Collections.findOne({name})) {\n Collections.update({name}, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n },\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7cce4b29f5b59e631855fdc915e97958ec3693b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7cce4b29f5b59e631855fdc915e97958ec3693b7/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nif (Collections.findOne({name})) {\n Collections.update({name}, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n if (collections[name] == null) {\n console.log(e);\n }\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return true;\n },\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});\n```", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7cce4b29f5b59e631855fdc915e97958ec3693b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7cce4b29f5b59e631855fdc915e97958ec3693b7/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root", "response": "if name == value._name\n collections[name] = value\n console.log e unless collections[name]?\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return true\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7cce4b29f5b59e631855fdc915e97958ec3693b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7cce4b29f5b59e631855fdc915e97958ec3693b7/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7cce4b29f5b59e631855fdc915e97958ec3693b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7cce4b29f5b59e631855fdc915e97958ec3693b7/server/publications.coffee", "line_start": 95, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:3:completion", "type": "completion", "prompt": "set_up_collection(name, collections[name])\n\n fn = Meteor.bindEnvironment save_collections, (e) ->\n console.log e\n\n # MongoInternals is the 'right' solution as of 0.6.5\n mongo_driver = MongoInternals?.defaultRemoteCollectionDriver() or Meteor._RemoteCollectionDriver\n mongo_driver.mongo.db.collections fn", "response": "# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "7cce4b29f5b59e631855fdc915e97958ec3693b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7cce4b29f5b59e631855fdc915e97958ec3693b7/server/publications.coffee", "line_start": 95, "line_end": 112} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "publish_to_admin = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()\n\n\n# publish our own internal state\n\npublish_to_admin \"admin\", -> Collections.find()\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ab83a364fe8bd756c044e8a2fd9fff260954469f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ab83a364fe8bd756c044e8a2fd9fff260954469f/server/publications.coffee", "line_start": 98, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npublish_to_admin = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()\n\n\n# publish our own internal state\n\npublish_to_admin \"admin\", -> Collections.find()\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)\n```", "response": "var publish_to_admin;\n\npublish_to_admin = function(name, publish_func) {\n return Meteor.publish(name, function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return publish_func();\n }\n });\n};\n\n// publish our own internal state\npublish_to_admin(\"admin\", function() {\n return Collections.find();\n});\n\nMeteor.publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ab83a364fe8bd756c044e8a2fd9fff260954469f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ab83a364fe8bd756c044e8a2fd9fff260954469f/server/publications.coffee", "line_start": 98, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar publish_to_admin;\n\npublish_to_admin = function(name, publish_func) {\n return Meteor.publish(name, function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return publish_func();\n }\n });\n};\n\n// publish our own internal state\npublish_to_admin(\"admin\", function() {\n return Collections.find();\n});\n\nMeteor.publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});\n```", "response": "publish_to_admin = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()\n\n\n# publish our own internal state\n\npublish_to_admin \"admin\", -> Collections.find()\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ab83a364fe8bd756c044e8a2fd9fff260954469f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ab83a364fe8bd756c044e8a2fd9fff260954469f/server/publications.coffee", "line_start": 98, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "publish_to_admin = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()", "response": "# publish our own internal state\n\npublish_to_admin \"admin\", -> Collections.find()\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "ab83a364fe8bd756c044e8a2fd9fff260954469f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/ab83a364fe8bd756c044e8a2fd9fff260954469f/server/publications.coffee", "line_start": 98, "line_end": 109} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nroot = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e\n```", "response": "var Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`admin_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`admin_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`admin_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`admin_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dummy, collections, root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nDummy = new Meteor.Collection(\"system.dummy\"); // hack.\n\ncollections = {\n 'users': Meteor.users\n};\n\nMeteor.startup(function() {\n var set_up_collection;\n return set_up_collection = function(name, collection) {\n var methods;\n methods = {};\n methods[`admin_${name}_insert`] = function(doc) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n return collection.insert(doc);\n };\n methods[`admin_${name}_update`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.update(id, update_dict);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.update(id, update_dict);\n }\n };\n methods[`admin_${name}_delete`] = function(id, update_dict) {\n var user;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (collection.findOne(id)) {\n return collection.remove(id);\n } else {\n id = collection.findOne(new Meteor.Collection.ObjectID(id));\n return collection.remove(id);\n }\n };\n Meteor.methods(methods);\n return Meteor.publish(`admin_${name}`, function(sort, filter, limit) {\n var e;\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n try {\n return collection.find(filter, {\n sort: sort,\n limit: limit\n });\n } catch (error) {\n e = error;\n return console.log(e);\n }\n }\n });\n };\n});\n```", "response": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "root = exports ? this\n\nDummy = new Meteor.Collection(\"system.dummy\") # hack.\ncollections = {'users': Meteor.users}\n\nMeteor.startup ->\n set_up_collection = (name, collection) ->\n methods = {}\n methods[\"admin_#{name}_insert\"] = (doc) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n collection.insert(doc)\n\n methods[\"admin_#{name}_update\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.update(id, update_dict)\n else", "response": "id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.update(id, update_dict)\n\n methods[\"admin_#{name}_delete\"] = (id, update_dict) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n if collection.findOne(id)\n collection.remove(id)\n else\n id = collection.findOne(new Meteor.Collection.ObjectID(id))\n collection.remove(id)\n\n Meteor.methods methods\n\n Meteor.publish \"admin_#{name}\", (sort, filter, limit)->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n try\n collection.find(filter, sort: sort, limit: limit)\n catch e\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n```", "response": "var fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nif (Collections.findOne({name})) {\n Collections.update({name}, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return True;\n },\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fields, save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n },\n $addToSet: {\n fields: get_field_names([document])\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nfields = get_field_names(collection.find().fetch());\n\nif (Collections.findOne({name})) {\n Collections.update({name}, {\n $set: {\n count: collection.find().count(),\n fields: fields\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count(),\n fields: fields\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return True;\n },\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});\n```", "response": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) ->\n Collections.update {name},\n $inc: {count: 1},\n $addToSet: fields: get_field_names([document])\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n fields = get_field_names(collection.find().fetch())\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count(), fields: fields}\n else\n Collections.insert {name, count: collection.find().count(), fields: fields}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root", "response": "if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "3100fa1dc6400b701d528c78a54050b3cc8af877", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3100fa1dc6400b701d528c78a54050b3cc8af877/server/publications.coffee", "line_start": 44, "line_end": 93} +{"id": "gterrono/houston:server/publications.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "collection.find().observe\n added: (document) -> Collections.update {name}, {$inc: {count: 1}}\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count()}\n else\n Collections.insert {name, count: collection.find().count()}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a962936d195a609ad2cc573291390e4dda53929b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a962936d195a609ad2cc573291390e4dda53929b/server/publications.coffee", "line_start": 44, "line_end": 89} +{"id": "gterrono/houston:server/publications.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncollection.find().observe\n added: (document) -> Collections.update {name}, {$inc: {count: 1}}\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count()}\n else\n Collections.insert {name, count: collection.find().count()}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n```", "response": "var save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nif (Collections.findOne({name})) {\n Collections.update({name}, {\n $set: {\n count: collection.find().count()\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count()\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return True;\n },\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a962936d195a609ad2cc573291390e4dda53929b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a962936d195a609ad2cc573291390e4dda53929b/server/publications.coffee", "line_start": 44, "line_end": 89} +{"id": "gterrono/houston:server/publications.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar save_collections;\n\ncollection.find().observe({\n added: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: 1\n }\n });\n },\n removed: function(document) {\n return Collections.update({name}, {\n $inc: {\n count: -1\n }\n });\n }\n});\n\nif (Collections.findOne({name})) {\n Collections.update({name}, {\n $set: {\n count: collection.find().count()\n }\n });\n} else {\n Collections.insert({\n name,\n count: collection.find().count()\n });\n}\n\nDummy.findOne(); // hack\n\nsave_collections = function(meh, collections_db) {\n var col, collection_names;\n collection_names = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = collections_db.length; i < len; i++) {\n col = collections_db[i];\n if ((col.collectionName.indexOf(\"system.\")) !== 0 && (col.collectionName.indexOf(\"admin_\")) !== 0) {\n results.push(col.collectionName);\n }\n }\n return results;\n })();\n return collection_names.forEach(function(name) {\n var e, key, value;\n if (!(name in collections)) {\n try {\n collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n console.log(e);\n }\n return set_up_collection(name, collections[name]);\n }\n });\n};\n\nMeteor.methods({\n make_admin: function(userId) {\n // limit one admin\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return;\n }\n Meteor.users.update(userId, {\n $set: {\n 'profile.admin': true\n }\n });\n return True;\n },\n setupNewCollection: function(name) {\n var e, key, user, value;\n if (!this.userId) {\n return;\n }\n user = Meteor.users.findOne(this.userId);\n if (!(user != null ? user.profile.admin : void 0)) {\n return;\n }\n if (!(name in collections)) {\n try {\n return collections[name] = new Meteor.Collection(name);\n } catch (error) {\n e = error;\n for (key in root) {\n value = root[key];\n if (name === value._name) {\n collections[name] = value;\n }\n }\n return console.log(e);\n }\n }\n }\n});\n```", "response": "collection.find().observe\n added: (document) -> Collections.update {name}, {$inc: {count: 1}}\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count()}\n else\n Collections.insert {name, count: collection.find().count()}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a962936d195a609ad2cc573291390e4dda53929b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a962936d195a609ad2cc573291390e4dda53929b/server/publications.coffee", "line_start": 44, "line_end": 89} +{"id": "gterrono/houston:server/publications.coffee:2:completion", "type": "completion", "prompt": "collection.find().observe\n added: (document) -> Collections.update {name}, {$inc: {count: 1}}\n removed: (document) -> Collections.update {name}, {$inc: {count: -1}}\n if Collections.findOne {name}\n Collections.update {name}, {$set: count: collection.find().count()}\n else\n Collections.insert {name, count: collection.find().count()}\n\n\n Dummy.findOne() # hack\n save_collections = (meh, collections_db) ->\n collection_names = (col.collectionName for col in collections_db \\\n when (col.collectionName.indexOf \"system.\") isnt 0 and\n (col.collectionName.indexOf \"admin_\") isnt 0)\n\n collection_names.forEach (name) ->\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value", "response": "console.log e\n\n set_up_collection(name, collections[name])\n\n Meteor.methods\n make_admin: (userId) ->\n # limit one admin\n return if Meteor.users.findOne {'profile.admin': true}\n Meteor.users.update userId, $set: {'profile.admin': true}\n return True\n\n setupNewCollection: (name) ->\n return unless @userId\n user = Meteor.users.findOne(@userId)\n return unless user?.profile.admin\n unless name of collections\n try\n collections[name] = new Meteor.Collection(name)\n catch e\n for key, value of root\n if name == value._name\n collections[name] = value\n console.log e", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "a962936d195a609ad2cc573291390e4dda53929b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a962936d195a609ad2cc573291390e4dda53929b/server/publications.coffee", "line_start": 44, "line_end": 89} +{"id": "gterrono/houston:server/publications.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "publish_to_admin_with_pagination = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "eb1016772c4e7ce8bb8698aad6c7d891e869155c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/eb1016772c4e7ce8bb8698aad6c7d891e869155c/server/publications.coffee", "line_start": 100, "line_end": 113} +{"id": "gterrono/houston:server/publications.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npublish_to_admin_with_pagination = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)\n```", "response": "var publish_to_admin_with_pagination;\n\npublish_to_admin_with_pagination = function(name, publish_func) {\n return Meteor.publish(name, function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return publish_func();\n }\n });\n};\n\n// publish our own internal state\nMeteor.publish(\"admin\", function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Collections.find();\n }\n});\n\nMeteor.publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "eb1016772c4e7ce8bb8698aad6c7d891e869155c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/eb1016772c4e7ce8bb8698aad6c7d891e869155c/server/publications.coffee", "line_start": 100, "line_end": 113} +{"id": "gterrono/houston:server/publications.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar publish_to_admin_with_pagination;\n\npublish_to_admin_with_pagination = function(name, publish_func) {\n return Meteor.publish(name, function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return publish_func();\n }\n });\n};\n\n// publish our own internal state\nMeteor.publish(\"admin\", function() {\n if (Meteor.users.findOne({\n _id: this.userId,\n 'profile.admin': true\n })) {\n return Collections.find();\n }\n});\n\nMeteor.publish('adminUser', function() { // used by login page to see if admin has been created yet\n return Meteor.users.find({\n 'profile.admin': true\n }, {\n fields: {\n 'profile.admin': true\n }\n });\n});\n```", "response": "publish_to_admin_with_pagination = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()\n\n\n# publish our own internal state\nMeteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "eb1016772c4e7ce8bb8698aad6c7d891e869155c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/eb1016772c4e7ce8bb8698aad6c7d891e869155c/server/publications.coffee", "line_start": 100, "line_end": 113} +{"id": "gterrono/houston:server/publications.coffee:1:completion", "type": "completion", "prompt": "publish_to_admin_with_pagination = (name, publish_func) ->\n Meteor.publish name, ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n publish_func()\n\n\n# publish our own internal state", "response": "Meteor.publish \"admin\", ->\n if Meteor.users.findOne(_id: @userId, 'profile.admin': true)\n Collections.find()\n\n\nMeteor.publish 'adminUser', -> # used by login page to see if admin has been created yet\n Meteor.users.find({'profile.admin': true}, fields: 'profile.admin': true)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "server/publications.coffee", "license": "MIT", "commit": "eb1016772c4e7ce8bb8698aad6c7d891e869155c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/eb1016772c4e7ce8bb8698aad6c7d891e869155c/server/publications.coffee", "line_start": 100, "line_end": 113} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe 'GET /devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe 'GET /devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n```", "response": "var MeshbluConfig, MeshbluHTTP, _, meshblu, path, request, url;\n\n_ = require('lodash');\n\npath = require('path');\n\nurl = require('url');\n\nMeshbluHTTP = require('meshblu-http');\n\nMeshbluConfig = require('meshblu-config');\n\nmeshblu = require('meshblu');\n\nrequest = require('request');\n\ndescribe('REST', function() {\n before(function(done) {\n var filename;\n filename = path.join(__dirname, 'meshblu.json');\n this.config = new MeshbluConfig({\n filename: filename\n }).toJSON();\n this.meshblu = new MeshbluHTTP(this.config);\n this.conx = meshblu.createConnection({\n server: this.config.server,\n port: this.config.port,\n uuid: this.config.uuid,\n token: this.config.token\n });\n this.conx.on('ready', () => {\n return done();\n });\n return this.conx.on('notReady', done);\n });\n it('should get here', function() {\n return expect(true).to.be.true;\n });\n return describe('GET /devices', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({}, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n return describe('when called with an invalid request', function() {\n return beforeEach(function(done) {\n return this.meshblu.devices({\n uuid: 'invalid-uuid'\n }, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar MeshbluConfig, MeshbluHTTP, _, meshblu, path, request, url;\n\n_ = require('lodash');\n\npath = require('path');\n\nurl = require('url');\n\nMeshbluHTTP = require('meshblu-http');\n\nMeshbluConfig = require('meshblu-config');\n\nmeshblu = require('meshblu');\n\nrequest = require('request');\n\ndescribe('REST', function() {\n before(function(done) {\n var filename;\n filename = path.join(__dirname, 'meshblu.json');\n this.config = new MeshbluConfig({\n filename: filename\n }).toJSON();\n this.meshblu = new MeshbluHTTP(this.config);\n this.conx = meshblu.createConnection({\n server: this.config.server,\n port: this.config.port,\n uuid: this.config.uuid,\n token: this.config.token\n });\n this.conx.on('ready', () => {\n return done();\n });\n return this.conx.on('notReady', done);\n });\n it('should get here', function() {\n return expect(true).to.be.true;\n });\n return describe('GET /devices', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({}, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n return describe('when called with an invalid request', function() {\n return beforeEach(function(done) {\n return this.meshblu.devices({\n uuid: 'invalid-uuid'\n }, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n });\n });\n});\n```", "response": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe 'GET /devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:completion", "type": "completion", "prompt": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done", "response": "it 'should get here', ->\n expect(true).to.be.true\n\n describe 'GET /devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe 'GET /devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nit 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe 'GET /devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n```", "response": "it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n});\n\ndescribe('GET /devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = `/devices/${this.config.uuid}`;\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n uuid: this.config.uuid\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = \"/devices/invalid-uuid\";\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nit('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n});\n\ndescribe('GET /devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = `/devices/${this.config.uuid}`;\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n uuid: this.config.uuid\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = \"/devices/invalid-uuid\";\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n});\n```", "response": "it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe 'GET /devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:completion", "type": "completion", "prompt": "it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe 'GET /devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {", "response": "fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "describe 'GET /v2/whoami', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.whoami (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"whoami\" message', ->\n expect(@message.topic).to.deep.equal 'whoami'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'GET /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.device @config.uuid, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.device 'invalid-uuid', (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: 'Devices not found'\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 93, "line_end": 137} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndescribe 'GET /v2/whoami', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.whoami (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"whoami\" message', ->\n expect(@message.topic).to.deep.equal 'whoami'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'GET /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.device @config.uuid, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.device 'invalid-uuid', (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: 'Devices not found'\n request:\n uuid: 'invalid-uuid'\n }\n```", "response": "describe('GET /v2/whoami', function() {\n return describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.whoami((error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"whoami\" message', function() {\n expect(this.message.topic).to.deep.equal('whoami');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n});\n\ndescribe('GET /v2/devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.device(this.config.uuid, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n uuid: this.config.uuid\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n return this.meshblu.device('invalid-uuid', (error) => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: 'Devices not found',\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 93, "line_end": 137} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndescribe('GET /v2/whoami', function() {\n return describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.whoami((error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"whoami\" message', function() {\n expect(this.message.topic).to.deep.equal('whoami');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n});\n\ndescribe('GET /v2/devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.device(this.config.uuid, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n uuid: this.config.uuid\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n return this.meshblu.device('invalid-uuid', (error) => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: 'Devices not found',\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n});\n```", "response": "describe 'GET /v2/whoami', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.whoami (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"whoami\" message', ->\n expect(@message.topic).to.deep.equal 'whoami'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'GET /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.device @config.uuid, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.device 'invalid-uuid', (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: 'Devices not found'\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 93, "line_end": 137} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:3:completion", "type": "completion", "prompt": "describe 'GET /v2/whoami', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.whoami (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"whoami\" message', ->\n expect(@message.topic).to.deep.equal 'whoami'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'GET /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.device @config.uuid, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()", "response": "it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.device 'invalid-uuid', (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: 'Devices not found'\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 93, "line_end": 137} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "describe 'PATCH /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, foo: 'bar', (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"update\" message', ->\n expect(@message.topic).to.deep.equal 'update'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {foo: 'bar'}}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, {$foo: 'bar'}, (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send an \"update-error\" message', ->\n expect(@message.topic).to.deep.equal 'update-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"The dollar ($) prefixed field '$foo' in '$foo' is not valid for storage.\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {\"$foo\": 'bar'}}\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 139, "line_end": 170} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndescribe 'PATCH /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, foo: 'bar', (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"update\" message', ->\n expect(@message.topic).to.deep.equal 'update'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {foo: 'bar'}}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, {$foo: 'bar'}, (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send an \"update-error\" message', ->\n expect(@message.topic).to.deep.equal 'update-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"The dollar ($) prefixed field '$foo' in '$foo' is not valid for storage.\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {\"$foo\": 'bar'}}\n }\n```", "response": "describe('PATCH /v2/devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.update(this.config.uuid, {\n foo: 'bar'\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"update\" message', function() {\n expect(this.message.topic).to.deep.equal('update');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n query: {\n uuid: this.config.uuid\n },\n params: {\n $set: {\n foo: 'bar'\n }\n }\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n return this.meshblu.update(this.config.uuid, {\n $foo: 'bar'\n }, (error) => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send an \"update-error\" message', function() {\n expect(this.message.topic).to.deep.equal('update-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"The dollar ($) prefixed field '$foo' in '$foo' is not valid for storage.\",\n request: {\n query: {\n uuid: this.config.uuid\n },\n params: {\n $set: {\n \"$foo\": 'bar'\n }\n }\n }\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 139, "line_end": 170} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndescribe('PATCH /v2/devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.update(this.config.uuid, {\n foo: 'bar'\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"update\" message', function() {\n expect(this.message.topic).to.deep.equal('update');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n query: {\n uuid: this.config.uuid\n },\n params: {\n $set: {\n foo: 'bar'\n }\n }\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n return this.meshblu.update(this.config.uuid, {\n $foo: 'bar'\n }, (error) => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send an \"update-error\" message', function() {\n expect(this.message.topic).to.deep.equal('update-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"The dollar ($) prefixed field '$foo' in '$foo' is not valid for storage.\",\n request: {\n query: {\n uuid: this.config.uuid\n },\n params: {\n $set: {\n \"$foo\": 'bar'\n }\n }\n }\n });\n });\n });\n});\n```", "response": "describe 'PATCH /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, foo: 'bar', (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"update\" message', ->\n expect(@message.topic).to.deep.equal 'update'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {foo: 'bar'}}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, {$foo: 'bar'}, (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send an \"update-error\" message', ->\n expect(@message.topic).to.deep.equal 'update-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"The dollar ($) prefixed field '$foo' in '$foo' is not valid for storage.\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {\"$foo\": 'bar'}}\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 139, "line_end": 170} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:4:completion", "type": "completion", "prompt": "describe 'PATCH /v2/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, foo: 'bar', (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"update\" message', ->\n expect(@message.topic).to.deep.equal 'update'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {foo: 'bar'}}\n }", "response": "describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.update @config.uuid, {$foo: 'bar'}, (error) =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send an \"update-error\" message', ->\n expect(@message.topic).to.deep.equal 'update-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"The dollar ($) prefixed field '$foo' in '$foo' is not valid for storage.\"\n request:\n query: {uuid: @config.uuid}\n params: {$set: {\"$foo\": 'bar'}}\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "72718bfe5bfbea9f47c53308cea7bc61c52931d7", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/72718bfe5bfbea9f47c53308cea7bc61c52931d7/integration/rest-spec.coffee", "line_start": 139, "line_end": 170} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n```", "response": "var MeshbluConfig, MeshbluHTTP, _, meshblu, path, request, url;\n\n_ = require('lodash');\n\npath = require('path');\n\nurl = require('url');\n\nMeshbluHTTP = require('meshblu-http');\n\nMeshbluConfig = require('meshblu-config');\n\nmeshblu = require('meshblu');\n\nrequest = require('request');\n\ndescribe('REST', function() {\n before(function(done) {\n var filename;\n filename = path.join(__dirname, 'meshblu.json');\n this.config = new MeshbluConfig({\n filename: filename\n }).toJSON();\n this.meshblu = new MeshbluHTTP(this.config);\n this.conx = meshblu.createConnection({\n server: this.config.server,\n port: this.config.port,\n uuid: this.config.uuid,\n token: this.config.token\n });\n this.conx.on('ready', () => {\n return done();\n });\n return this.conx.on('notReady', done);\n });\n it('should get here', function() {\n return expect(true).to.be.true;\n });\n return describe('/devices', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({}, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n return describe('when called with an invalid request', function() {\n return beforeEach(function(done) {\n return this.meshblu.devices({\n uuid: 'invalid-uuid'\n }, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar MeshbluConfig, MeshbluHTTP, _, meshblu, path, request, url;\n\n_ = require('lodash');\n\npath = require('path');\n\nurl = require('url');\n\nMeshbluHTTP = require('meshblu-http');\n\nMeshbluConfig = require('meshblu-config');\n\nmeshblu = require('meshblu');\n\nrequest = require('request');\n\ndescribe('REST', function() {\n before(function(done) {\n var filename;\n filename = path.join(__dirname, 'meshblu.json');\n this.config = new MeshbluConfig({\n filename: filename\n }).toJSON();\n this.meshblu = new MeshbluHTTP(this.config);\n this.conx = meshblu.createConnection({\n server: this.config.server,\n port: this.config.port,\n uuid: this.config.uuid,\n token: this.config.token\n });\n this.conx.on('ready', () => {\n return done();\n });\n return this.conx.on('notReady', done);\n });\n it('should get here', function() {\n return expect(true).to.be.true;\n });\n return describe('/devices', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({}, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n return describe('when called with an invalid request', function() {\n return beforeEach(function(done) {\n return this.meshblu.devices({\n uuid: 'invalid-uuid'\n }, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n });\n });\n});\n```", "response": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:completion", "type": "completion", "prompt": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done", "response": "it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 1, "line_end": 44} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe '/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nit 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe '/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n```", "response": "it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n});\n\ndescribe('/devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = `/devices/${this.config.uuid}`;\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n uuid: this.config.uuid\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = \"/devices/invalid-uuid\";\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nit('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n});\n\ndescribe('/devices/:uuid', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = `/devices/${this.config.uuid}`;\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {\n uuid: this.config.uuid\n }\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n var auth, pathname, uri;\n pathname = \"/devices/invalid-uuid\";\n uri = url.format({\n protocol: this.config.protocol,\n hostname: this.config.server,\n port: this.config.port,\n pathname: pathname\n });\n auth = {\n user: this.config.uuid,\n pass: this.config.token\n };\n return request.get(uri, {\n auth: auth\n }, (error) => {\n if (error != null) {\n return done(error);\n }\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n});\n```", "response": "it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe '/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:completion", "type": "completion", "prompt": "it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n\n describe '/devices/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {", "response": "fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request:\n uuid: @config.uuid\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n pathname = \"/devices/invalid-uuid\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n auth = user: @config.uuid, pass: @config.token\n request.get uri, auth: auth, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "2075133e6fe1feec355b369e2c8978a254891dde", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/2075133e6fe1feec355b369e2c8978a254891dde/integration/rest-spec.coffee", "line_start": 46, "line_end": 91} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "e82d7328d24647cb39b0cc6aeb331a2272182878", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/e82d7328d24647cb39b0cc6aeb331a2272182878/integration/rest-spec.coffee", "line_start": 1, "line_end": 50} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:completion", "type": "completion", "prompt": "_ = require 'lodash'\npath = require 'path'\nurl = require 'url'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\nrequest = require 'request'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true", "response": "describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "e82d7328d24647cb39b0cc6aeb331a2272182878", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/e82d7328d24647cb39b0cc6aeb331a2272182878/integration/rest-spec.coffee", "line_start": 1, "line_end": 50} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "request:\n uuid: 'invalid-uuid'\n }\n\n describe '/device/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"\n uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n request.get uri, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"device\" message', ->\n expect(@message.topic).to.deep.equal 'device'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "e82d7328d24647cb39b0cc6aeb331a2272182878", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/e82d7328d24647cb39b0cc6aeb331a2272182878/integration/rest-spec.coffee", "line_start": 51, "line_end": 66} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:2:completion", "type": "completion", "prompt": "request:\n uuid: 'invalid-uuid'\n }\n\n describe '/device/:uuid', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n pathname = \"/devices/#{@config.uuid}\"", "response": "uri = url.format protocol: @config.protocol, hostname: @config.server, port: @config.port, pathname: pathname\n request.get uri, (error) =>\n return done error if error?\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"device\" message', ->\n expect(@message.topic).to.deep.equal 'device'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "e82d7328d24647cb39b0cc6aeb331a2272182878", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/e82d7328d24647cb39b0cc6aeb331a2272182878/integration/rest-spec.coffee", "line_start": 51, "line_end": 66} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "path = require 'path'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "28ccd25f88f0b16104dad02f5514b42ca9e42010", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/28ccd25f88f0b16104dad02f5514b42ca9e42010/integration/rest-spec.coffee", "line_start": 1, "line_end": 50} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npath = require 'path'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }\n```", "response": "var MeshbluConfig, MeshbluHTTP, meshblu, path;\n\npath = require('path');\n\nMeshbluHTTP = require('meshblu-http');\n\nMeshbluConfig = require('meshblu-config');\n\nmeshblu = require('meshblu');\n\ndescribe('REST', function() {\n before(function(done) {\n var filename;\n filename = path.join(__dirname, 'meshblu.json');\n this.config = new MeshbluConfig({\n filename: filename\n }).toJSON();\n this.meshblu = new MeshbluHTTP(this.config);\n this.conx = meshblu.createConnection({\n server: this.config.server,\n port: this.config.port,\n uuid: this.config.uuid,\n token: this.config.token\n });\n this.conx.on('ready', () => {\n return done();\n });\n return this.conx.on('notReady', done);\n });\n it('should get here', function() {\n return expect(true).to.be.true;\n });\n return describe('/devices', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({}, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({\n uuid: 'invalid-uuid'\n }, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "28ccd25f88f0b16104dad02f5514b42ca9e42010", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/28ccd25f88f0b16104dad02f5514b42ca9e42010/integration/rest-spec.coffee", "line_start": 1, "line_end": 50} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar MeshbluConfig, MeshbluHTTP, meshblu, path;\n\npath = require('path');\n\nMeshbluHTTP = require('meshblu-http');\n\nMeshbluConfig = require('meshblu-config');\n\nmeshblu = require('meshblu');\n\ndescribe('REST', function() {\n before(function(done) {\n var filename;\n filename = path.join(__dirname, 'meshblu.json');\n this.config = new MeshbluConfig({\n filename: filename\n }).toJSON();\n this.meshblu = new MeshbluHTTP(this.config);\n this.conx = meshblu.createConnection({\n server: this.config.server,\n port: this.config.port,\n uuid: this.config.uuid,\n token: this.config.token\n });\n this.conx.on('ready', () => {\n return done();\n });\n return this.conx.on('notReady', done);\n });\n it('should get here', function() {\n return expect(true).to.be.true;\n });\n return describe('/devices', function() {\n describe('when called with a valid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({}, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices\" message', function() {\n expect(this.message.topic).to.deep.equal('devices');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n request: {}\n });\n });\n });\n return describe('when called with an invalid request', function() {\n beforeEach(function(done) {\n return this.meshblu.devices({\n uuid: 'invalid-uuid'\n }, () => {\n return this.conx.once('message', (message) => {\n this.message = message;\n return done();\n });\n });\n });\n return it('should send a \"devices-error\" message', function() {\n expect(this.message.topic).to.deep.equal('devices-error');\n return expect(this.message.payload).to.deep.equal({\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\",\n error: \"Devices not found\",\n request: {\n uuid: 'invalid-uuid'\n }\n });\n });\n });\n });\n});\n```", "response": "path = require 'path'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->\n @meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "28ccd25f88f0b16104dad02f5514b42ca9e42010", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/28ccd25f88f0b16104dad02f5514b42ca9e42010/integration/rest-spec.coffee", "line_start": 1, "line_end": 50} +{"id": "octoblu/meshblu:integration/rest-spec.coffee:1:completion", "type": "completion", "prompt": "path = require 'path'\nMeshbluHTTP = require 'meshblu-http'\nMeshbluConfig = require 'meshblu-config'\nmeshblu = require 'meshblu'\n\ndescribe 'REST', ->\n before (done) ->\n filename = path.join __dirname, 'meshblu.json'\n @config = new MeshbluConfig(filename: filename).toJSON()\n @meshblu = new MeshbluHTTP @config\n @conx = meshblu.createConnection\n server : @config.server\n port : @config.port\n uuid : @config.uuid\n token : @config.token\n\n @conx.on 'ready', => done()\n @conx.on 'notReady', done\n\n it 'should get here', ->\n expect(true).to.be.true\n\n describe '/devices', ->\n describe 'when called with a valid request', ->\n beforeEach (done) ->", "response": "@meshblu.devices {}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices\" message', ->\n expect(@message.topic).to.deep.equal 'devices'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n request: {}\n }\n\n describe 'when called with an invalid request', ->\n beforeEach (done) ->\n @meshblu.devices {uuid: 'invalid-uuid'}, =>\n @conx.once 'message', (@message) =>\n done()\n\n it 'should send a \"devices-error\" message', ->\n expect(@message.topic).to.deep.equal 'devices-error'\n expect(@message.payload).to.deep.equal {\n fromUuid: \"66b2928b-a317-4bc3-893e-245946e9672a\"\n error: \"Devices not found\"\n request:\n uuid: 'invalid-uuid'\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "integration/rest-spec.coffee", "license": "MIT", "commit": "28ccd25f88f0b16104dad02f5514b42ca9e42010", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/28ccd25f88f0b16104dad02f5514b42ca9e42010/integration/rest-spec.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:src/Util/ImageCache.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class ImageCache\n constructor: ->\n @_images = {}\n @_callbacksToRun = {}\n\n getSync: (url) ->\n @_images[url] # will be undefined if url is not saved\n\n get: (url, callback) ->\n # Either the image is cached...\n if @_images[url]\n callback(@_images[url])\n\n # Or it is already being loaded...\n else if @_callbacksToRun[url]\n @_callbacksToRun[url].push(callback)\n\n # Or it's totally new...\n else\n @_callbacksToRun[url] = [callback]\n\n image = new Image()\n if not url.startsWith(\"data:\")\n # (Safari doesn't like .crossOrigin when loading \"data:\" URLs)\n image.crossOrigin = \"Anonymous\"\n image.addEventListener \"load\", =>\n @_images[url] = image\n anyCallback(image) for anyCallback in @_callbacksToRun[url]\n delete @_callbacksToRun[url]\n image.src = url", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Util/ImageCache.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/ImageCache.coffee", "line_start": 1, "line_end": 30} +{"id": "cdglabs/apparatus:src/Util/ImageCache.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class ImageCache\n constructor: ->\n @_images = {}\n @_callbacksToRun = {}\n\n getSync: (url) ->\n @_images[url] # will be undefined if url is not saved\n\n get: (url, callback) ->\n # Either the image is cached...\n if @_images[url]\n callback(@_images[url])\n\n # Or it is already being loaded...\n else if @_callbacksToRun[url]\n @_callbacksToRun[url].push(callback)\n\n # Or it's totally new...\n else\n @_callbacksToRun[url] = [callback]\n\n image = new Image()\n if not url.startsWith(\"data:\")\n # (Safari doesn't like .crossOrigin when loading \"data:\" URLs)\n image.crossOrigin = \"Anonymous\"\n image.addEventListener \"load\", =>\n @_images[url] = image\n anyCallback(image) for anyCallback in @_callbacksToRun[url]\n delete @_callbacksToRun[url]\n image.src = url\n```", "response": "var ImageCache;\n\nmodule.exports = ImageCache = class ImageCache {\n constructor() {\n this._images = {};\n this._callbacksToRun = {};\n }\n\n getSync(url) {\n return this._images[url];\n }\n\n get(url, callback) {\n var image;\n // Either the image is cached...\n if (this._images[url]) {\n return callback(this._images[url]);\n // Or it is already being loaded...\n } else if (this._callbacksToRun[url]) {\n return this._callbacksToRun[url].push(callback);\n } else {\n // Or it's totally new...\n this._callbacksToRun[url] = [callback];\n image = new Image();\n if (!url.startsWith(\"data:\")) {\n // (Safari doesn't like .crossOrigin when loading \"data:\" URLs)\n image.crossOrigin = \"Anonymous\";\n }\n image.addEventListener(\"load\", () => {\n var anyCallback, i, len, ref;\n this._images[url] = image;\n ref = this._callbacksToRun[url];\n for (i = 0, len = ref.length; i < len; i++) {\n anyCallback = ref[i];\n anyCallback(image);\n }\n return delete this._callbacksToRun[url];\n });\n return image.src = url;\n }\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Util/ImageCache.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/ImageCache.coffee", "line_start": 1, "line_end": 30} +{"id": "cdglabs/apparatus:src/Util/ImageCache.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar ImageCache;\n\nmodule.exports = ImageCache = class ImageCache {\n constructor() {\n this._images = {};\n this._callbacksToRun = {};\n }\n\n getSync(url) {\n return this._images[url];\n }\n\n get(url, callback) {\n var image;\n // Either the image is cached...\n if (this._images[url]) {\n return callback(this._images[url]);\n // Or it is already being loaded...\n } else if (this._callbacksToRun[url]) {\n return this._callbacksToRun[url].push(callback);\n } else {\n // Or it's totally new...\n this._callbacksToRun[url] = [callback];\n image = new Image();\n if (!url.startsWith(\"data:\")) {\n // (Safari doesn't like .crossOrigin when loading \"data:\" URLs)\n image.crossOrigin = \"Anonymous\";\n }\n image.addEventListener(\"load\", () => {\n var anyCallback, i, len, ref;\n this._images[url] = image;\n ref = this._callbacksToRun[url];\n for (i = 0, len = ref.length; i < len; i++) {\n anyCallback = ref[i];\n anyCallback(image);\n }\n return delete this._callbacksToRun[url];\n });\n return image.src = url;\n }\n }\n\n};\n```", "response": "module.exports = class ImageCache\n constructor: ->\n @_images = {}\n @_callbacksToRun = {}\n\n getSync: (url) ->\n @_images[url] # will be undefined if url is not saved\n\n get: (url, callback) ->\n # Either the image is cached...\n if @_images[url]\n callback(@_images[url])\n\n # Or it is already being loaded...\n else if @_callbacksToRun[url]\n @_callbacksToRun[url].push(callback)\n\n # Or it's totally new...\n else\n @_callbacksToRun[url] = [callback]\n\n image = new Image()\n if not url.startsWith(\"data:\")\n # (Safari doesn't like .crossOrigin when loading \"data:\" URLs)\n image.crossOrigin = \"Anonymous\"\n image.addEventListener \"load\", =>\n @_images[url] = image\n anyCallback(image) for anyCallback in @_callbacksToRun[url]\n delete @_callbacksToRun[url]\n image.src = url", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Util/ImageCache.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/ImageCache.coffee", "line_start": 1, "line_end": 30} +{"id": "cdglabs/apparatus:src/Util/ImageCache.coffee:1:completion", "type": "completion", "prompt": "module.exports = class ImageCache\n constructor: ->\n @_images = {}\n @_callbacksToRun = {}\n\n getSync: (url) ->\n @_images[url] # will be undefined if url is not saved\n\n get: (url, callback) ->\n # Either the image is cached...\n if @_images[url]\n callback(@_images[url])\n\n # Or it is already being loaded...\n else if @_callbacksToRun[url]", "response": "@_callbacksToRun[url].push(callback)\n\n # Or it's totally new...\n else\n @_callbacksToRun[url] = [callback]\n\n image = new Image()\n if not url.startsWith(\"data:\")\n # (Safari doesn't like .crossOrigin when loading \"data:\" URLs)\n image.crossOrigin = \"Anonymous\"\n image.addEventListener \"load\", =>\n @_images[url] = image\n anyCallback(image) for anyCallback in @_callbacksToRun[url]\n delete @_callbacksToRun[url]\n image.src = url", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Util/ImageCache.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/ImageCache.coffee", "line_start": 1, "line_end": 30} +{"id": "octoblu/meshblu:test/lib/getDevice-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'lodash'\nTestDatabase = require '../test-database'\n\ndescribe 'getDevice', ->\n beforeEach (done) ->\n @sut = require '../../lib/getDevice'\n TestDatabase.open (error, database) =>\n @database = database\n done error\n\n describe 'when a device does not exist', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'does-not-exist', storeDevice, @database\n\n it 'should not have a device', ->\n expect(@device).to.not.exist\n\n it 'should have an error', ->\n expect(@error).to.exist\n\n describe 'when a device exists', ->\n beforeEach (done) ->\n @devices = @database.devices\n @devices.insert uuid: 'valid-uuid', token: 'some-token', done\n\n describe 'when passed a valid uuid', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'valid-uuid', storeDevice, @database\n\n it 'should have a device', ->\n expect(@device).to.exist\n\n it 'should not have an error', ->\n expect(@error).to.not.exist\n\n it 'should not have a token', ->\n expect(@device.token).to.not.exist", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/lib/getDevice-spec.coffee", "license": "MIT", "commit": "7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5/test/lib/getDevice-spec.coffee", "line_start": 1, "line_end": 39} +{"id": "octoblu/meshblu:test/lib/getDevice-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require 'lodash'\nTestDatabase = require '../test-database'\n\ndescribe 'getDevice', ->\n beforeEach (done) ->\n @sut = require '../../lib/getDevice'\n TestDatabase.open (error, database) =>\n @database = database\n done error\n\n describe 'when a device does not exist', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'does-not-exist', storeDevice, @database\n\n it 'should not have a device', ->\n expect(@device).to.not.exist\n\n it 'should have an error', ->\n expect(@error).to.exist\n\n describe 'when a device exists', ->\n beforeEach (done) ->\n @devices = @database.devices\n @devices.insert uuid: 'valid-uuid', token: 'some-token', done\n\n describe 'when passed a valid uuid', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'valid-uuid', storeDevice, @database\n\n it 'should have a device', ->\n expect(@device).to.exist\n\n it 'should not have an error', ->\n expect(@error).to.not.exist\n\n it 'should not have a token', ->\n expect(@device.token).to.not.exist\n```", "response": "var TestDatabase, _;\n\n_ = require('lodash');\n\nTestDatabase = require('../test-database');\n\ndescribe('getDevice', function() {\n beforeEach(function(done) {\n this.sut = require('../../lib/getDevice');\n return TestDatabase.open((error, database) => {\n this.database = database;\n return done(error);\n });\n });\n describe('when a device does not exist', function() {\n beforeEach(function(done) {\n var storeDevice;\n storeDevice = (error1, device) => {\n this.error = error1;\n this.device = device;\n return done();\n };\n return this.sut('does-not-exist', storeDevice, this.database);\n });\n it('should not have a device', function() {\n return expect(this.device).to.not.exist;\n });\n return it('should have an error', function() {\n return expect(this.error).to.exist;\n });\n });\n return describe('when a device exists', function() {\n beforeEach(function(done) {\n this.devices = this.database.devices;\n return this.devices.insert({\n uuid: 'valid-uuid',\n token: 'some-token'\n }, done);\n });\n return describe('when passed a valid uuid', function() {\n beforeEach(function(done) {\n var storeDevice;\n storeDevice = (error1, device) => {\n this.error = error1;\n this.device = device;\n return done();\n };\n return this.sut('valid-uuid', storeDevice, this.database);\n });\n it('should have a device', function() {\n return expect(this.device).to.exist;\n });\n it('should not have an error', function() {\n return expect(this.error).to.not.exist;\n });\n return it('should not have a token', function() {\n return expect(this.device.token).to.not.exist;\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "test/lib/getDevice-spec.coffee", "license": "MIT", "commit": "7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5/test/lib/getDevice-spec.coffee", "line_start": 1, "line_end": 39} +{"id": "octoblu/meshblu:test/lib/getDevice-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar TestDatabase, _;\n\n_ = require('lodash');\n\nTestDatabase = require('../test-database');\n\ndescribe('getDevice', function() {\n beforeEach(function(done) {\n this.sut = require('../../lib/getDevice');\n return TestDatabase.open((error, database) => {\n this.database = database;\n return done(error);\n });\n });\n describe('when a device does not exist', function() {\n beforeEach(function(done) {\n var storeDevice;\n storeDevice = (error1, device) => {\n this.error = error1;\n this.device = device;\n return done();\n };\n return this.sut('does-not-exist', storeDevice, this.database);\n });\n it('should not have a device', function() {\n return expect(this.device).to.not.exist;\n });\n return it('should have an error', function() {\n return expect(this.error).to.exist;\n });\n });\n return describe('when a device exists', function() {\n beforeEach(function(done) {\n this.devices = this.database.devices;\n return this.devices.insert({\n uuid: 'valid-uuid',\n token: 'some-token'\n }, done);\n });\n return describe('when passed a valid uuid', function() {\n beforeEach(function(done) {\n var storeDevice;\n storeDevice = (error1, device) => {\n this.error = error1;\n this.device = device;\n return done();\n };\n return this.sut('valid-uuid', storeDevice, this.database);\n });\n it('should have a device', function() {\n return expect(this.device).to.exist;\n });\n it('should not have an error', function() {\n return expect(this.error).to.not.exist;\n });\n return it('should not have a token', function() {\n return expect(this.device.token).to.not.exist;\n });\n });\n });\n});\n```", "response": "_ = require 'lodash'\nTestDatabase = require '../test-database'\n\ndescribe 'getDevice', ->\n beforeEach (done) ->\n @sut = require '../../lib/getDevice'\n TestDatabase.open (error, database) =>\n @database = database\n done error\n\n describe 'when a device does not exist', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'does-not-exist', storeDevice, @database\n\n it 'should not have a device', ->\n expect(@device).to.not.exist\n\n it 'should have an error', ->\n expect(@error).to.exist\n\n describe 'when a device exists', ->\n beforeEach (done) ->\n @devices = @database.devices\n @devices.insert uuid: 'valid-uuid', token: 'some-token', done\n\n describe 'when passed a valid uuid', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'valid-uuid', storeDevice, @database\n\n it 'should have a device', ->\n expect(@device).to.exist\n\n it 'should not have an error', ->\n expect(@error).to.not.exist\n\n it 'should not have a token', ->\n expect(@device.token).to.not.exist", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/lib/getDevice-spec.coffee", "license": "MIT", "commit": "7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5/test/lib/getDevice-spec.coffee", "line_start": 1, "line_end": 39} +{"id": "octoblu/meshblu:test/lib/getDevice-spec.coffee:1:completion", "type": "completion", "prompt": "_ = require 'lodash'\nTestDatabase = require '../test-database'\n\ndescribe 'getDevice', ->\n beforeEach (done) ->\n @sut = require '../../lib/getDevice'\n TestDatabase.open (error, database) =>\n @database = database\n done error\n\n describe 'when a device does not exist', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'does-not-exist', storeDevice, @database\n\n it 'should not have a device', ->\n expect(@device).to.not.exist\n\n it 'should have an error', ->", "response": "expect(@error).to.exist\n\n describe 'when a device exists', ->\n beforeEach (done) ->\n @devices = @database.devices\n @devices.insert uuid: 'valid-uuid', token: 'some-token', done\n\n describe 'when passed a valid uuid', ->\n beforeEach (done) ->\n storeDevice = (@error, @device) => done()\n @sut 'valid-uuid', storeDevice, @database\n\n it 'should have a device', ->\n expect(@device).to.exist\n\n it 'should not have an error', ->\n expect(@error).to.not.exist\n\n it 'should not have a token', ->\n expect(@device.token).to.not.exist", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/lib/getDevice-spec.coffee", "license": "MIT", "commit": "7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/7b2b76a0707d26f2ffd7db6dcfbb6c4cfdf690f5/test/lib/getDevice-spec.coffee", "line_start": 1, "line_end": 39} +{"id": "xhan/qqbot:src/apiserver.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "on_stdin = (req,res,params)->\n value = params.value.trim()\n log.info 'stdin value',value\n process.emit 'data', value\n res.endjson()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 51, "line_end": 55} +{"id": "xhan/qqbot:src/apiserver.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\non_stdin = (req,res,params)->\n value = params.value.trim()\n log.info 'stdin value',value\n process.emit 'data', value\n res.endjson()\n```", "response": "var on_stdin;\n\non_stdin = function(req, res, params) {\n var value;\n value = params.value.trim();\n log.info('stdin value', value);\n process.emit('data', value);\n return res.endjson();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 51, "line_end": 55} +{"id": "xhan/qqbot:src/apiserver.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar on_stdin;\n\non_stdin = function(req, res, params) {\n var value;\n value = params.value.trim();\n log.info('stdin value', value);\n process.emit('data', value);\n return res.endjson();\n};\n```", "response": "on_stdin = (req,res,params)->\n value = params.value.trim()\n log.info 'stdin value',value\n process.emit 'data', value\n res.endjson()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 51, "line_end": 55} +{"id": "xhan/qqbot:src/apiserver.coffee:2:completion", "type": "completion", "prompt": "on_stdin = (req,res,params)->\n value = params.value.trim()", "response": "log.info 'stdin value',value\n process.emit 'data', value\n res.endjson()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 51, "line_end": 55} +{"id": "xhan/qqbot:src/apiserver.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "on_sendmsg = (req,res,params)->\n log.info \"will send #{params.type} #{params.to} : #{params.msg}\"\n if params.type == 'buddy'\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}\n else if params.type == 'group'\n cb_sendmessage params.to, params.msg, res\n else\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 57, "line_end": 68} +{"id": "xhan/qqbot:src/apiserver.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\non_sendmsg = (req,res,params)->\n log.info \"will send #{params.type} #{params.to} : #{params.msg}\"\n if params.type == 'buddy'\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}\n else if params.type == 'group'\n cb_sendmessage params.to, params.msg, res\n else\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}\n```", "response": "var on_sendmsg;\n\non_sendmsg = function(req, res, params) {\n var msg;\n log.info(`will send ${params.type} ${params.to} : ${params.msg}`);\n if (params.type === 'buddy') {\n msg = `unimplement type ${params.type}`;\n log.warning(msg);\n return res.endjson({\n err: 100,\n msg: msg\n });\n } else if (params.type === 'group') {\n return cb_sendmessage(params.to, params.msg, res);\n } else {\n msg = `unimplement type ${params.type}`;\n log.warning(msg);\n return res.endjson({\n err: 100,\n msg: msg\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 57, "line_end": 68} +{"id": "xhan/qqbot:src/apiserver.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar on_sendmsg;\n\non_sendmsg = function(req, res, params) {\n var msg;\n log.info(`will send ${params.type} ${params.to} : ${params.msg}`);\n if (params.type === 'buddy') {\n msg = `unimplement type ${params.type}`;\n log.warning(msg);\n return res.endjson({\n err: 100,\n msg: msg\n });\n } else if (params.type === 'group') {\n return cb_sendmessage(params.to, params.msg, res);\n } else {\n msg = `unimplement type ${params.type}`;\n log.warning(msg);\n return res.endjson({\n err: 100,\n msg: msg\n });\n }\n};\n```", "response": "on_sendmsg = (req,res,params)->\n log.info \"will send #{params.type} #{params.to} : #{params.msg}\"\n if params.type == 'buddy'\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}\n else if params.type == 'group'\n cb_sendmessage params.to, params.msg, res\n else\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 57, "line_end": 68} +{"id": "xhan/qqbot:src/apiserver.coffee:3:completion", "type": "completion", "prompt": "on_sendmsg = (req,res,params)->\n log.info \"will send #{params.type} #{params.to} : #{params.msg}\"\n if params.type == 'buddy'\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}", "response": "else if params.type == 'group'\n cb_sendmessage params.to, params.msg, res\n else\n msg = \"unimplement type #{params.type}\"\n log.warning msg\n res.endjson {err:100,msg:msg}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 57, "line_end": 68} +{"id": "xhan/qqbot:src/apiserver.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "handle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200\n res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)\n when '/reload'then on_reload_plugin(req,res,params)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 73, "line_end": 91} +{"id": "xhan/qqbot:src/apiserver.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nhandle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200\n res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)\n when '/reload'then on_reload_plugin(req,res,params)\n```", "response": "var handle_request;\n\nhandle_request = function(req, res, path, params) {\n res.endjson = function(dict = {}) {\n var key, ret_dict, value;\n ret_dict = {\n err: 0,\n msg: 'ok'\n };\n for (key in dict) {\n value = dict[key];\n ret_dict[key] = value;\n }\n res.writeHead(200);\n return res.end(jsons(ret_dict));\n };\n if (config_token && params.token !== config_token) {\n res.endjson({\n err: 503,\n msg: 'token failed'\n });\n return;\n }\n switch (path) {\n case '/stdin':\n return on_stdin(req, res, params);\n case '/send':\n return on_sendmsg(req, res, params);\n case '/reload':\n return on_reload_plugin(req, res, params);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 73, "line_end": 91} +{"id": "xhan/qqbot:src/apiserver.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar handle_request;\n\nhandle_request = function(req, res, path, params) {\n res.endjson = function(dict = {}) {\n var key, ret_dict, value;\n ret_dict = {\n err: 0,\n msg: 'ok'\n };\n for (key in dict) {\n value = dict[key];\n ret_dict[key] = value;\n }\n res.writeHead(200);\n return res.end(jsons(ret_dict));\n };\n if (config_token && params.token !== config_token) {\n res.endjson({\n err: 503,\n msg: 'token failed'\n });\n return;\n }\n switch (path) {\n case '/stdin':\n return on_stdin(req, res, params);\n case '/send':\n return on_sendmsg(req, res, params);\n case '/reload':\n return on_reload_plugin(req, res, params);\n }\n};\n```", "response": "handle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200\n res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)\n when '/reload'then on_reload_plugin(req,res,params)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 73, "line_end": 91} +{"id": "xhan/qqbot:src/apiserver.coffee:5:completion", "type": "completion", "prompt": "handle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200", "response": "res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)\n when '/reload'then on_reload_plugin(req,res,params)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 73, "line_end": 91} +{"id": "xhan/qqbot:src/apiserver.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "create_server = (port)->\n server = http.createServer (req, res) ->\n log.debug '[api]' , req.url\n url = URL.parse req.url\n path = url.pathname\n if req.method == 'POST'\n processPost req, res, (body)->\n handle_request(req, res, path, body)\n else if req.method == 'GET'\n query = querystring.parse url.query\n handle_request(req, res, path, query)\n\n server.listen port\n log.info 'api server started at port',port", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 94, "line_end": 107} +{"id": "xhan/qqbot:src/apiserver.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreate_server = (port)->\n server = http.createServer (req, res) ->\n log.debug '[api]' , req.url\n url = URL.parse req.url\n path = url.pathname\n if req.method == 'POST'\n processPost req, res, (body)->\n handle_request(req, res, path, body)\n else if req.method == 'GET'\n query = querystring.parse url.query\n handle_request(req, res, path, query)\n\n server.listen port\n log.info 'api server started at port',port\n```", "response": "var create_server;\n\ncreate_server = function(port) {\n var server;\n server = http.createServer(function(req, res) {\n var path, query, url;\n log.debug('[api]', req.url);\n url = URL.parse(req.url);\n path = url.pathname;\n if (req.method === 'POST') {\n return processPost(req, res, function(body) {\n return handle_request(req, res, path, body);\n });\n } else if (req.method === 'GET') {\n query = querystring.parse(url.query);\n return handle_request(req, res, path, query);\n }\n });\n server.listen(port);\n return log.info('api server started at port', port);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 94, "line_end": 107} +{"id": "xhan/qqbot:src/apiserver.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar create_server;\n\ncreate_server = function(port) {\n var server;\n server = http.createServer(function(req, res) {\n var path, query, url;\n log.debug('[api]', req.url);\n url = URL.parse(req.url);\n path = url.pathname;\n if (req.method === 'POST') {\n return processPost(req, res, function(body) {\n return handle_request(req, res, path, body);\n });\n } else if (req.method === 'GET') {\n query = querystring.parse(url.query);\n return handle_request(req, res, path, query);\n }\n });\n server.listen(port);\n return log.info('api server started at port', port);\n};\n```", "response": "create_server = (port)->\n server = http.createServer (req, res) ->\n log.debug '[api]' , req.url\n url = URL.parse req.url\n path = url.pathname\n if req.method == 'POST'\n processPost req, res, (body)->\n handle_request(req, res, path, body)\n else if req.method == 'GET'\n query = querystring.parse url.query\n handle_request(req, res, path, query)\n\n server.listen port\n log.info 'api server started at port',port", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 94, "line_end": 107} +{"id": "xhan/qqbot:src/apiserver.coffee:6:completion", "type": "completion", "prompt": "create_server = (port)->\n server = http.createServer (req, res) ->\n log.debug '[api]' , req.url\n url = URL.parse req.url\n path = url.pathname\n if req.method == 'POST'\n processPost req, res, (body)->", "response": "handle_request(req, res, path, body)\n else if req.method == 'GET'\n query = querystring.parse url.query\n handle_request(req, res, path, query)\n\n server.listen port\n log.info 'api server started at port',port", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 94, "line_end": 107} +{"id": "xhan/qqbot:src/apiserver.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.run = (port,token)->\n config_port = port or 3000\n config_token = token\n create_server config_port", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 110, "line_end": 113} +{"id": "xhan/qqbot:src/apiserver.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.run = (port,token)->\n config_port = port or 3000\n config_token = token\n create_server config_port\n```", "response": "exports.run = function(port, token) {\n var config_port, config_token;\n config_port = port || 3000;\n config_token = token;\n return create_server(config_port);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 110, "line_end": 113} +{"id": "xhan/qqbot:src/apiserver.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.run = function(port, token) {\n var config_port, config_token;\n config_port = port || 3000;\n config_token = token;\n return create_server(config_port);\n};\n```", "response": "exports.run = (port,token)->\n config_port = port or 3000\n config_token = token\n create_server config_port", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 110, "line_end": 113} +{"id": "xhan/qqbot:src/apiserver.coffee:7:completion", "type": "completion", "prompt": "exports.run = (port,token)->\n config_port = port or 3000", "response": "config_token = token\n create_server config_port", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 110, "line_end": 113} +{"id": "xhan/qqbot:src/apiserver.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.stop = ->\n server.close() if server\n server = null\n\n# @callback group_name, message, res\n# need call res.endjson {} to finish request", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 115, "line_end": 120} +{"id": "xhan/qqbot:src/apiserver.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.stop = ->\n server.close() if server\n server = null\n\n# @callback group_name, message, res\n# need call res.endjson {} to finish request\n```", "response": "exports.stop = function() {\n var server;\n if (server) {\n server.close();\n }\n return server = null;\n};\n\n// @callback group_name, message, res\n// need call res.endjson {} to finish request", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 115, "line_end": 120} +{"id": "xhan/qqbot:src/apiserver.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.stop = function() {\n var server;\n if (server) {\n server.close();\n }\n return server = null;\n};\n\n// @callback group_name, message, res\n// need call res.endjson {} to finish request\n```", "response": "exports.stop = ->\n server.close() if server\n server = null\n\n# @callback group_name, message, res\n# need call res.endjson {} to finish request", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "bf22a42121fb4b660de8d6fdfc9148250d749c5c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/bf22a42121fb4b660de8d6fdfc9148250d749c5c/src/apiserver.coffee", "line_start": 115, "line_end": 120} +{"id": "xhan/qqbot:src/apiserver.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "handle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200\n res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "3fcb3b3cca6f26be591fe86a7e57d6797b164ed5", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3fcb3b3cca6f26be591fe86a7e57d6797b164ed5/src/apiserver.coffee", "line_start": 67, "line_end": 84} +{"id": "xhan/qqbot:src/apiserver.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nhandle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200\n res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)\n```", "response": "var handle_request;\n\nhandle_request = function(req, res, path, params) {\n res.endjson = function(dict = {}) {\n var key, ret_dict, value;\n ret_dict = {\n err: 0,\n msg: 'ok'\n };\n for (key in dict) {\n value = dict[key];\n ret_dict[key] = value;\n }\n res.writeHead(200);\n return res.end(jsons(ret_dict));\n };\n if (config_token && params.token !== config_token) {\n res.endjson({\n err: 503,\n msg: 'token failed'\n });\n return;\n }\n switch (path) {\n case '/stdin':\n return on_stdin(req, res, params);\n case '/send':\n return on_sendmsg(req, res, params);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "3fcb3b3cca6f26be591fe86a7e57d6797b164ed5", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3fcb3b3cca6f26be591fe86a7e57d6797b164ed5/src/apiserver.coffee", "line_start": 67, "line_end": 84} +{"id": "xhan/qqbot:src/apiserver.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar handle_request;\n\nhandle_request = function(req, res, path, params) {\n res.endjson = function(dict = {}) {\n var key, ret_dict, value;\n ret_dict = {\n err: 0,\n msg: 'ok'\n };\n for (key in dict) {\n value = dict[key];\n ret_dict[key] = value;\n }\n res.writeHead(200);\n return res.end(jsons(ret_dict));\n };\n if (config_token && params.token !== config_token) {\n res.endjson({\n err: 503,\n msg: 'token failed'\n });\n return;\n }\n switch (path) {\n case '/stdin':\n return on_stdin(req, res, params);\n case '/send':\n return on_sendmsg(req, res, params);\n }\n};\n```", "response": "handle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200\n res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "3fcb3b3cca6f26be591fe86a7e57d6797b164ed5", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3fcb3b3cca6f26be591fe86a7e57d6797b164ed5/src/apiserver.coffee", "line_start": 67, "line_end": 84} +{"id": "xhan/qqbot:src/apiserver.coffee:4:completion", "type": "completion", "prompt": "handle_request = (req,res,path,params)->\n res.endjson = (dict={})->\n ret_dict =\n err: 0\n msg: 'ok'\n for key,value of dict\n ret_dict[key] = value\n\n res.writeHead 200", "response": "res.end jsons ret_dict\n\n if config_token and params.token isnt config_token\n res.endjson {err:503,msg:'token failed'}\n return\n\n switch path\n when '/stdin' then on_stdin(req,res,params)\n when '/send' then on_sendmsg(req,res,params)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "src/apiserver.coffee", "license": "MIT", "commit": "3fcb3b3cca6f26be591fe86a7e57d6797b164ed5", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3fcb3b3cca6f26be591fe86a7e57d6797b164ed5/src/apiserver.coffee", "line_start": 67, "line_end": 84} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Known formulas\n\nclass Dimensions\n\n right: (scope) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]\n\n bottom: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]\n\n center:\n x: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]\n\n y: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]\n\nmodule.exports = Dimensions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 22} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Known formulas\n\nclass Dimensions\n\n right: (scope) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]\n\n bottom: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]\n\n center:\n x: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]\n\n y: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]\n\nmodule.exports = Dimensions\n```", "response": "// Known formulas\nvar Dimensions;\n\nDimensions = (function() {\n class Dimensions {\n right(scope) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'x')], ['get', this.getPath(id, 'width')]];\n }\n\n bottom(scope, path) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'y')], ['get', this.getPath(id, 'height')]];\n }\n\n };\n\n Dimensions.prototype.center = {\n x: function(scope, path) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'x')], ['/', ['get', this.getPath(id, 'width')], 2]];\n },\n y: function(scope, path) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'y')], ['/', ['get', this.getPath(id, 'height')], 2]];\n }\n };\n\n return Dimensions;\n\n}).call(this);\n\nmodule.exports = Dimensions;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 22} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Known formulas\nvar Dimensions;\n\nDimensions = (function() {\n class Dimensions {\n right(scope) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'x')], ['get', this.getPath(id, 'width')]];\n }\n\n bottom(scope, path) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'y')], ['get', this.getPath(id, 'height')]];\n }\n\n };\n\n Dimensions.prototype.center = {\n x: function(scope, path) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'x')], ['/', ['get', this.getPath(id, 'width')], 2]];\n },\n y: function(scope, path) {\n var id;\n id = this.identify(scope);\n return ['+', ['get', this.getPath(id, 'y')], ['/', ['get', this.getPath(id, 'height')], 2]];\n }\n };\n\n return Dimensions;\n\n}).call(this);\n\nmodule.exports = Dimensions;\n```", "response": "# Known formulas\n\nclass Dimensions\n\n right: (scope) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]\n\n bottom: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]\n\n center:\n x: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]\n\n y: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]\n\nmodule.exports = Dimensions", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 22} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:completion", "type": "completion", "prompt": "# Known formulas\n\nclass Dimensions\n\n right: (scope) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]\n\n bottom: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]", "response": "center:\n x: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]\n\n y: (scope, path) ->\n id = @identify(scope)\n return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]\n\nmodule.exports = Dimensions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 22} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:\n\n left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return# element.offsetHeight\n\n width: (element) ->\n return# element.offsetWidth", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "6a58b41bad01c4f4c7c64e670394ffd607937fc3", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a58b41bad01c4f4c7c64e670394ffd607937fc3/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:\n\n left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return# element.offsetHeight\n\n width: (element) ->\n return# element.offsetWidth\n```", "response": "var Dimensions;\n\nDimensions = (function() {\n class Dimensions {};\n\n // Global variables managed by the engine\n Dimensions.prototype['::window'] = {\n width: function() {\n return window.innerWidth;\n },\n height: function() {\n return window.innerHeight;\n },\n //right: '::window[width]'\n //bottom: '::window[height]'\n\n //center:\n // x: ->\n // return window.innerWidth / 2\n\n // y: ->\n // return window.innerHeight / 2\n scroll: {\n left: function() {\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;\n },\n top: function() {\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;\n }\n },\n x: 0,\n y: 0\n };\n\n Dimensions.prototype['::document'] = {\n scroll: {\n left: '::window[scroll-left]',\n top: '::window[scroll-top]'\n },\n x: '::window[x]',\n y: '::window[y]'\n };\n\n Dimensions.prototype.intrinsic = {\n height: function(element) {}, // element.offsetHeight\n width: function(element) {} // element.offsetWidth\n };\n\n return Dimensions;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "6a58b41bad01c4f4c7c64e670394ffd607937fc3", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a58b41bad01c4f4c7c64e670394ffd607937fc3/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dimensions;\n\nDimensions = (function() {\n class Dimensions {};\n\n // Global variables managed by the engine\n Dimensions.prototype['::window'] = {\n width: function() {\n return window.innerWidth;\n },\n height: function() {\n return window.innerHeight;\n },\n //right: '::window[width]'\n //bottom: '::window[height]'\n\n //center:\n // x: ->\n // return window.innerWidth / 2\n\n // y: ->\n // return window.innerHeight / 2\n scroll: {\n left: function() {\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;\n },\n top: function() {\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;\n }\n },\n x: 0,\n y: 0\n };\n\n Dimensions.prototype['::document'] = {\n scroll: {\n left: '::window[scroll-left]',\n top: '::window[scroll-top]'\n },\n x: '::window[x]',\n y: '::window[y]'\n };\n\n Dimensions.prototype.intrinsic = {\n height: function(element) {}, // element.offsetHeight\n width: function(element) {} // element.offsetWidth\n };\n\n return Dimensions;\n\n}).call(this);\n```", "response": "class Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:\n\n left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return# element.offsetHeight\n\n width: (element) ->\n return# element.offsetWidth", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "6a58b41bad01c4f4c7c64e670394ffd607937fc3", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a58b41bad01c4f4c7c64e670394ffd607937fc3/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:completion", "type": "completion", "prompt": "class Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:", "response": "left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return# element.offsetHeight\n\n width: (element) ->\n return# element.offsetWidth", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "6a58b41bad01c4f4c7c64e670394ffd607937fc3", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a58b41bad01c4f4c7c64e670394ffd607937fc3/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:\n\n left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return element.offsetHeight\n\n width: (element) ->\n return element.offsetWidth", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:\n\n left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return element.offsetHeight\n\n width: (element) ->\n return element.offsetWidth\n```", "response": "var Dimensions;\n\nDimensions = (function() {\n class Dimensions {};\n\n // Global variables managed by the engine\n Dimensions.prototype['::window'] = {\n width: function() {\n return window.innerWidth;\n },\n height: function() {\n return window.innerHeight;\n },\n //right: '::window[width]'\n //bottom: '::window[height]'\n\n //center:\n // x: ->\n // return window.innerWidth / 2\n\n // y: ->\n // return window.innerHeight / 2\n scroll: {\n left: function() {\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;\n },\n top: function() {\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;\n }\n },\n x: 0,\n y: 0\n };\n\n Dimensions.prototype['::document'] = {\n scroll: {\n left: '::window[scroll-left]',\n top: '::window[scroll-top]'\n },\n x: '::window[x]',\n y: '::window[y]'\n };\n\n Dimensions.prototype.intrinsic = {\n height: function(element) {\n return element.offsetHeight;\n },\n width: function(element) {\n return element.offsetWidth;\n }\n };\n\n return Dimensions;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dimensions;\n\nDimensions = (function() {\n class Dimensions {};\n\n // Global variables managed by the engine\n Dimensions.prototype['::window'] = {\n width: function() {\n return window.innerWidth;\n },\n height: function() {\n return window.innerHeight;\n },\n //right: '::window[width]'\n //bottom: '::window[height]'\n\n //center:\n // x: ->\n // return window.innerWidth / 2\n\n // y: ->\n // return window.innerHeight / 2\n scroll: {\n left: function() {\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;\n },\n top: function() {\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;\n }\n },\n x: 0,\n y: 0\n };\n\n Dimensions.prototype['::document'] = {\n scroll: {\n left: '::window[scroll-left]',\n top: '::window[scroll-top]'\n },\n x: '::window[x]',\n y: '::window[y]'\n };\n\n Dimensions.prototype.intrinsic = {\n height: function(element) {\n return element.offsetHeight;\n },\n width: function(element) {\n return element.offsetWidth;\n }\n };\n\n return Dimensions;\n\n}).call(this);\n```", "response": "class Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:\n\n left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return element.offsetHeight\n\n width: (element) ->\n return element.offsetWidth", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/properties/Dimensions.coffee:1:completion", "type": "completion", "prompt": "class Dimensions\n # Global variables managed by the engine\n\n\n '::window':\n\n width: ->\n return window.innerWidth\n\n height: ->\n return window.innerHeight\n\n #right: '::window[width]'\n #bottom: '::window[height]'\n #\n #center:\n # x: ->\n # return window.innerWidth / 2\n #\n # y: ->\n # return window.innerHeight / 2\n\n scroll:", "response": "left: ->\n return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft\n\n top: ->\n return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\n x: 0\n y: 0\n\n '::document':\n\n scroll:\n left: '::window[scroll-left]'\n top: '::window[scroll-top]'\n\n x: '::window[x]'\n y: '::window[y]'\n\n intrinsic:\n\n height: (element) ->\n return element.offsetHeight\n\n width: (element) ->\n return element.offsetWidth", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/properties/Dimensions.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/properties/Dimensions.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:test/basic/tostring.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'Test toString() function with built-in XML writer:', ->\n test 'Nodes', ->\n eq xml('root').doc().toString(), ''\n eq xml('root').toString(), ''\n eq xml('root').att('att', 'val').attribs['att'].toString(), ' att=\"val\"'\n eq xml('root').dat('val').children[0].toString(), ''\n eq xml('root').com('val').children[0].toString(), ''\n eq xml('root').ins('target', 'val').children[0].toString(), ''\n eq xml('root').raw('val').children[0].toString(), 'val'\n eq xml('root').text('val').children[0].toString(), 'val'\n\n test 'DTD', ->\n eq(\n xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()\n ''\n )\n eq(\n xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', \"yes\").children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().ele('img', 'EMPTY').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().ent('ent', 'my val').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()\n ''\n )\n\n test 'XML Declaration', ->\n eq(\n xml('root').dec().doc().children[0].toString()\n ''\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/tostring.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/tostring.coffee", "line_start": 1, "line_end": 38} +{"id": "oozcitak/xmlbuilder-js:test/basic/tostring.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'Test toString() function with built-in XML writer:', ->\n test 'Nodes', ->\n eq xml('root').doc().toString(), ''\n eq xml('root').toString(), ''\n eq xml('root').att('att', 'val').attribs['att'].toString(), ' att=\"val\"'\n eq xml('root').dat('val').children[0].toString(), ''\n eq xml('root').com('val').children[0].toString(), ''\n eq xml('root').ins('target', 'val').children[0].toString(), ''\n eq xml('root').raw('val').children[0].toString(), 'val'\n eq xml('root').text('val').children[0].toString(), 'val'\n\n test 'DTD', ->\n eq(\n xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()\n ''\n )\n eq(\n xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', \"yes\").children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().ele('img', 'EMPTY').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().ent('ent', 'my val').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()\n ''\n )\n\n test 'XML Declaration', ->\n eq(\n xml('root').dec().doc().children[0].toString()\n ''\n )\n```", "response": "suite('Test toString() function with built-in XML writer:', function() {\n test('Nodes', function() {\n eq(xml('root').doc().toString(), '');\n eq(xml('root').toString(), '');\n eq(xml('root').att('att', 'val').attribs['att'].toString(), ' att=\"val\"');\n eq(xml('root').dat('val').children[0].toString(), '');\n eq(xml('root').com('val').children[0].toString(), '');\n eq(xml('root').ins('target', 'val').children[0].toString(), '');\n eq(xml('root').raw('val').children[0].toString(), 'val');\n return eq(xml('root').text('val').children[0].toString(), 'val');\n });\n test('DTD', function() {\n eq(xml('root').dtd({\n pubID: 'pub',\n sysID: 'sys'\n }).toString(), '');\n eq(xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', \"yes\").children[0].toString(), '');\n eq(xml('root').dtd().ele('img', 'EMPTY').children[0].toString(), '');\n eq(xml('root').dtd().ent('ent', 'my val').children[0].toString(), '');\n return eq(xml('root').dtd().not('fs', {\n sysID: 'http://my.fs.com/reader'\n }).children[0].toString(), '');\n });\n return test('XML Declaration', function() {\n return eq(xml('root').dec().doc().children[0].toString(), '');\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/tostring.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/tostring.coffee", "line_start": 1, "line_end": 38} +{"id": "oozcitak/xmlbuilder-js:test/basic/tostring.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('Test toString() function with built-in XML writer:', function() {\n test('Nodes', function() {\n eq(xml('root').doc().toString(), '');\n eq(xml('root').toString(), '');\n eq(xml('root').att('att', 'val').attribs['att'].toString(), ' att=\"val\"');\n eq(xml('root').dat('val').children[0].toString(), '');\n eq(xml('root').com('val').children[0].toString(), '');\n eq(xml('root').ins('target', 'val').children[0].toString(), '');\n eq(xml('root').raw('val').children[0].toString(), 'val');\n return eq(xml('root').text('val').children[0].toString(), 'val');\n });\n test('DTD', function() {\n eq(xml('root').dtd({\n pubID: 'pub',\n sysID: 'sys'\n }).toString(), '');\n eq(xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', \"yes\").children[0].toString(), '');\n eq(xml('root').dtd().ele('img', 'EMPTY').children[0].toString(), '');\n eq(xml('root').dtd().ent('ent', 'my val').children[0].toString(), '');\n return eq(xml('root').dtd().not('fs', {\n sysID: 'http://my.fs.com/reader'\n }).children[0].toString(), '');\n });\n return test('XML Declaration', function() {\n return eq(xml('root').dec().doc().children[0].toString(), '');\n });\n});\n```", "response": "suite 'Test toString() function with built-in XML writer:', ->\n test 'Nodes', ->\n eq xml('root').doc().toString(), ''\n eq xml('root').toString(), ''\n eq xml('root').att('att', 'val').attribs['att'].toString(), ' att=\"val\"'\n eq xml('root').dat('val').children[0].toString(), ''\n eq xml('root').com('val').children[0].toString(), ''\n eq xml('root').ins('target', 'val').children[0].toString(), ''\n eq xml('root').raw('val').children[0].toString(), 'val'\n eq xml('root').text('val').children[0].toString(), 'val'\n\n test 'DTD', ->\n eq(\n xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()\n ''\n )\n eq(\n xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', \"yes\").children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().ele('img', 'EMPTY').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().ent('ent', 'my val').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()\n ''\n )\n\n test 'XML Declaration', ->\n eq(\n xml('root').dec().doc().children[0].toString()\n ''\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/tostring.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/tostring.coffee", "line_start": 1, "line_end": 38} +{"id": "oozcitak/xmlbuilder-js:test/basic/tostring.coffee:1:completion", "type": "completion", "prompt": "suite 'Test toString() function with built-in XML writer:', ->\n test 'Nodes', ->\n eq xml('root').doc().toString(), ''\n eq xml('root').toString(), ''\n eq xml('root').att('att', 'val').attribs['att'].toString(), ' att=\"val\"'\n eq xml('root').dat('val').children[0].toString(), ''\n eq xml('root').com('val').children[0].toString(), ''\n eq xml('root').ins('target', 'val').children[0].toString(), ''\n eq xml('root').raw('val').children[0].toString(), 'val'\n eq xml('root').text('val').children[0].toString(), 'val'\n\n test 'DTD', ->\n eq(\n xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()\n ''\n )\n eq(\n xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', \"yes\").children[0].toString()\n ''", "response": ")\n eq(\n xml('root').dtd().ele('img', 'EMPTY').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().ent('ent', 'my val').children[0].toString()\n ''\n )\n eq(\n xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()\n ''\n )\n\n test 'XML Declaration', ->\n eq(\n xml('root').dec().doc().children[0].toString()\n ''\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/tostring.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/tostring.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:lib/collections.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "root = exports ? this\n\nroot.Houston ?= {}\n\nHouston._collections ?= {}\n\nHouston._collections.collections = new Meteor.Collection('houston_collections')\n\nHouston._admins = new Meteor.Collection('houston_admins')\n\nHouston._user_is_admin = (id) ->\n return id? and Houston._admins.findOne user_id: id", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "lib/collections.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/lib/collections.coffee", "line_start": 1, "line_end": 12} +{"id": "gterrono/houston:lib/collections.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nroot = exports ? this\n\nroot.Houston ?= {}\n\nHouston._collections ?= {}\n\nHouston._collections.collections = new Meteor.Collection('houston_collections')\n\nHouston._admins = new Meteor.Collection('houston_admins')\n\nHouston._user_is_admin = (id) ->\n return id? and Houston._admins.findOne user_id: id\n```", "response": "var root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nif (root.Houston == null) {\n root.Houston = {};\n}\n\nif (Houston._collections == null) {\n Houston._collections = {};\n}\n\nHouston._collections.collections = new Meteor.Collection('houston_collections');\n\nHouston._admins = new Meteor.Collection('houston_admins');\n\nHouston._user_is_admin = function(id) {\n return (id != null) && Houston._admins.findOne({\n user_id: id\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "lib/collections.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/lib/collections.coffee", "line_start": 1, "line_end": 12} +{"id": "gterrono/houston:lib/collections.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar root;\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nif (root.Houston == null) {\n root.Houston = {};\n}\n\nif (Houston._collections == null) {\n Houston._collections = {};\n}\n\nHouston._collections.collections = new Meteor.Collection('houston_collections');\n\nHouston._admins = new Meteor.Collection('houston_admins');\n\nHouston._user_is_admin = function(id) {\n return (id != null) && Houston._admins.findOne({\n user_id: id\n });\n};\n```", "response": "root = exports ? this\n\nroot.Houston ?= {}\n\nHouston._collections ?= {}\n\nHouston._collections.collections = new Meteor.Collection('houston_collections')\n\nHouston._admins = new Meteor.Collection('houston_admins')\n\nHouston._user_is_admin = (id) ->\n return id? and Houston._admins.findOne user_id: id", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "lib/collections.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/lib/collections.coffee", "line_start": 1, "line_end": 12} +{"id": "gterrono/houston:lib/collections.coffee:1:completion", "type": "completion", "prompt": "root = exports ? this\n\nroot.Houston ?= {}\n\nHouston._collections ?= {}", "response": "Houston._collections.collections = new Meteor.Collection('houston_collections')\n\nHouston._admins = new Meteor.Collection('houston_admins')\n\nHouston._user_is_admin = (id) ->\n return id? and Houston._admins.findOne user_id: id", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "lib/collections.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/lib/collections.coffee", "line_start": 1, "line_end": 12} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2018 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('propertyTable', function() {\n return {\n restrict: 'EAC',\n scope: {\n properties: '='\n },\n templateUrl: 'partials/help/propertyTable.html',\n link: function(scope, element, attrs) {}\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2018 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('propertyTable', function() {\n return {\n restrict: 'EAC',\n scope: {\n properties: '='\n },\n templateUrl: 'partials/help/propertyTable.html',\n link: function(scope, element, attrs) {}\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific", "response": "# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('propertyTable', function() {\n return {\n restrict: 'EAC',\n scope: {\n properties: '='\n },\n templateUrl: 'partials/help/propertyTable.html',\n link: function(scope, element, attrs) {}\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('propertyTable', function() {\n return {\n restrict: 'EAC',\n scope: {\n properties: '='\n },\n templateUrl: 'partials/help/propertyTable.html',\n link: function(scope, element, attrs) {}\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific", "response": "# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'propertyTable', ->\n {\n restrict: 'EAC'\n scope:\n properties: '='\n templateUrl: 'partials/help/propertyTable.html'\n\n link: (scope, element, attrs) ->\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.propertyTable.coffee", "line_start": 1, "line_end": 26} +{"id": "snd/url-pattern:test/util.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "util = require '../src/util'\n\nmodule.exports =\n\n 'getNames':\n\n 'no names': (test) ->\n test.deepEqual [], util.getNames '/foo/bar/baz'\n test.done()\n\n 'one name': (test) ->\n test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'\n test.done()\n\n 'three names': (test) ->\n test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'\n test.done()\n\n 'names with prefix wildcard': (test) ->\n test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'\n test.done()\n\n 'names with infix wildcard': (test) ->\n test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'\n test.done()\n\n 'names with postfix wildcard': (test) ->\n test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'\n test.done()\n\n 'name _ is disallowed': (test) ->\n test.throws ->\n util.getNames '/foo/:_'\n test.done()\n\n 'duplicate pattern names are disallowed': (test) ->\n test.throws ->\n util.getNames '/:foo/:foo'\n test.done()\n\n 'toRegexString':\n\n '^ and $ are added': (test) ->\n test.equals '^foo$', util.toRegexString 'foo'\n test.done()\n\n '/ are escaped': (test) ->\n test.equals '^/foo$', util.toRegexString '/foo'\n test.done()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:test/util.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nutil = require '../src/util'\n\nmodule.exports =\n\n 'getNames':\n\n 'no names': (test) ->\n test.deepEqual [], util.getNames '/foo/bar/baz'\n test.done()\n\n 'one name': (test) ->\n test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'\n test.done()\n\n 'three names': (test) ->\n test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'\n test.done()\n\n 'names with prefix wildcard': (test) ->\n test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'\n test.done()\n\n 'names with infix wildcard': (test) ->\n test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'\n test.done()\n\n 'names with postfix wildcard': (test) ->\n test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'\n test.done()\n\n 'name _ is disallowed': (test) ->\n test.throws ->\n util.getNames '/foo/:_'\n test.done()\n\n 'duplicate pattern names are disallowed': (test) ->\n test.throws ->\n util.getNames '/:foo/:foo'\n test.done()\n\n 'toRegexString':\n\n '^ and $ are added': (test) ->\n test.equals '^foo$', util.toRegexString 'foo'\n test.done()\n\n '/ are escaped': (test) ->\n test.equals '^/foo$', util.toRegexString '/foo'\n test.done()\n```", "response": "var util;\n\nutil = require('../src/util');\n\nmodule.exports = {\n 'getNames': {\n 'no names': function(test) {\n test.deepEqual([], util.getNames('/foo/bar/baz'));\n return test.done();\n },\n 'one name': function(test) {\n test.deepEqual(['foo'], util.getNames('/foo/:foo/bar/baz'));\n return test.done();\n },\n 'three names': function(test) {\n test.deepEqual(['foo', 'bar', 'baz'], util.getNames('/foo/:foo/bar/:bar/baz/:baz'));\n return test.done();\n },\n 'names with prefix wildcard': function(test) {\n test.deepEqual(['_', 'bar', 'baz'], util.getNames('/foo/*/bar/:bar/baz/:baz'));\n return test.done();\n },\n 'names with infix wildcard': function(test) {\n test.deepEqual(['foo', '_', 'baz'], util.getNames('/foo/:foo/bar/*/baz/:baz'));\n return test.done();\n },\n 'names with postfix wildcard': function(test) {\n test.deepEqual(['foo', 'bar', '_'], util.getNames('/foo/:foo/bar/:bar/baz/*'));\n return test.done();\n },\n 'name _ is disallowed': function(test) {\n test.throws(function() {\n return util.getNames('/foo/:_');\n });\n return test.done();\n },\n 'duplicate pattern names are disallowed': function(test) {\n test.throws(function() {\n return util.getNames('/:foo/:foo');\n });\n return test.done();\n }\n },\n 'toRegexString': {\n '^ and $ are added': function(test) {\n test.equals('^foo$', util.toRegexString('foo'));\n return test.done();\n },\n '/ are escaped': function(test) {\n test.equals('^/foo$', util.toRegexString('/foo'));\n return test.done();\n }\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:test/util.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar util;\n\nutil = require('../src/util');\n\nmodule.exports = {\n 'getNames': {\n 'no names': function(test) {\n test.deepEqual([], util.getNames('/foo/bar/baz'));\n return test.done();\n },\n 'one name': function(test) {\n test.deepEqual(['foo'], util.getNames('/foo/:foo/bar/baz'));\n return test.done();\n },\n 'three names': function(test) {\n test.deepEqual(['foo', 'bar', 'baz'], util.getNames('/foo/:foo/bar/:bar/baz/:baz'));\n return test.done();\n },\n 'names with prefix wildcard': function(test) {\n test.deepEqual(['_', 'bar', 'baz'], util.getNames('/foo/*/bar/:bar/baz/:baz'));\n return test.done();\n },\n 'names with infix wildcard': function(test) {\n test.deepEqual(['foo', '_', 'baz'], util.getNames('/foo/:foo/bar/*/baz/:baz'));\n return test.done();\n },\n 'names with postfix wildcard': function(test) {\n test.deepEqual(['foo', 'bar', '_'], util.getNames('/foo/:foo/bar/:bar/baz/*'));\n return test.done();\n },\n 'name _ is disallowed': function(test) {\n test.throws(function() {\n return util.getNames('/foo/:_');\n });\n return test.done();\n },\n 'duplicate pattern names are disallowed': function(test) {\n test.throws(function() {\n return util.getNames('/:foo/:foo');\n });\n return test.done();\n }\n },\n 'toRegexString': {\n '^ and $ are added': function(test) {\n test.equals('^foo$', util.toRegexString('foo'));\n return test.done();\n },\n '/ are escaped': function(test) {\n test.equals('^/foo$', util.toRegexString('/foo'));\n return test.done();\n }\n }\n};\n```", "response": "util = require '../src/util'\n\nmodule.exports =\n\n 'getNames':\n\n 'no names': (test) ->\n test.deepEqual [], util.getNames '/foo/bar/baz'\n test.done()\n\n 'one name': (test) ->\n test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'\n test.done()\n\n 'three names': (test) ->\n test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'\n test.done()\n\n 'names with prefix wildcard': (test) ->\n test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'\n test.done()\n\n 'names with infix wildcard': (test) ->\n test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'\n test.done()\n\n 'names with postfix wildcard': (test) ->\n test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'\n test.done()\n\n 'name _ is disallowed': (test) ->\n test.throws ->\n util.getNames '/foo/:_'\n test.done()\n\n 'duplicate pattern names are disallowed': (test) ->\n test.throws ->\n util.getNames '/:foo/:foo'\n test.done()\n\n 'toRegexString':\n\n '^ and $ are added': (test) ->\n test.equals '^foo$', util.toRegexString 'foo'\n test.done()\n\n '/ are escaped': (test) ->\n test.equals '^/foo$', util.toRegexString '/foo'\n test.done()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:test/util.coffee:1:completion", "type": "completion", "prompt": "util = require '../src/util'\n\nmodule.exports =\n\n 'getNames':\n\n 'no names': (test) ->\n test.deepEqual [], util.getNames '/foo/bar/baz'\n test.done()\n\n 'one name': (test) ->\n test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'\n test.done()\n\n 'three names': (test) ->\n test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'\n test.done()\n\n 'names with prefix wildcard': (test) ->\n test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'\n test.done()\n\n 'names with infix wildcard': (test) ->\n test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'", "response": "test.done()\n\n 'names with postfix wildcard': (test) ->\n test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'\n test.done()\n\n 'name _ is disallowed': (test) ->\n test.throws ->\n util.getNames '/foo/:_'\n test.done()\n\n 'duplicate pattern names are disallowed': (test) ->\n test.throws ->\n util.getNames '/:foo/:foo'\n test.done()\n\n 'toRegexString':\n\n '^ and $ are added': (test) ->\n test.equals '^foo$', util.toRegexString 'foo'\n test.done()\n\n '/ are escaped': (test) ->\n test.equals '^/foo$', util.toRegexString '/foo'\n test.done()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:test/util.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "'names are replaced': (test) ->\n test.equals '^/users/([^/]+)/tasks/([^/]+)$',\n util.toRegexString '/users/:userId/tasks/:taskId'\n test.done()\n\n 'wildcards are replaced': (test) ->\n test.equals '^(.*)foo$', util.toRegexString '*foo'\n test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'\n test.done()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 51, "line_end": 59} +{"id": "snd/url-pattern:test/util.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n'names are replaced': (test) ->\n test.equals '^/users/([^/]+)/tasks/([^/]+)$',\n util.toRegexString '/users/:userId/tasks/:taskId'\n test.done()\n\n 'wildcards are replaced': (test) ->\n test.equals '^(.*)foo$', util.toRegexString '*foo'\n test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'\n test.done()\n```", "response": "({\n 'names are replaced': function(test) {\n test.equals('^/users/([^/]+)/tasks/([^/]+)$', util.toRegexString('/users/:userId/tasks/:taskId'));\n return test.done();\n },\n 'wildcards are replaced': function(test) {\n test.equals('^(.*)foo$', util.toRegexString('*foo'));\n test.equals('^(.*)foo(.*)$', util.toRegexString('*foo*'));\n return test.done();\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 51, "line_end": 59} +{"id": "snd/url-pattern:test/util.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n 'names are replaced': function(test) {\n test.equals('^/users/([^/]+)/tasks/([^/]+)$', util.toRegexString('/users/:userId/tasks/:taskId'));\n return test.done();\n },\n 'wildcards are replaced': function(test) {\n test.equals('^(.*)foo$', util.toRegexString('*foo'));\n test.equals('^(.*)foo(.*)$', util.toRegexString('*foo*'));\n return test.done();\n }\n});\n```", "response": "'names are replaced': (test) ->\n test.equals '^/users/([^/]+)/tasks/([^/]+)$',\n util.toRegexString '/users/:userId/tasks/:taskId'\n test.done()\n\n 'wildcards are replaced': (test) ->\n test.equals '^(.*)foo$', util.toRegexString '*foo'\n test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'\n test.done()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 51, "line_end": 59} +{"id": "snd/url-pattern:test/util.coffee:2:completion", "type": "completion", "prompt": "'names are replaced': (test) ->\n test.equals '^/users/([^/]+)/tasks/([^/]+)$',\n util.toRegexString '/users/:userId/tasks/:taskId'\n test.done()", "response": "'wildcards are replaced': (test) ->\n test.equals '^(.*)foo$', util.toRegexString '*foo'\n test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'\n test.done()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "test/util.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/test/util.coffee", "line_start": 51, "line_end": 59} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "appendSearchNode = (node$) ->\n searchableNodes.push [node$.text().toLowerCase(), node$]\n\ncurrentQuery = ''", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 12, "line_end": 15} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nappendSearchNode = (node$) ->\n searchableNodes.push [node$.text().toLowerCase(), node$]\n\ncurrentQuery = ''\n```", "response": "var appendSearchNode, currentQuery;\n\nappendSearchNode = function(node$) {\n return searchableNodes.push([node$.text().toLowerCase(), node$]);\n};\n\ncurrentQuery = '';", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 12, "line_end": 15} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar appendSearchNode, currentQuery;\n\nappendSearchNode = function(node$) {\n return searchableNodes.push([node$.text().toLowerCase(), node$]);\n};\n\ncurrentQuery = '';\n```", "response": "appendSearchNode = (node$) ->\n searchableNodes.push [node$.text().toLowerCase(), node$]\n\ncurrentQuery = ''", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 12, "line_end": 15} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "searchNodes = (queryString) ->\n queryString = queryString.toLowerCase().replace(/\\s+/, '')\n return if queryString == currentQuery\n currentQuery = queryString\n\n return clearFilter() if queryString == ''\n\n matcher = new RegExp (c.replace /[-[\\]{}()*+?.,\\\\^$|#\\s]/, \"\\\\$&\" for c in queryString).join '.*'\n matched = []\n filtered = []\n\n for nodeInfo in searchableNodes\n if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]\n\n return clearFilter() if matched.length > MAX_FILTER_SIZE\n\n # Update the DOM\n for node$ in filtered\n node$.removeClass 'matched-child'\n node$.addClass 'filtered'\n\n for node$ in matched\n node$.removeClass 'filtered matched-child'\n\n highlightMatch node$, queryString\n\n # Filter out our immediate parent\n $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 16, "line_end": 43} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsearchNodes = (queryString) ->\n queryString = queryString.toLowerCase().replace(/\\s+/, '')\n return if queryString == currentQuery\n currentQuery = queryString\n\n return clearFilter() if queryString == ''\n\n matcher = new RegExp (c.replace /[-[\\]{}()*+?.,\\\\^$|#\\s]/, \"\\\\$&\" for c in queryString).join '.*'\n matched = []\n filtered = []\n\n for nodeInfo in searchableNodes\n if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]\n\n return clearFilter() if matched.length > MAX_FILTER_SIZE\n\n # Update the DOM\n for node$ in filtered\n node$.removeClass 'matched-child'\n node$.addClass 'filtered'\n\n for node$ in matched\n node$.removeClass 'filtered matched-child'\n\n highlightMatch node$, queryString\n\n # Filter out our immediate parent\n $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'\n```", "response": "var searchNodes;\n\nsearchNodes = function(queryString) {\n var c, currentQuery, filtered, i, j, k, len, len1, len2, matched, matcher, node$, nodeInfo, p, results;\n queryString = queryString.toLowerCase().replace(/\\s+/, '');\n if (queryString === currentQuery) {\n return;\n }\n currentQuery = queryString;\n if (queryString === '') {\n return clearFilter();\n }\n matcher = new RegExp(((function() {\n var i, len, results;\n results = [];\n for (i = 0, len = queryString.length; i < len; i++) {\n c = queryString[i];\n results.push(c.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/, \"\\\\$&\"));\n }\n return results;\n })()).join('.*'));\n matched = [];\n filtered = [];\n for (i = 0, len = searchableNodes.length; i < len; i++) {\n nodeInfo = searchableNodes[i];\n if (matcher.test(nodeInfo[0])) {\n matched.push(nodeInfo[1]);\n } else {\n filtered.push(nodeInfo[1]);\n }\n }\n if (matched.length > MAX_FILTER_SIZE) {\n return clearFilter();\n }\n// Update the DOM\n for (j = 0, len1 = filtered.length; j < len1; j++) {\n node$ = filtered[j];\n node$.removeClass('matched-child');\n node$.addClass('filtered');\n }\n results = [];\n for (k = 0, len2 = matched.length; k < len2; k++) {\n node$ = matched[k];\n node$.removeClass('filtered matched-child');\n highlightMatch(node$, queryString);\n results.push((function() {\n var l, len3, ref, results1;\n ref = node$.parent().parents('li');\n results1 = [];\n for (l = 0, len3 = ref.length; l < len3; l++) {\n p = ref[l];\n // Filter out our immediate parent\n results1.push($(p).find('> a').addClass('matched-child'));\n }\n return results1;\n })());\n }\n return results;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 16, "line_end": 43} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar searchNodes;\n\nsearchNodes = function(queryString) {\n var c, currentQuery, filtered, i, j, k, len, len1, len2, matched, matcher, node$, nodeInfo, p, results;\n queryString = queryString.toLowerCase().replace(/\\s+/, '');\n if (queryString === currentQuery) {\n return;\n }\n currentQuery = queryString;\n if (queryString === '') {\n return clearFilter();\n }\n matcher = new RegExp(((function() {\n var i, len, results;\n results = [];\n for (i = 0, len = queryString.length; i < len; i++) {\n c = queryString[i];\n results.push(c.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/, \"\\\\$&\"));\n }\n return results;\n })()).join('.*'));\n matched = [];\n filtered = [];\n for (i = 0, len = searchableNodes.length; i < len; i++) {\n nodeInfo = searchableNodes[i];\n if (matcher.test(nodeInfo[0])) {\n matched.push(nodeInfo[1]);\n } else {\n filtered.push(nodeInfo[1]);\n }\n }\n if (matched.length > MAX_FILTER_SIZE) {\n return clearFilter();\n }\n// Update the DOM\n for (j = 0, len1 = filtered.length; j < len1; j++) {\n node$ = filtered[j];\n node$.removeClass('matched-child');\n node$.addClass('filtered');\n }\n results = [];\n for (k = 0, len2 = matched.length; k < len2; k++) {\n node$ = matched[k];\n node$.removeClass('filtered matched-child');\n highlightMatch(node$, queryString);\n results.push((function() {\n var l, len3, ref, results1;\n ref = node$.parent().parents('li');\n results1 = [];\n for (l = 0, len3 = ref.length; l < len3; l++) {\n p = ref[l];\n // Filter out our immediate parent\n results1.push($(p).find('> a').addClass('matched-child'));\n }\n return results1;\n })());\n }\n return results;\n};\n```", "response": "searchNodes = (queryString) ->\n queryString = queryString.toLowerCase().replace(/\\s+/, '')\n return if queryString == currentQuery\n currentQuery = queryString\n\n return clearFilter() if queryString == ''\n\n matcher = new RegExp (c.replace /[-[\\]{}()*+?.,\\\\^$|#\\s]/, \"\\\\$&\" for c in queryString).join '.*'\n matched = []\n filtered = []\n\n for nodeInfo in searchableNodes\n if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]\n\n return clearFilter() if matched.length > MAX_FILTER_SIZE\n\n # Update the DOM\n for node$ in filtered\n node$.removeClass 'matched-child'\n node$.addClass 'filtered'\n\n for node$ in matched\n node$.removeClass 'filtered matched-child'\n\n highlightMatch node$, queryString\n\n # Filter out our immediate parent\n $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 16, "line_end": 43} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:2:completion", "type": "completion", "prompt": "searchNodes = (queryString) ->\n queryString = queryString.toLowerCase().replace(/\\s+/, '')\n return if queryString == currentQuery\n currentQuery = queryString\n\n return clearFilter() if queryString == ''\n\n matcher = new RegExp (c.replace /[-[\\]{}()*+?.,\\\\^$|#\\s]/, \"\\\\$&\" for c in queryString).join '.*'\n matched = []\n filtered = []\n\n for nodeInfo in searchableNodes\n if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]", "response": "return clearFilter() if matched.length > MAX_FILTER_SIZE\n\n # Update the DOM\n for node$ in filtered\n node$.removeClass 'matched-child'\n node$.addClass 'filtered'\n\n for node$ in matched\n node$.removeClass 'filtered matched-child'\n\n highlightMatch node$, queryString\n\n # Filter out our immediate parent\n $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 16, "line_end": 43} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "clearFilter = ->\n currentQuery = ''\n for nodeInfo in searchableNodes\n node$ = nodeInfo[1]\n node$.removeClass 'filtered matched-child'\n node$.text node$.text()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 45, "line_end": 50} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclearFilter = ->\n currentQuery = ''\n for nodeInfo in searchableNodes\n node$ = nodeInfo[1]\n node$.removeClass 'filtered matched-child'\n node$.text node$.text()\n```", "response": "var clearFilter;\n\nclearFilter = function() {\n var currentQuery, i, len, node$, nodeInfo, results;\n currentQuery = '';\n results = [];\n for (i = 0, len = searchableNodes.length; i < len; i++) {\n nodeInfo = searchableNodes[i];\n node$ = nodeInfo[1];\n node$.removeClass('filtered matched-child');\n results.push(node$.text(node$.text()));\n }\n return results;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 45, "line_end": 50} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar clearFilter;\n\nclearFilter = function() {\n var currentQuery, i, len, node$, nodeInfo, results;\n currentQuery = '';\n results = [];\n for (i = 0, len = searchableNodes.length; i < len; i++) {\n nodeInfo = searchableNodes[i];\n node$ = nodeInfo[1];\n node$.removeClass('filtered matched-child');\n results.push(node$.text(node$.text()));\n }\n return results;\n};\n```", "response": "clearFilter = ->\n currentQuery = ''\n for nodeInfo in searchableNodes\n node$ = nodeInfo[1]\n node$.removeClass 'filtered matched-child'\n node$.text node$.text()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 45, "line_end": 50} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:3:completion", "type": "completion", "prompt": "clearFilter = ->\n currentQuery = ''\n for nodeInfo in searchableNodes", "response": "node$ = nodeInfo[1]\n node$.removeClass 'filtered matched-child'\n node$.text node$.text()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 45, "line_end": 50} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "highlightMatch = (node$, queryString) ->\n nodeText = node$.text()\n lowerText = nodeText.toLowerCase()\n\n markedText = ''\n furthestIndex = 0\n\n for char in queryString\n foundIndex = lowerText.indexOf char, furthestIndex\n markedText += nodeText[furthestIndex...foundIndex] + \"#{nodeText[foundIndex]}\"\n furthestIndex = foundIndex + 1\n\n node$.html markedText + nodeText[furthestIndex...]\n\n\n# ## DOM Construction", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 52, "line_end": 67} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nhighlightMatch = (node$, queryString) ->\n nodeText = node$.text()\n lowerText = nodeText.toLowerCase()\n\n markedText = ''\n furthestIndex = 0\n\n for char in queryString\n foundIndex = lowerText.indexOf char, furthestIndex\n markedText += nodeText[furthestIndex...foundIndex] + \"#{nodeText[foundIndex]}\"\n furthestIndex = foundIndex + 1\n\n node$.html markedText + nodeText[furthestIndex...]\n\n\n# ## DOM Construction\n```", "response": "var highlightMatch;\n\nhighlightMatch = function(node$, queryString) {\n var char, foundIndex, furthestIndex, i, len, lowerText, markedText, nodeText;\n nodeText = node$.text();\n lowerText = nodeText.toLowerCase();\n markedText = '';\n furthestIndex = 0;\n for (i = 0, len = queryString.length; i < len; i++) {\n char = queryString[i];\n foundIndex = lowerText.indexOf(char, furthestIndex);\n markedText += nodeText.slice(furthestIndex, foundIndex) + `${nodeText[foundIndex]}`;\n furthestIndex = foundIndex + 1;\n }\n return node$.html(markedText + nodeText.slice(furthestIndex));\n};\n\n// ## DOM Construction", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 52, "line_end": 67} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar highlightMatch;\n\nhighlightMatch = function(node$, queryString) {\n var char, foundIndex, furthestIndex, i, len, lowerText, markedText, nodeText;\n nodeText = node$.text();\n lowerText = nodeText.toLowerCase();\n markedText = '';\n furthestIndex = 0;\n for (i = 0, len = queryString.length; i < len; i++) {\n char = queryString[i];\n foundIndex = lowerText.indexOf(char, furthestIndex);\n markedText += nodeText.slice(furthestIndex, foundIndex) + `${nodeText[foundIndex]}`;\n furthestIndex = foundIndex + 1;\n }\n return node$.html(markedText + nodeText.slice(furthestIndex));\n};\n\n// ## DOM Construction\n```", "response": "highlightMatch = (node$, queryString) ->\n nodeText = node$.text()\n lowerText = nodeText.toLowerCase()\n\n markedText = ''\n furthestIndex = 0\n\n for char in queryString\n foundIndex = lowerText.indexOf char, furthestIndex\n markedText += nodeText[furthestIndex...foundIndex] + \"#{nodeText[foundIndex]}\"\n furthestIndex = foundIndex + 1\n\n node$.html markedText + nodeText[furthestIndex...]\n\n\n# ## DOM Construction", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 52, "line_end": 67} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:4:completion", "type": "completion", "prompt": "highlightMatch = (node$, queryString) ->\n nodeText = node$.text()\n lowerText = nodeText.toLowerCase()\n\n markedText = ''\n furthestIndex = 0\n\n for char in queryString", "response": "foundIndex = lowerText.indexOf char, furthestIndex\n markedText += nodeText[furthestIndex...foundIndex] + \"#{nodeText[foundIndex]}\"\n furthestIndex = foundIndex + 1\n\n node$.html markedText + nodeText[furthestIndex...]\n\n\n# ## DOM Construction", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 52, "line_end": 67} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "buildNav = (relativeRoot) ->\n nav$ = $(\"\"\"\n \n \"\"\").appendTo $('body')\n toc$ = nav$.find '.toc'\n\n files = (f for f of outline).sort()\n\n for file in files\n filePath = \"#{relativeRoot}#{file}.html\"\n\n fileNode$ = $(\"\"\"\n
  • \n #{file}\n
  • \n \"\"\").appendTo toc$\n\n appendSearchNode fileNode$.find('a')\n appendHeaderNodes fileNode$, filePath, outline[file]\n\n nav$", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 69, "line_end": 96} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nbuildNav = (relativeRoot) ->\n nav$ = $(\"\"\"\n \n \"\"\").appendTo $('body')\n toc$ = nav$.find '.toc'\n\n files = (f for f of outline).sort()\n\n for file in files\n filePath = \"#{relativeRoot}#{file}.html\"\n\n fileNode$ = $(\"\"\"\n
  • \n #{file}\n
  • \n \"\"\").appendTo toc$\n\n appendSearchNode fileNode$.find('a')\n appendHeaderNodes fileNode$, filePath, outline[file]\n\n nav$\n```", "response": "var buildNav;\n\nbuildNav = function(relativeRoot) {\n var f, file, fileNode$, filePath, files, i, len, nav$, toc$;\n nav$ = $(``).appendTo($('body'));\n toc$ = nav$.find('.toc');\n files = ((function() {\n var results;\n results = [];\n for (f in outline) {\n results.push(f);\n }\n return results;\n })()).sort();\n for (i = 0, len = files.length; i < len; i++) {\n file = files[i];\n filePath = `${relativeRoot}${file}.html`;\n fileNode$ = $(`
  • \n ${file}\n
  • `).appendTo(toc$);\n appendSearchNode(fileNode$.find('a'));\n appendHeaderNodes(fileNode$, filePath, outline[file]);\n }\n return nav$;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 69, "line_end": 96} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar buildNav;\n\nbuildNav = function(relativeRoot) {\n var f, file, fileNode$, filePath, files, i, len, nav$, toc$;\n nav$ = $(``).appendTo($('body'));\n toc$ = nav$.find('.toc');\n files = ((function() {\n var results;\n results = [];\n for (f in outline) {\n results.push(f);\n }\n return results;\n })()).sort();\n for (i = 0, len = files.length; i < len; i++) {\n file = files[i];\n filePath = `${relativeRoot}${file}.html`;\n fileNode$ = $(`
  • \n ${file}\n
  • `).appendTo(toc$);\n appendSearchNode(fileNode$.find('a'));\n appendHeaderNodes(fileNode$, filePath, outline[file]);\n }\n return nav$;\n};\n```", "response": "buildNav = (relativeRoot) ->\n nav$ = $(\"\"\"\n \n \"\"\").appendTo $('body')\n toc$ = nav$.find '.toc'\n\n files = (f for f of outline).sort()\n\n for file in files\n filePath = \"#{relativeRoot}#{file}.html\"\n\n fileNode$ = $(\"\"\"\n
  • \n #{file}\n
  • \n \"\"\").appendTo toc$\n\n appendSearchNode fileNode$.find('a')\n appendHeaderNodes fileNode$, filePath, outline[file]\n\n nav$", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 69, "line_end": 96} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:5:completion", "type": "completion", "prompt": "buildNav = (relativeRoot) ->\n nav$ = $(\"\"\"\n \n \"\"\").appendTo $('body')\n toc$ = nav$.find '.toc'\n\n files = (f for f of outline).sort()", "response": "for file in files\n filePath = \"#{relativeRoot}#{file}.html\"\n\n fileNode$ = $(\"\"\"\n
  • \n #{file}\n
  • \n \"\"\").appendTo toc$\n\n appendSearchNode fileNode$.find('a')\n appendHeaderNodes fileNode$, filePath, outline[file]\n\n nav$", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 69, "line_end": 96} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "appendHeaderNodes = (target$, filePath, nodeList) ->\n return unless nodeList.length > 0\n\n targetList$ = $('
      ').appendTo target$\n\n for node in nodeList\n node$ = $(\"\"\"\n
    1. \n #{node.data.title}\n
    2. \n \"\"\").appendTo targetList$\n appendSearchNode node$.find('a')\n\n appendHeaderNodes node$, filePath, node.children\n\n$ ->\n relativeRoot = $('meta[name=\"lidoc-relative-root\"]').attr('content')\n nav$ = buildNav relativeRoot\n\n search$ = $('#search')\n search$.bind 'keyup search', (evt) =>\n searchNodes search$.val()\n\n search$.keydown (evt) =>\n if evt.keyCode == 27 # Esc\n if search$.val().trim() == ''\n search$.blur()\n else\n search$.val ''\n\n search$.focus (evt) => nav$.addClass 'active'\n search$.blur (evt) => nav$.removeClass 'active'\n\n nav$.click (evt) =>\n search$.focus()\n\n nav$.mousedown (evt) =>\n if search$.is(':focus') and evt.target != search$[0]\n evt.preventDefault()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 98, "line_end": 136} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nappendHeaderNodes = (target$, filePath, nodeList) ->\n return unless nodeList.length > 0\n\n targetList$ = $('
        ').appendTo target$\n\n for node in nodeList\n node$ = $(\"\"\"\n
      1. \n #{node.data.title}\n
      2. \n \"\"\").appendTo targetList$\n appendSearchNode node$.find('a')\n\n appendHeaderNodes node$, filePath, node.children\n\n$ ->\n relativeRoot = $('meta[name=\"lidoc-relative-root\"]').attr('content')\n nav$ = buildNav relativeRoot\n\n search$ = $('#search')\n search$.bind 'keyup search', (evt) =>\n searchNodes search$.val()\n\n search$.keydown (evt) =>\n if evt.keyCode == 27 # Esc\n if search$.val().trim() == ''\n search$.blur()\n else\n search$.val ''\n\n search$.focus (evt) => nav$.addClass 'active'\n search$.blur (evt) => nav$.removeClass 'active'\n\n nav$.click (evt) =>\n search$.focus()\n\n nav$.mousedown (evt) =>\n if search$.is(':focus') and evt.target != search$[0]\n evt.preventDefault()\n```", "response": "var appendHeaderNodes;\n\nappendHeaderNodes = function(target$, filePath, nodeList) {\n var i, len, node, node$, results, targetList$;\n if (!(nodeList.length > 0)) {\n return;\n }\n targetList$ = $('
          ').appendTo(target$);\n results = [];\n for (i = 0, len = nodeList.length; i < len; i++) {\n node = nodeList[i];\n node$ = $(`
        1. \n ${node.data.title}\n
        2. `).appendTo(targetList$);\n appendSearchNode(node$.find('a'));\n results.push(appendHeaderNodes(node$, filePath, node.children));\n }\n return results;\n};\n\n$(function() {\n var nav$, relativeRoot, search$;\n relativeRoot = $('meta[name=\"lidoc-relative-root\"]').attr('content');\n nav$ = buildNav(relativeRoot);\n search$ = $('#search');\n search$.bind('keyup search', (evt) => {\n return searchNodes(search$.val());\n });\n search$.keydown((evt) => {\n if (evt.keyCode === 27) { // Esc\n if (search$.val().trim() === '') {\n return search$.blur();\n } else {\n return search$.val('');\n }\n }\n });\n search$.focus((evt) => {\n return nav$.addClass('active');\n });\n search$.blur((evt) => {\n return nav$.removeClass('active');\n });\n nav$.click((evt) => {\n return search$.focus();\n });\n return nav$.mousedown((evt) => {\n if (search$.is(':focus') && evt.target !== search$[0]) {\n return evt.preventDefault();\n }\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 98, "line_end": 136} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar appendHeaderNodes;\n\nappendHeaderNodes = function(target$, filePath, nodeList) {\n var i, len, node, node$, results, targetList$;\n if (!(nodeList.length > 0)) {\n return;\n }\n targetList$ = $('
            ').appendTo(target$);\n results = [];\n for (i = 0, len = nodeList.length; i < len; i++) {\n node = nodeList[i];\n node$ = $(`
          1. \n ${node.data.title}\n
          2. `).appendTo(targetList$);\n appendSearchNode(node$.find('a'));\n results.push(appendHeaderNodes(node$, filePath, node.children));\n }\n return results;\n};\n\n$(function() {\n var nav$, relativeRoot, search$;\n relativeRoot = $('meta[name=\"lidoc-relative-root\"]').attr('content');\n nav$ = buildNav(relativeRoot);\n search$ = $('#search');\n search$.bind('keyup search', (evt) => {\n return searchNodes(search$.val());\n });\n search$.keydown((evt) => {\n if (evt.keyCode === 27) { // Esc\n if (search$.val().trim() === '') {\n return search$.blur();\n } else {\n return search$.val('');\n }\n }\n });\n search$.focus((evt) => {\n return nav$.addClass('active');\n });\n search$.blur((evt) => {\n return nav$.removeClass('active');\n });\n nav$.click((evt) => {\n return search$.focus();\n });\n return nav$.mousedown((evt) => {\n if (search$.is(':focus') && evt.target !== search$[0]) {\n return evt.preventDefault();\n }\n });\n});\n```", "response": "appendHeaderNodes = (target$, filePath, nodeList) ->\n return unless nodeList.length > 0\n\n targetList$ = $('
              ').appendTo target$\n\n for node in nodeList\n node$ = $(\"\"\"\n
            1. \n #{node.data.title}\n
            2. \n \"\"\").appendTo targetList$\n appendSearchNode node$.find('a')\n\n appendHeaderNodes node$, filePath, node.children\n\n$ ->\n relativeRoot = $('meta[name=\"lidoc-relative-root\"]').attr('content')\n nav$ = buildNav relativeRoot\n\n search$ = $('#search')\n search$.bind 'keyup search', (evt) =>\n searchNodes search$.val()\n\n search$.keydown (evt) =>\n if evt.keyCode == 27 # Esc\n if search$.val().trim() == ''\n search$.blur()\n else\n search$.val ''\n\n search$.focus (evt) => nav$.addClass 'active'\n search$.blur (evt) => nav$.removeClass 'active'\n\n nav$.click (evt) =>\n search$.focus()\n\n nav$.mousedown (evt) =>\n if search$.is(':focus') and evt.target != search$[0]\n evt.preventDefault()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 98, "line_end": 136} +{"id": "nevir/groc:lib/styles/default/behavior-old.coffee:6:completion", "type": "completion", "prompt": "appendHeaderNodes = (target$, filePath, nodeList) ->\n return unless nodeList.length > 0\n\n targetList$ = $('
                ').appendTo target$\n\n for node in nodeList\n node$ = $(\"\"\"\n
              1. \n #{node.data.title}\n
              2. \n \"\"\").appendTo targetList$\n appendSearchNode node$.find('a')\n\n appendHeaderNodes node$, filePath, node.children\n\n$ ->\n relativeRoot = $('meta[name=\"lidoc-relative-root\"]').attr('content')\n nav$ = buildNav relativeRoot", "response": "search$ = $('#search')\n search$.bind 'keyup search', (evt) =>\n searchNodes search$.val()\n\n search$.keydown (evt) =>\n if evt.keyCode == 27 # Esc\n if search$.val().trim() == ''\n search$.blur()\n else\n search$.val ''\n\n search$.focus (evt) => nav$.addClass 'active'\n search$.blur (evt) => nav$.removeClass 'active'\n\n nav$.click (evt) =>\n search$.focus()\n\n nav$.mousedown (evt) =>\n if search$.is(':focus') and evt.target != search$[0]\n evt.preventDefault()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/styles/default/behavior-old.coffee", "license": "MIT", "commit": "e2d2229cac05e6ef5625b636587ca61e21edc288", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/e2d2229cac05e6ef5625b636587ca61e21edc288/lib/styles/default/behavior-old.coffee", "line_start": 98, "line_end": 136} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe '.split()', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]\n ['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['(,(,(,)', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]\n ['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)\n\ndescribe '.findClosingIndex()', ->\n tests = [\n ['a(', -1]\n ['a()', 2]\n ['a(((()', -1]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"returs the index of the closing character\", ->\n expect(findClosingIndex(source, 2, '(', ')')).toEqual(expected)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/utils-spec.coffee", "line_start": 1, "line_end": 33} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{findClosingIndex, split} = require '../lib/utils'\n\ndescribe '.split()', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]\n ['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['(,(,(,)', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]\n ['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)\n\ndescribe '.findClosingIndex()', ->\n tests = [\n ['a(', -1]\n ['a()', 2]\n ['a(((()', -1]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"returs the index of the closing character\", ->\n expect(findClosingIndex(source, 2, '(', ')')).toEqual(expected)\n```", "response": "var findClosingIndex, split;\n\n({findClosingIndex, split} = require('../lib/utils'));\n\ndescribe('.split()', function() {\n var tests;\n tests = [['a,b,c', ['a', 'b', 'c']], ['a,b(),c', ['a', 'b()', 'c']], ['a,b(c)', ['a', 'b(c)']], ['a,(b, c)', ['a', '(b,c)']], ['a,(b, c())', ['a', '(b,c())']], ['a(b, c())', ['a(b,c())']], ['a,)(', ['a']], ['a(,', []], ['(,', []], ['(,(,(,)', []], ['a,(,', ['a']], ['a,((),', ['a']], ['a,()),', ['a', '()']]];\n return tests.forEach(function([source, expected]) {\n return it(`splits ${jasmine.pp(source)} as ${jasmine.pp(expected)}`, function() {\n return expect(split(source)).toEqual(expected);\n });\n });\n});\n\ndescribe('.findClosingIndex()', function() {\n var tests;\n tests = [['a(', -1], ['a()', 2], ['a(((()', -1]];\n return tests.forEach(function([source, expected]) {\n return it(\"returs the index of the closing character\", function() {\n return expect(findClosingIndex(source, 2, '(', ')')).toEqual(expected);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/utils-spec.coffee", "line_start": 1, "line_end": 33} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findClosingIndex, split;\n\n({findClosingIndex, split} = require('../lib/utils'));\n\ndescribe('.split()', function() {\n var tests;\n tests = [['a,b,c', ['a', 'b', 'c']], ['a,b(),c', ['a', 'b()', 'c']], ['a,b(c)', ['a', 'b(c)']], ['a,(b, c)', ['a', '(b,c)']], ['a,(b, c())', ['a', '(b,c())']], ['a(b, c())', ['a(b,c())']], ['a,)(', ['a']], ['a(,', []], ['(,', []], ['(,(,(,)', []], ['a,(,', ['a']], ['a,((),', ['a']], ['a,()),', ['a', '()']]];\n return tests.forEach(function([source, expected]) {\n return it(`splits ${jasmine.pp(source)} as ${jasmine.pp(expected)}`, function() {\n return expect(split(source)).toEqual(expected);\n });\n });\n});\n\ndescribe('.findClosingIndex()', function() {\n var tests;\n tests = [['a(', -1], ['a()', 2], ['a(((()', -1]];\n return tests.forEach(function([source, expected]) {\n return it(\"returs the index of the closing character\", function() {\n return expect(findClosingIndex(source, 2, '(', ')')).toEqual(expected);\n });\n });\n});\n```", "response": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe '.split()', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]\n ['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['(,(,(,)', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]\n ['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)\n\ndescribe '.findClosingIndex()', ->\n tests = [\n ['a(', -1]\n ['a()', 2]\n ['a(((()', -1]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"returs the index of the closing character\", ->\n expect(findClosingIndex(source, 2, '(', ')')).toEqual(expected)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/utils-spec.coffee", "line_start": 1, "line_end": 33} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:completion", "type": "completion", "prompt": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe '.split()', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]\n ['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['(,(,(,)', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]", "response": "['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)\n\ndescribe '.findClosingIndex()', ->\n tests = [\n ['a(', -1]\n ['a()', 2]\n ['a(((()', -1]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"returs the index of the closing character\", ->\n expect(findClosingIndex(source, 2, '(', ')')).toEqual(expected)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/utils-spec.coffee", "line_start": 1, "line_end": 33} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]\n ['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]\n ['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa/spec/utils-spec.coffee", "line_start": 1, "line_end": 21} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]\n ['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]\n ['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)\n```", "response": "var findClosingIndex, split;\n\n({findClosingIndex, split} = require('../lib/utils'));\n\ndescribe('split', function() {\n var tests;\n tests = [['a,b,c', ['a', 'b', 'c']], ['a,b(),c', ['a', 'b()', 'c']], ['a,b(c)', ['a', 'b(c)']], ['a,(b, c)', ['a', '(b,c)']], ['a,(b, c())', ['a', '(b,c())']], ['a(b, c())', ['a(b,c())']], ['a,)(', ['a']], ['a(,', []], ['(,', []], ['a,(,', ['a']], ['a,((),', ['a']], ['a,()),', ['a', '()']]];\n return tests.forEach(function([source, expected]) {\n return it(`splits ${jasmine.pp(source)} as ${jasmine.pp(expected)}`, function() {\n return expect(split(source)).toEqual(expected);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa/spec/utils-spec.coffee", "line_start": 1, "line_end": 21} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findClosingIndex, split;\n\n({findClosingIndex, split} = require('../lib/utils'));\n\ndescribe('split', function() {\n var tests;\n tests = [['a,b,c', ['a', 'b', 'c']], ['a,b(),c', ['a', 'b()', 'c']], ['a,b(c)', ['a', 'b(c)']], ['a,(b, c)', ['a', '(b,c)']], ['a,(b, c())', ['a', '(b,c())']], ['a(b, c())', ['a(b,c())']], ['a,)(', ['a']], ['a(,', []], ['(,', []], ['a,(,', ['a']], ['a,((),', ['a']], ['a,()),', ['a', '()']]];\n return tests.forEach(function([source, expected]) {\n return it(`splits ${jasmine.pp(source)} as ${jasmine.pp(expected)}`, function() {\n return expect(split(source)).toEqual(expected);\n });\n });\n});\n```", "response": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]\n ['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]\n ['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa/spec/utils-spec.coffee", "line_start": 1, "line_end": 21} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:completion", "type": "completion", "prompt": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n tests = [\n ['a,b,c', ['a', 'b', 'c']]\n ['a,b(),c', ['a', 'b()', 'c']]\n ['a,b(c)', ['a', 'b(c)']]\n ['a,(b, c)', ['a', '(b,c)']]\n ['a,(b, c())', ['a', '(b,c())']]\n ['a(b, c())', ['a(b,c())']]", "response": "['a,)(', ['a']]\n ['a(,', []]\n ['(,', []]\n ['a,(,', ['a']]\n ['a,((),', ['a']]\n ['a,()),', ['a', '()']]\n ]\n\n tests.forEach ([source, expected]) ->\n it \"splits #{jasmine.pp source} as #{jasmine.pp(expected)}\", ->\n expect(split(source)).toEqual(expected)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4f52ba925ec5ef67d1cbf999cdecbec5a5ee76aa/spec/utils-spec.coffee", "line_start": 1, "line_end": 21} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n it 'does not fail when there is parenthesis after', ->\n string = \"a,)(\"\n\n res = split(string)\n\n expect(res).toEqual(['a',''])", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/utils-spec.coffee", "line_start": 1, "line_end": 9} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n it 'does not fail when there is parenthesis after', ->\n string = \"a,)(\"\n\n res = split(string)\n\n expect(res).toEqual(['a',''])\n```", "response": "var findClosingIndex, split;\n\n({findClosingIndex, split} = require('../lib/utils'));\n\ndescribe('split', function() {\n return it('does not fail when there is parenthesis after', function() {\n var res, string;\n string = \"a,)(\";\n res = split(string);\n return expect(res).toEqual(['a', '']);\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/utils-spec.coffee", "line_start": 1, "line_end": 9} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findClosingIndex, split;\n\n({findClosingIndex, split} = require('../lib/utils'));\n\ndescribe('split', function() {\n return it('does not fail when there is parenthesis after', function() {\n var res, string;\n string = \"a,)(\";\n res = split(string);\n return expect(res).toEqual(['a', '']);\n });\n});\n```", "response": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n it 'does not fail when there is parenthesis after', ->\n string = \"a,)(\"\n\n res = split(string)\n\n expect(res).toEqual(['a',''])", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/utils-spec.coffee", "line_start": 1, "line_end": 9} +{"id": "abe33/atom-pigments:spec/utils-spec.coffee:1:completion", "type": "completion", "prompt": "{findClosingIndex, split} = require '../lib/utils'\n\ndescribe 'split', ->\n it 'does not fail when there is parenthesis after', ->", "response": "string = \"a,)(\"\n\n res = split(string)\n\n expect(res).toEqual(['a',''])", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/utils-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/utils-spec.coffee", "line_start": 1, "line_end": 9} +{"id": "js2coffee/js2coffee:test/parse.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "require 'coffee-script/register'\nrequire './setup'\n\ndescribe 'parse()', ->\n it 'works', ->\n out = js2coffee.parse(\"// hi\\na=2\")\n expect(out.ast).be.an('object')\n expect(out.map).be.an('object')\n expect(out.code).be.a('string')\n # console.log(require('util').inspect(out, { depth: 1000 }))", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "test/parse.coffee", "license": "MIT", "commit": "bfc11f90ef657fdbfe40ad982a7361636fe887b4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/bfc11f90ef657fdbfe40ad982a7361636fe887b4/test/parse.coffee", "line_start": 1, "line_end": 10} +{"id": "js2coffee/js2coffee:test/parse.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrequire 'coffee-script/register'\nrequire './setup'\n\ndescribe 'parse()', ->\n it 'works', ->\n out = js2coffee.parse(\"// hi\\na=2\")\n expect(out.ast).be.an('object')\n expect(out.map).be.an('object')\n expect(out.code).be.a('string')\n # console.log(require('util').inspect(out, { depth: 1000 }))\n```", "response": "require('coffee-script/register');\n\nrequire('./setup');\n\ndescribe('parse()', function() {\n return it('works', function() {\n var out;\n out = js2coffee.parse(\"// hi\\na=2\");\n expect(out.ast).be.an('object');\n expect(out.map).be.an('object');\n return expect(out.code).be.a('string');\n });\n});\n\n// console.log(require('util').inspect(out, { depth: 1000 }))", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "test/parse.coffee", "license": "MIT", "commit": "bfc11f90ef657fdbfe40ad982a7361636fe887b4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/bfc11f90ef657fdbfe40ad982a7361636fe887b4/test/parse.coffee", "line_start": 1, "line_end": 10} +{"id": "js2coffee/js2coffee:test/parse.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nrequire('coffee-script/register');\n\nrequire('./setup');\n\ndescribe('parse()', function() {\n return it('works', function() {\n var out;\n out = js2coffee.parse(\"// hi\\na=2\");\n expect(out.ast).be.an('object');\n expect(out.map).be.an('object');\n return expect(out.code).be.a('string');\n });\n});\n\n// console.log(require('util').inspect(out, { depth: 1000 }))\n```", "response": "require 'coffee-script/register'\nrequire './setup'\n\ndescribe 'parse()', ->\n it 'works', ->\n out = js2coffee.parse(\"// hi\\na=2\")\n expect(out.ast).be.an('object')\n expect(out.map).be.an('object')\n expect(out.code).be.a('string')\n # console.log(require('util').inspect(out, { depth: 1000 }))", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "test/parse.coffee", "license": "MIT", "commit": "bfc11f90ef657fdbfe40ad982a7361636fe887b4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/bfc11f90ef657fdbfe40ad982a7361636fe887b4/test/parse.coffee", "line_start": 1, "line_end": 10} +{"id": "js2coffee/js2coffee:test/parse.coffee:1:completion", "type": "completion", "prompt": "require 'coffee-script/register'\nrequire './setup'\n\ndescribe 'parse()', ->\n it 'works', ->", "response": "out = js2coffee.parse(\"// hi\\na=2\")\n expect(out.ast).be.an('object')\n expect(out.map).be.an('object')\n expect(out.code).be.a('string')\n # console.log(require('util').inspect(out, { depth: 1000 }))", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "test/parse.coffee", "license": "MIT", "commit": "bfc11f90ef657fdbfe40ad982a7361636fe887b4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/bfc11f90ef657fdbfe40ad982a7361636fe887b4/test/parse.coffee", "line_start": 1, "line_end": 10} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "SocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (callback=->) =>\n ->\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n callback.apply this, originalArguments\n\nmodule.exports = Limiter", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 12} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (callback=->) =>\n ->\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n callback.apply this, originalArguments\n\nmodule.exports = Limiter\n```", "response": "var Limiter, SocketIOThrottle;\n\nSocketIOThrottle = require('./SocketIOThrottle');\n\nLimiter = class Limiter {\n constructor(socket) {\n this.throttle = this.throttle.bind(this);\n this.socket = socket;\n }\n\n throttle(callback = function() {}) {\n return function() {\n var originalArguments;\n originalArguments = arguments;\n return new SocketIOThrottle().throttle(this.socket, () => {\n return callback.apply(this, originalArguments);\n });\n };\n }\n\n};\n\nmodule.exports = Limiter;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 12} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Limiter, SocketIOThrottle;\n\nSocketIOThrottle = require('./SocketIOThrottle');\n\nLimiter = class Limiter {\n constructor(socket) {\n this.throttle = this.throttle.bind(this);\n this.socket = socket;\n }\n\n throttle(callback = function() {}) {\n return function() {\n var originalArguments;\n originalArguments = arguments;\n return new SocketIOThrottle().throttle(this.socket, () => {\n return callback.apply(this, originalArguments);\n });\n };\n }\n\n};\n\nmodule.exports = Limiter;\n```", "response": "SocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (callback=->) =>\n ->\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n callback.apply this, originalArguments\n\nmodule.exports = Limiter", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 12} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:completion", "type": "completion", "prompt": "SocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (callback=->) =>", "response": "->\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n callback.apply this, originalArguments\n\nmodule.exports = Limiter", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/77687429c42e3a7e9bb2fcb9a04c9cbf8c7d91bc/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 12} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "SocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (@callback=->) =>\n @throttled\n\n throttled: =>\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n @callback.apply this, originalArguments\n\nmodule.exports = Limiter", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "edf1db3062b6872de5f1b418aced623e9dafa587", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/edf1db3062b6872de5f1b418aced623e9dafa587/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 14} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (@callback=->) =>\n @throttled\n\n throttled: =>\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n @callback.apply this, originalArguments\n\nmodule.exports = Limiter\n```", "response": "var Limiter, SocketIOThrottle;\n\nSocketIOThrottle = require('./SocketIOThrottle');\n\nLimiter = class Limiter {\n constructor(socket) {\n this.throttle = this.throttle.bind(this);\n this.throttled = this.throttled.bind(this);\n this.socket = socket;\n }\n\n throttle(callback = function() {}) {\n this.callback = callback;\n return this.throttled;\n }\n\n throttled() {\n var originalArguments;\n originalArguments = arguments;\n return new SocketIOThrottle().throttle(this.socket, () => {\n return this.callback.apply(this, originalArguments);\n });\n }\n\n};\n\nmodule.exports = Limiter;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "edf1db3062b6872de5f1b418aced623e9dafa587", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/edf1db3062b6872de5f1b418aced623e9dafa587/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 14} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Limiter, SocketIOThrottle;\n\nSocketIOThrottle = require('./SocketIOThrottle');\n\nLimiter = class Limiter {\n constructor(socket) {\n this.throttle = this.throttle.bind(this);\n this.throttled = this.throttled.bind(this);\n this.socket = socket;\n }\n\n throttle(callback = function() {}) {\n this.callback = callback;\n return this.throttled;\n }\n\n throttled() {\n var originalArguments;\n originalArguments = arguments;\n return new SocketIOThrottle().throttle(this.socket, () => {\n return this.callback.apply(this, originalArguments);\n });\n }\n\n};\n\nmodule.exports = Limiter;\n```", "response": "SocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (@callback=->) =>\n @throttled\n\n throttled: =>\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n @callback.apply this, originalArguments\n\nmodule.exports = Limiter", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "edf1db3062b6872de5f1b418aced623e9dafa587", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/edf1db3062b6872de5f1b418aced623e9dafa587/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 14} +{"id": "octoblu/meshblu:lib/SocketIOLimiter.coffee:1:completion", "type": "completion", "prompt": "SocketIOThrottle = require './SocketIOThrottle'\n\nclass Limiter\n constructor: (@socket) ->\n\n throttle: (@callback=->) =>\n @throttled", "response": "throttled: =>\n originalArguments = arguments\n new SocketIOThrottle().throttle @socket, =>\n @callback.apply this, originalArguments\n\nmodule.exports = Limiter", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/SocketIOLimiter.coffee", "license": "MIT", "commit": "edf1db3062b6872de5f1b418aced623e9dafa587", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/edf1db3062b6872de5f1b418aced623e9dafa587/lib/SocketIOLimiter.coffee", "line_start": 1, "line_end": 14} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "resolve = require('resolve')\npath = require('path')\n\nmodule.exports =\n resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(\"#{requirable}/package.json\", opts))\n catch e\n undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nresolve = require('resolve')\npath = require('path')\n\nmodule.exports =\n resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(\"#{requirable}/package.json\", opts))\n catch e\n undefined\n```", "response": "var path, resolve;\n\nresolve = require('resolve');\n\npath = require('path');\n\nmodule.exports = {\n resolve: function(requirable, opts) {\n var e;\n try {\n return path.dirname(resolve.sync(`${requirable}/package.json`, opts));\n } catch (error) {\n e = error;\n return void 0;\n }\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar path, resolve;\n\nresolve = require('resolve');\n\npath = require('path');\n\nmodule.exports = {\n resolve: function(requirable, opts) {\n var e;\n try {\n return path.dirname(resolve.sync(`${requirable}/package.json`, opts));\n } catch (error) {\n e = error;\n return void 0;\n }\n }\n};\n```", "response": "resolve = require('resolve')\npath = require('path')\n\nmodule.exports =\n resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(\"#{requirable}/package.json\", opts))\n catch e\n undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:completion", "type": "completion", "prompt": "resolve = require('resolve')\npath = require('path')\n\nmodule.exports =", "response": "resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(\"#{requirable}/package.json\", opts))\n catch e\n undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "resolve = require('resolve')\npath = require('path')\n\nmodule.exports =\n resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(requirable, opts))\n catch e\n undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nresolve = require('resolve')\npath = require('path')\n\nmodule.exports =\n resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(requirable, opts))\n catch e\n undefined\n```", "response": "var path, resolve;\n\nresolve = require('resolve');\n\npath = require('path');\n\nmodule.exports = {\n resolve: function(requirable, opts) {\n var e;\n try {\n return path.dirname(resolve.sync(requirable, opts));\n } catch (error) {\n e = error;\n return void 0;\n }\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar path, resolve;\n\nresolve = require('resolve');\n\npath = require('path');\n\nmodule.exports = {\n resolve: function(requirable, opts) {\n var e;\n try {\n return path.dirname(resolve.sync(requirable, opts));\n } catch (error) {\n e = error;\n return void 0;\n }\n }\n};\n```", "response": "resolve = require('resolve')\npath = require('path')\n\nmodule.exports =\n resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(requirable, opts))\n catch e\n undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:lib/resolves-quietly.coffee:1:completion", "type": "completion", "prompt": "resolve = require('resolve')\npath = require('path')\n\nmodule.exports =", "response": "resolve: (requirable, opts) ->\n try\n path.dirname(resolve.sync(requirable, opts))\n catch e\n undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/resolves-quietly.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/lib/resolves-quietly.coffee", "line_start": 1, "line_end": 9} +{"id": "jianliaoim/talk-os:talk-web/client/handlers/network.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Q = require 'q'\nrecorder = require 'actions-recorder'\n\napi = require '../network/api'\n\nactions = require '../actions/index'\nuserActions = require '../actions/user'\nteamActions = require '../actions/team'\nroomActions = require '../actions/room'\nstoryActions = require '../actions/story'\nmessageActions = require '../actions/message'\nnotificationActions = require '../actions/notification'\naccountActions = require '../actions/account'\n\nexports.newConnection = ->\n api.users.subscribe.post()\n\nexports.longReconnection = (cb) ->\n # 这个断线有个问题:\n # 当我们在其他没有 _teamId 的页面, 比如 /settings 页面\n # 这里断线重连就会挂掉\n store = recorder.getState()\n\n _teamId = store.getIn ['router', 'data', '_teamId']\n _roomId = store.getIn ['router', 'data', '_roomId']\n _toId = store.getIn ['router', 'data', '_toId']\n _storyId = store.getIn ['router', 'data', '_storyId']\n\n fetchUser = (success, fail) -> userActions.userMe(success, fail)\n fetchTeams = (success, fail) -> teamActions.teamsFetch(success, fail)\n fetchTeamMembers = (success, fail) -> teamActions.teamMembers(_teamId, success, fail)\n fetchTopics = (success, fail) -> teamActions.teamTopics(_teamId, success, fail)\n fetchAccounts = (success, fail) -> accountActions.fetch(success, fail)\n fetchInteSettings = (success, fail) -> actions.inte.getSettings(success, fail)\n fetchNotifications = (success, fail) -> notificationActions.read(_teamId, {}, success, fail)\n\n if _teamId?\n subscribeTeam = (success, fail) -> teamActions.teamSubscribe(_teamId, success, fail)\n if _roomId?\n fetchChannel = (success, fail) -> roomActions.fetch(_roomId, success, fail)\n else if _toId?\n fetchChannel = (success, fail) -> messageActions.messageReadChat(_teamId, _toId, success, fail)\n else if _storyId?\n fetchChannel = (success, fail) -> storyActions.read(_teamId, {}, success, fail)\n\n calls = [\n subscribeTeam, fetchUser, fetchAccounts, fetchTeams\n fetchTeamMembers, fetchTopics, fetchChannel, fetchNotifications, fetchInteSettings\n ]\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/handlers/network.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/network.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/handlers/network.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nQ = require 'q'\nrecorder = require 'actions-recorder'\n\napi = require '../network/api'\n\nactions = require '../actions/index'\nuserActions = require '../actions/user'\nteamActions = require '../actions/team'\nroomActions = require '../actions/room'\nstoryActions = require '../actions/story'\nmessageActions = require '../actions/message'\nnotificationActions = require '../actions/notification'\naccountActions = require '../actions/account'\n\nexports.newConnection = ->\n api.users.subscribe.post()\n\nexports.longReconnection = (cb) ->\n # 这个断线有个问题:\n # 当我们在其他没有 _teamId 的页面, 比如 /settings 页面\n # 这里断线重连就会挂掉\n store = recorder.getState()\n\n _teamId = store.getIn ['router', 'data', '_teamId']\n _roomId = store.getIn ['router', 'data', '_roomId']\n _toId = store.getIn ['router', 'data', '_toId']\n _storyId = store.getIn ['router', 'data', '_storyId']\n\n fetchUser = (success, fail) -> userActions.userMe(success, fail)\n fetchTeams = (success, fail) -> teamActions.teamsFetch(success, fail)\n fetchTeamMembers = (success, fail) -> teamActions.teamMembers(_teamId, success, fail)\n fetchTopics = (success, fail) -> teamActions.teamTopics(_teamId, success, fail)\n fetchAccounts = (success, fail) -> accountActions.fetch(success, fail)\n fetchInteSettings = (success, fail) -> actions.inte.getSettings(success, fail)\n fetchNotifications = (success, fail) -> notificationActions.read(_teamId, {}, success, fail)\n\n if _teamId?\n subscribeTeam = (success, fail) -> teamActions.teamSubscribe(_teamId, success, fail)\n if _roomId?\n fetchChannel = (success, fail) -> roomActions.fetch(_roomId, success, fail)\n else if _toId?\n fetchChannel = (success, fail) -> messageActions.messageReadChat(_teamId, _toId, success, fail)\n else if _storyId?\n fetchChannel = (success, fail) -> storyActions.read(_teamId, {}, success, fail)\n\n calls = [\n subscribeTeam, fetchUser, fetchAccounts, fetchTeams\n fetchTeamMembers, fetchTopics, fetchChannel, fetchNotifications, fetchInteSettings\n ]\n else\n```", "response": "var Q, accountActions, actions, api, messageActions, notificationActions, recorder, roomActions, storyActions, teamActions, userActions;\n\nQ = require('q');\n\nrecorder = require('actions-recorder');\n\napi = require('../network/api');\n\nactions = require('../actions/index');\n\nuserActions = require('../actions/user');\n\nteamActions = require('../actions/team');\n\nroomActions = require('../actions/room');\n\nstoryActions = require('../actions/story');\n\nmessageActions = require('../actions/message');\n\nnotificationActions = require('../actions/notification');\n\naccountActions = require('../actions/account');\n\nexports.newConnection = function() {\n return api.users.subscribe.post();\n};\n\nexports.longReconnection = function(cb) {\n var _roomId, _storyId, _teamId, _toId, calls, fetchAccounts, fetchChannel, fetchInteSettings, fetchNotifications, fetchTeamMembers, fetchTeams, fetchTopics, fetchUser, store, subscribeTeam;\n // 这个断线有个问题:\n // 当我们在其他没有 _teamId 的页面, 比如 /settings 页面\n // 这里断线重连就会挂掉\n store = recorder.getState();\n _teamId = store.getIn(['router', 'data', '_teamId']);\n _roomId = store.getIn(['router', 'data', '_roomId']);\n _toId = store.getIn(['router', 'data', '_toId']);\n _storyId = store.getIn(['router', 'data', '_storyId']);\n fetchUser = function(success, fail) {\n return userActions.userMe(success, fail);\n };\n fetchTeams = function(success, fail) {\n return teamActions.teamsFetch(success, fail);\n };\n fetchTeamMembers = function(success, fail) {\n return teamActions.teamMembers(_teamId, success, fail);\n };\n fetchTopics = function(success, fail) {\n return teamActions.teamTopics(_teamId, success, fail);\n };\n fetchAccounts = function(success, fail) {\n return accountActions.fetch(success, fail);\n };\n fetchInteSettings = function(success, fail) {\n return actions.inte.getSettings(success, fail);\n };\n fetchNotifications = function(success, fail) {\n return notificationActions.read(_teamId, {}, success, fail);\n };\n if (_teamId != null) {\n subscribeTeam = function(success, fail) {\n return teamActions.teamSubscribe(_teamId, success, fail);\n };\n if (_roomId != null) {\n fetchChannel = function(success, fail) {\n return roomActions.fetch(_roomId, success, fail);\n };\n } else if (_toId != null) {\n fetchChannel = function(success, fail) {\n return messageActions.messageReadChat(_teamId, _toId, success, fail);\n };\n } else if (_storyId != null) {\n fetchChannel = function(success, fail) {\n return storyActions.read(_teamId, {}, success, fail);\n };\n }\n return calls = [subscribeTeam, fetchUser, fetchAccounts, fetchTeams, fetchTeamMembers, fetchTopics, fetchChannel, fetchNotifications, fetchInteSettings];\n } else {\n\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/handlers/network.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/network.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/handlers/network.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Q, accountActions, actions, api, messageActions, notificationActions, recorder, roomActions, storyActions, teamActions, userActions;\n\nQ = require('q');\n\nrecorder = require('actions-recorder');\n\napi = require('../network/api');\n\nactions = require('../actions/index');\n\nuserActions = require('../actions/user');\n\nteamActions = require('../actions/team');\n\nroomActions = require('../actions/room');\n\nstoryActions = require('../actions/story');\n\nmessageActions = require('../actions/message');\n\nnotificationActions = require('../actions/notification');\n\naccountActions = require('../actions/account');\n\nexports.newConnection = function() {\n return api.users.subscribe.post();\n};\n\nexports.longReconnection = function(cb) {\n var _roomId, _storyId, _teamId, _toId, calls, fetchAccounts, fetchChannel, fetchInteSettings, fetchNotifications, fetchTeamMembers, fetchTeams, fetchTopics, fetchUser, store, subscribeTeam;\n // 这个断线有个问题:\n // 当我们在其他没有 _teamId 的页面, 比如 /settings 页面\n // 这里断线重连就会挂掉\n store = recorder.getState();\n _teamId = store.getIn(['router', 'data', '_teamId']);\n _roomId = store.getIn(['router', 'data', '_roomId']);\n _toId = store.getIn(['router', 'data', '_toId']);\n _storyId = store.getIn(['router', 'data', '_storyId']);\n fetchUser = function(success, fail) {\n return userActions.userMe(success, fail);\n };\n fetchTeams = function(success, fail) {\n return teamActions.teamsFetch(success, fail);\n };\n fetchTeamMembers = function(success, fail) {\n return teamActions.teamMembers(_teamId, success, fail);\n };\n fetchTopics = function(success, fail) {\n return teamActions.teamTopics(_teamId, success, fail);\n };\n fetchAccounts = function(success, fail) {\n return accountActions.fetch(success, fail);\n };\n fetchInteSettings = function(success, fail) {\n return actions.inte.getSettings(success, fail);\n };\n fetchNotifications = function(success, fail) {\n return notificationActions.read(_teamId, {}, success, fail);\n };\n if (_teamId != null) {\n subscribeTeam = function(success, fail) {\n return teamActions.teamSubscribe(_teamId, success, fail);\n };\n if (_roomId != null) {\n fetchChannel = function(success, fail) {\n return roomActions.fetch(_roomId, success, fail);\n };\n } else if (_toId != null) {\n fetchChannel = function(success, fail) {\n return messageActions.messageReadChat(_teamId, _toId, success, fail);\n };\n } else if (_storyId != null) {\n fetchChannel = function(success, fail) {\n return storyActions.read(_teamId, {}, success, fail);\n };\n }\n return calls = [subscribeTeam, fetchUser, fetchAccounts, fetchTeams, fetchTeamMembers, fetchTopics, fetchChannel, fetchNotifications, fetchInteSettings];\n } else {\n\n }\n};\n```", "response": "Q = require 'q'\nrecorder = require 'actions-recorder'\n\napi = require '../network/api'\n\nactions = require '../actions/index'\nuserActions = require '../actions/user'\nteamActions = require '../actions/team'\nroomActions = require '../actions/room'\nstoryActions = require '../actions/story'\nmessageActions = require '../actions/message'\nnotificationActions = require '../actions/notification'\naccountActions = require '../actions/account'\n\nexports.newConnection = ->\n api.users.subscribe.post()\n\nexports.longReconnection = (cb) ->\n # 这个断线有个问题:\n # 当我们在其他没有 _teamId 的页面, 比如 /settings 页面\n # 这里断线重连就会挂掉\n store = recorder.getState()\n\n _teamId = store.getIn ['router', 'data', '_teamId']\n _roomId = store.getIn ['router', 'data', '_roomId']\n _toId = store.getIn ['router', 'data', '_toId']\n _storyId = store.getIn ['router', 'data', '_storyId']\n\n fetchUser = (success, fail) -> userActions.userMe(success, fail)\n fetchTeams = (success, fail) -> teamActions.teamsFetch(success, fail)\n fetchTeamMembers = (success, fail) -> teamActions.teamMembers(_teamId, success, fail)\n fetchTopics = (success, fail) -> teamActions.teamTopics(_teamId, success, fail)\n fetchAccounts = (success, fail) -> accountActions.fetch(success, fail)\n fetchInteSettings = (success, fail) -> actions.inte.getSettings(success, fail)\n fetchNotifications = (success, fail) -> notificationActions.read(_teamId, {}, success, fail)\n\n if _teamId?\n subscribeTeam = (success, fail) -> teamActions.teamSubscribe(_teamId, success, fail)\n if _roomId?\n fetchChannel = (success, fail) -> roomActions.fetch(_roomId, success, fail)\n else if _toId?\n fetchChannel = (success, fail) -> messageActions.messageReadChat(_teamId, _toId, success, fail)\n else if _storyId?\n fetchChannel = (success, fail) -> storyActions.read(_teamId, {}, success, fail)\n\n calls = [\n subscribeTeam, fetchUser, fetchAccounts, fetchTeams\n fetchTeamMembers, fetchTopics, fetchChannel, fetchNotifications, fetchInteSettings\n ]\n else", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/handlers/network.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/network.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/handlers/network.coffee:1:completion", "type": "completion", "prompt": "Q = require 'q'\nrecorder = require 'actions-recorder'\n\napi = require '../network/api'\n\nactions = require '../actions/index'\nuserActions = require '../actions/user'\nteamActions = require '../actions/team'\nroomActions = require '../actions/room'\nstoryActions = require '../actions/story'\nmessageActions = require '../actions/message'\nnotificationActions = require '../actions/notification'\naccountActions = require '../actions/account'\n\nexports.newConnection = ->\n api.users.subscribe.post()\n\nexports.longReconnection = (cb) ->\n # 这个断线有个问题:\n # 当我们在其他没有 _teamId 的页面, 比如 /settings 页面\n # 这里断线重连就会挂掉\n store = recorder.getState()\n\n _teamId = store.getIn ['router', 'data', '_teamId']\n _roomId = store.getIn ['router', 'data', '_roomId']", "response": "_toId = store.getIn ['router', 'data', '_toId']\n _storyId = store.getIn ['router', 'data', '_storyId']\n\n fetchUser = (success, fail) -> userActions.userMe(success, fail)\n fetchTeams = (success, fail) -> teamActions.teamsFetch(success, fail)\n fetchTeamMembers = (success, fail) -> teamActions.teamMembers(_teamId, success, fail)\n fetchTopics = (success, fail) -> teamActions.teamTopics(_teamId, success, fail)\n fetchAccounts = (success, fail) -> accountActions.fetch(success, fail)\n fetchInteSettings = (success, fail) -> actions.inte.getSettings(success, fail)\n fetchNotifications = (success, fail) -> notificationActions.read(_teamId, {}, success, fail)\n\n if _teamId?\n subscribeTeam = (success, fail) -> teamActions.teamSubscribe(_teamId, success, fail)\n if _roomId?\n fetchChannel = (success, fail) -> roomActions.fetch(_roomId, success, fail)\n else if _toId?\n fetchChannel = (success, fail) -> messageActions.messageReadChat(_teamId, _toId, success, fail)\n else if _storyId?\n fetchChannel = (success, fail) -> storyActions.read(_teamId, {}, success, fail)\n\n calls = [\n subscribeTeam, fetchUser, fetchAccounts, fetchTeams\n fetchTeamMembers, fetchTopics, fetchChannel, fetchNotifications, fetchInteSettings\n ]\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/handlers/network.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/network.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/handlers/network.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "calls = [fetchUser, fetchAccounts, fetchTeams, fetchInteSettings]\n\n Q.all(calls.map(Q))\n .then ->\n cb?()\n .done()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/handlers/network.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/network.coffee", "line_start": 51, "line_end": 56} +{"id": "jianliaoim/talk-os:talk-web/client/handlers/network.coffee:2:completion", "type": "completion", "prompt": "calls = [fetchUser, fetchAccounts, fetchTeams, fetchInteSettings]\n\n Q.all(calls.map(Q))", "response": ".then ->\n cb?()\n .done()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/handlers/network.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/network.coffee", "line_start": 51, "line_end": 56} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n Houston.becomeAdmin()\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston.becomeAdmin()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n Houston.becomeAdmin()\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston.becomeAdmin()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Houston._admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n return Houston.becomeAdmin();\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n return Houston.becomeAdmin();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Houston._admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n return Houston.becomeAdmin();\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n return Houston.becomeAdmin();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n Houston.becomeAdmin()\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston.becomeAdmin()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else", "response": "Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n Houston.becomeAdmin()\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston.becomeAdmin()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e7f3b45859baf942fb6681e5bfc48cba1ec1af6a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e7f3b45859baf942fb6681e5bfc48cba1ec1af6a/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Houston._admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e7f3b45859baf942fb6681e5bfc48cba1ec1af6a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e7f3b45859baf942fb6681e5bfc48cba1ec1af6a/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Houston._admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e7f3b45859baf942fb6681e5bfc48cba1ec1af6a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e7f3b45859baf942fb6681e5bfc48cba1ec1af6a/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {", "response": "email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e7f3b45859baf942fb6681e5bfc48cba1ec1af6a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e7f3b45859baf942fb6681e5bfc48cba1ec1af6a/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n debugger\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a32808b056df45e21fb59f9bce37162f03d626b1", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a32808b056df45e21fb59f9bce37162f03d626b1/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n debugger\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Houston._admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n debugger;\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a32808b056df45e21fb59f9bce37162f03d626b1", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a32808b056df45e21fb59f9bce37162f03d626b1/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Houston._admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n debugger;\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n debugger\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a32808b056df45e21fb59f9bce37162f03d626b1", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a32808b056df45e21fb59f9bce37162f03d626b1/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Houston._admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {", "response": "email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n debugger\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a32808b056df45e21fb59f9bce37162f03d626b1", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a32808b056df45e21fb59f9bce37162f03d626b1/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e0a2c35a38f51213a3155b576b41de2b73330ac4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e0a2c35a38f51213a3155b576b41de2b73330ac4/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e0a2c35a38f51213a3155b576b41de2b73330ac4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e0a2c35a38f51213a3155b576b41de2b73330ac4/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e0a2c35a38f51213a3155b576b41de2b73330ac4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e0a2c35a38f51213a3155b576b41de2b73330ac4/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {", "response": "email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "e0a2c35a38f51213a3155b576b41de2b73330ac4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/e0a2c35a38f51213a3155b576b41de2b73330ac4/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n current_user_is_admin: -> Houston._user_is_admin(Meteor.userId())\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "2eae6f2f5b0c84cee19ee4f568143177c0cef0e7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2eae6f2f5b0c84cee19ee4f568143177c0cef0e7/client/admin_login.coffee", "line_start": 1, "line_end": 46} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nadmin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n current_user_is_admin: -> Houston._user_is_admin(Meteor.userId())\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "var admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n },\n current_user_is_admin: function() {\n return Houston._user_is_admin(Meteor.userId());\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "2eae6f2f5b0c84cee19ee4f568143177c0cef0e7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2eae6f2f5b0c84cee19ee4f568143177c0cef0e7/client/admin_login.coffee", "line_start": 1, "line_end": 46} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n },\n current_user_is_admin: function() {\n return Houston._user_is_admin(Meteor.userId());\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n current_user_is_admin: -> Houston._user_is_admin(Meteor.userId())\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "2eae6f2f5b0c84cee19ee4f568143177c0cef0e7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2eae6f2f5b0c84cee19ee4f568143177c0cef0e7/client/admin_login.coffee", "line_start": 1, "line_end": 46} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n current_user_is_admin: -> Houston._user_is_admin(Meteor.userId())\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin", "response": "else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "2eae6f2f5b0c84cee19ee4f568143177c0cef0e7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/2eae6f2f5b0c84cee19ee4f568143177c0cef0e7/client/admin_login.coffee", "line_start": 1, "line_end": 46} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "75213c999ee4e09162310c20fc0217b78bd4068b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/75213c999ee4e09162310c20fc0217b78bd4068b/client/admin_login.coffee", "line_start": 1, "line_end": 45} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nadmin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "var admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "75213c999ee4e09162310c20fc0217b78bd4068b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/75213c999ee4e09162310c20fc0217b78bd4068b/client/admin_login.coffee", "line_start": 1, "line_end": 45} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click #houston-logout': function(e) {\n e.preventDefault();\n Meteor.logout();\n // going 'home' clears the side nav\n return Houston._go('home');\n },\n 'click #become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "75213c999ee4e09162310c20fc0217b78bd4068b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/75213c999ee4e09162310c20fc0217b78bd4068b/client/admin_login.coffee", "line_start": 1, "line_end": 45} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin", "response": "else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click #houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n # going 'home' clears the side nav\n Houston._go 'home'\n\n 'click #become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "75213c999ee4e09162310c20fc0217b78bd4068b", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/75213c999ee4e09162310c20fc0217b78bd4068b/client/admin_login.coffee", "line_start": 1, "line_end": 45} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "b2075e2ad57a6d32837b542c1919488fa2f65d74", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b2075e2ad57a6d32837b542c1919488fa2f65d74/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nadmin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "var admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "b2075e2ad57a6d32837b542c1919488fa2f65d74", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b2075e2ad57a6d32837b542c1919488fa2f65d74/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"houston-email\"]').val();\n password = $('input[name=\"houston-password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: email,\n password: password\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "b2075e2ad57a6d32837b542c1919488fa2f65d74", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b2075e2ad57a6d32837b542c1919488fa2f65d74/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"houston-email\"]').val()\n password = $('input[name=\"houston-password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: email\n password: password\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "b2075e2ad57a6d32837b542c1919488fa2f65d74", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/b2075e2ad57a6d32837b542c1919488fa2f65d74/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nadmin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "var admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - user got created\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - user got created\n Houston._call('make_admin', Meteor.userId(), afterLogin)\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e4884c3adaadbcf3cabe34bf4fc196e59d3001", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e4884c3adaadbcf3cabe34bf4fc196e59d3001/client/admin_login.coffee", "line_start": 1, "line_end": 43} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nadmin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "var admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, afterLogin);\n return Houston._call('make_admin', Meteor.userId());\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Houston._call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, afterLogin);\n return Houston._call('make_admin', Meteor.userId());\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Houston._call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'", "response": "if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "4b18561921e57c866348c671e76597b67f4ea52e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/4b18561921e57c866348c671e76597b67f4ea52e/client/admin_login.coffee", "line_start": 1, "line_end": 40} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - make me an admin, then send me on my way.\n Houston._call 'make_admin', Meteor.userId(), afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "920f222e080c04527c9e08c303c24c967f2a051c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/920f222e080c04527c9e08c303c24c967f2a051c/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nadmin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - make me an admin, then send me on my way.\n Houston._call 'make_admin', Meteor.userId(), afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "var admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - make me an admin, then send me on my way.\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Houston._call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "920f222e080c04527c9e08c303c24c967f2a051c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/920f222e080c04527c9e08c303c24c967f2a051c/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, function(error) {\n if (error) {\n return afterLogin(error);\n }\n // else - make me an admin, then send me on my way.\n return Houston._call('make_admin', Meteor.userId(), afterLogin);\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Houston._call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - make me an admin, then send me on my way.\n Houston._call 'make_admin', Meteor.userId(), afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "920f222e080c04527c9e08c303c24c967f2a051c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/920f222e080c04527c9e08c303c24c967f2a051c/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, (error) ->\n return afterLogin(error) if error\n # else - make me an admin, then send me on my way.\n Houston._call 'make_admin', Meteor.userId(), afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "920f222e080c04527c9e08c303c24c967f2a051c", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/920f222e080c04527c9e08c303c24c967f2a051c/client/admin_login.coffee", "line_start": 1, "line_end": 42} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a8407463c051c75abbcf8e7d884170bc012648e8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a8407463c051c75abbcf8e7d884170bc012648e8/client/admin_login.coffee", "line_start": 1, "line_end": 41} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nadmin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "var admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, afterLogin);\n return Houston._call('make_admin', Meteor.userId());\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a8407463c051c75abbcf8e7d884170bc012648e8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a8407463c051c75abbcf8e7d884170bc012648e8/client/admin_login.coffee", "line_start": 1, "line_end": 41} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar admin_user_exists;\n\nadmin_user_exists = function() {\n return Houston._admins.find().count() > 0;\n};\n\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (admin_user_exists()) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val()\n }, afterLogin);\n return Houston._call('make_admin', Meteor.userId());\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n e.preventDefault();\n Houston._call('make_admin', Meteor.userId());\n return Houston._go('home');\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a8407463c051c75abbcf8e7d884170bc012648e8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a8407463c051c75abbcf8e7d884170bc012648e8/client/admin_login.coffee", "line_start": 1, "line_end": 41} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "admin_user_exists = () -> Houston._admins.find().count() > 0\n\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'", "response": "if admin_user_exists()\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n }, afterLogin\n Houston._call('make_admin', Meteor.userId())\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n e.preventDefault()\n Houston._call('make_admin', Meteor.userId())\n Houston._go 'home'\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "a8407463c051c75abbcf8e7d884170bc012648e8", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/a8407463c051c75abbcf8e7d884170bc012648e8/client/admin_login.coffee", "line_start": 1, "line_end": 41} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Houston._call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Houston._call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Houston._call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "c64d37df458f49f3aec190bdf793fa665473895a", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/c64d37df458f49f3aec190bdf793fa665473895a/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Meteor.call('_houston_make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Meteor.call('_houston_make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Houston._go 'home'\n\n if Meteor.users.findOne('profile.admin': true)", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "446fa960c31d33c521b881308100a6ac27b904d0", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/446fa960c31d33c521b881308100a6ac27b904d0/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return houston_go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Meteor.call('_houston_make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return houston_go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Meteor.call('_houston_make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "16ea359dbf8dfec50191fb5cf8c98d6c81120457", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/16ea359dbf8dfec50191fb5cf8c98d6c81120457/client/admin_login.coffee", "line_start": 1, "line_end": 39} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/client/admin_login.coffee", "line_start": 1, "line_end": 31} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Meteor.call('_houston_make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/client/admin_login.coffee", "line_start": 1, "line_end": 31} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate._houston_login.events({\n 'submit #houston-sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .houston-logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-houston-admin': function(e) {\n Meteor.call('_houston_make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate._houston_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/client/admin_login.coffee", "line_start": 1, "line_end": 31} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template._houston_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate._houston_login.events(\n 'submit #houston-sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser", "response": "email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .houston-logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n\n 'click .become-houston-admin': (e) ->\n Meteor.call('_houston_make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate._houston_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "93e06a251afa99843d47e26f6bfde1ba3c93c47e", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/93e06a251afa99843d47e26f6bfde1ba3c93c47e/client/admin_login.coffee", "line_start": 1, "line_end": 31} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return houston_go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate.admin_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return houston_go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate.admin_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n houston_go 'home'\n\n if Meteor.users.findOne('profile.admin': true)", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/68a77fa17bc160ef6f2b40d3e7d32a2ddddb9ba3/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Router.go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0900a450e11e97cbcbd2f70ef0c78de433387bd4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0900a450e11e97cbcbd2f70ef0c78de433387bd4/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Router.go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Router.go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate.admin_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0900a450e11e97cbcbd2f70ef0c78de433387bd4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0900a450e11e97cbcbd2f70ef0c78de433387bd4/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var afterLogin, email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n afterLogin = function(error) {\n // TODO error case that properly displays\n if (error) {\n return alert(error);\n } else {\n return Router.go('home');\n }\n };\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password, afterLogin);\n } else {\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n }, afterLogin);\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate.admin_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Router.go 'home'\n\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0900a450e11e97cbcbd2f70ef0c78de433387bd4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0900a450e11e97cbcbd2f70ef0c78de433387bd4/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n\n afterLogin = (error) ->\n # TODO error case that properly displays\n if error\n alert error\n else\n Router.go 'home'\n\n if Meteor.users.findOne('profile.admin': true)", "response": "Meteor.loginWithPassword email, password, afterLogin\n else\n Accounts.createUser {\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n }, afterLogin\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0900a450e11e97cbcbd2f70ef0c78de433387bd4", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0900a450e11e97cbcbd2f70ef0c78de433387bd4/client/admin_login.coffee", "line_start": 1, "line_end": 38} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0191c5e36cb38096d9ebbc53ad07954c2dc1e77f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0191c5e36cb38096d9ebbc53ad07954c2dc1e77f/client/admin_login.coffee", "line_start": 1, "line_end": 30} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate.admin_login.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0191c5e36cb38096d9ebbc53ad07954c2dc1e77f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0191c5e36cb38096d9ebbc53ad07954c2dc1e77f/client/admin_login.coffee", "line_start": 1, "line_end": 30} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n\nTemplate.admin_login.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0191c5e36cb38096d9ebbc53ad07954c2dc1e77f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0191c5e36cb38096d9ebbc53ad07954c2dc1e77f/client/admin_login.coffee", "line_start": 1, "line_end": 30} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser", "response": "email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n\nTemplate.admin_login.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "0191c5e36cb38096d9ebbc53ad07954c2dc1e77f", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/0191c5e36cb38096d9ebbc53ad07954c2dc1e77f/client/admin_login.coffee", "line_start": 1, "line_end": 30} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "7f95ba77f04d2a969f02baad08b03fed9d4698ad", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7f95ba77f04d2a969f02baad08b03fed9d4698ad/client/admin_login.coffee", "line_start": 1, "line_end": 27} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)\n```", "response": "Template.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "7f95ba77f04d2a969f02baad08b03fed9d4698ad", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7f95ba77f04d2a969f02baad08b03fed9d4698ad/client/admin_login.coffee", "line_start": 1, "line_end": 27} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate.admin_login.helpers({\n logged_in: function() {\n return Meteor.user();\n },\n admin_user_exists: function() {\n return Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n },\n 'click .become-admin': function(e) {\n Meteor.call('make_admin', Meteor.userId());\n return e.preventDefault();\n }\n});\n```", "response": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "7f95ba77f04d2a969f02baad08b03fed9d4698ad", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7f95ba77f04d2a969f02baad08b03fed9d4698ad/client/admin_login.coffee", "line_start": 1, "line_end": 27} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template.admin_login.helpers(\n logged_in: -> Meteor.user()\n admin_user_exists: -> Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else", "response": "# TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n 'click .become-admin': (e) ->\n Meteor.call('make_admin', Meteor.userId())\n e.preventDefault()\n)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "7f95ba77f04d2a969f02baad08b03fed9d4698ad", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/7f95ba77f04d2a969f02baad08b03fed9d4698ad/client/admin_login.coffee", "line_start": 1, "line_end": 27} +{"id": "gterrono/houston:client/admin_login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template.admin_login.helpers(\n notLoggedIn: -> not Meteor.user()\n adminAccountNotExist: -> !Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "addd34774de8046c1acf403fb4af96b42a09c192", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/addd34774de8046c1acf403fb4af96b42a09c192/client/admin_login.coffee", "line_start": 1, "line_end": 24} +{"id": "gterrono/houston:client/admin_login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate.admin_login.helpers(\n notLoggedIn: -> not Meteor.user()\n adminAccountNotExist: -> !Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n)\n```", "response": "Template.admin_login.helpers({\n notLoggedIn: function() {\n return !Meteor.user();\n },\n adminAccountNotExist: function() {\n return !Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "addd34774de8046c1acf403fb4af96b42a09c192", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/addd34774de8046c1acf403fb4af96b42a09c192/client/admin_login.coffee", "line_start": 1, "line_end": 24} +{"id": "gterrono/houston:client/admin_login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate.admin_login.helpers({\n notLoggedIn: function() {\n return !Meteor.user();\n },\n adminAccountNotExist: function() {\n return !Meteor.users.findOne({\n 'profile.admin': true\n });\n }\n});\n\nTemplate.admin_login.events({\n 'submit #sign-in-form': function(e) {\n var email, password;\n e.preventDefault();\n email = $('input[name=\"email\"]').val();\n password = $('input[name=\"password\"]').val();\n if (Meteor.users.findOne({\n 'profile.admin': true\n })) {\n return Meteor.loginWithPassword(email, password);\n } else {\n // TODO: unbreak if this fails\n return Accounts.createUser({\n email: $('input[name=\"email\"]').val(),\n password: $('input[name=\"password\"]').val(),\n profile: {\n admin: true\n }\n });\n }\n },\n 'click .logout': function(e) {\n e.preventDefault();\n return Meteor.logout();\n }\n});\n```", "response": "Template.admin_login.helpers(\n notLoggedIn: -> not Meteor.user()\n adminAccountNotExist: -> !Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)\n else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "addd34774de8046c1acf403fb4af96b42a09c192", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/addd34774de8046c1acf403fb4af96b42a09c192/client/admin_login.coffee", "line_start": 1, "line_end": 24} +{"id": "gterrono/houston:client/admin_login.coffee:1:completion", "type": "completion", "prompt": "Template.admin_login.helpers(\n notLoggedIn: -> not Meteor.user()\n adminAccountNotExist: -> !Meteor.users.findOne 'profile.admin': true\n)\n\nTemplate.admin_login.events(\n 'submit #sign-in-form': (e) ->\n e.preventDefault()\n email = $('input[name=\"email\"]').val()\n password = $('input[name=\"password\"]').val()\n if Meteor.users.findOne('profile.admin': true)\n Meteor.loginWithPassword(email, password)", "response": "else\n # TODO: unbreak if this fails\n Accounts.createUser\n email: $('input[name=\"email\"]').val()\n password: $('input[name=\"password\"]').val()\n profile:\n admin: true\n\n 'click .logout': (e) ->\n e.preventDefault()\n Meteor.logout()\n)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_login.coffee", "license": "MIT", "commit": "addd34774de8046c1acf403fb4af96b42a09c192", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/addd34774de8046c1acf403fb4af96b42a09c192/client/admin_login.coffee", "line_start": 1, "line_end": 24} +{"id": "jianliaoim/talk-os:talk-web/client/updater/misc.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Immutable = require 'immutable'\n\nschema = require '../schema'\n\nteamRelatesFields = [\n 'archivedTopics', 'contactPrefs', 'contacts', 'favorites'\n 'intes', 'invitations', 'leftContacts', 'members', 'messages'\n 'tags', 'topicPrefs', 'topics', 'stories', 'notifications',\n 'groups'\n]\n\n# called on every network break and page close\nexports.outdateStore = (store) ->\n router = store.get 'router'\n _teamId = router.getIn ['data', '_teamId']\n _roomId = router.getIn ['data', '_roomId']\n _toId = router.getIn ['data', '_toId']\n _storyId = router.getIn ['data', '_storyId']\n\n # clear data from store step by step, newStore is mutable reference\n newStore = store\n .set 'notices', Immutable.Map()\n .set 'bannerNotices', Immutable.Map()\n .set 'inteSettings', Immutable.List()\n .set 'device', schema.device\n # suppose there is a current team, clear data of other teams\n if _teamId?\n newStore = teamRelatesFields.reduce (acc, field) ->\n if newStore.hasIn([field, _teamId])\n acc.set(field, Immutable.Map())\n .setIn [field, _teamId], newStore.getIn([field, _teamId])\n else\n acc.set(field, Immutable.Map())\n , newStore\n # suppose a channel is focused, clear data of other channels\n _channelId = _roomId or _toId or _storyId\n if _channelId?\n currentMessages = newStore.getIn ['messages', _teamId, _channelId]\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n .setIn ['messages', _teamId, _channelId], currentMessages\n # otherwise, all messages can be cleared\n else\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n # otherwise, all fields can be cleared\n else\n teamRelatesFields.forEach (field) ->\n newStore = newStore.set field, Immutable.Map()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/misc.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/misc.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/updater/misc.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nImmutable = require 'immutable'\n\nschema = require '../schema'\n\nteamRelatesFields = [\n 'archivedTopics', 'contactPrefs', 'contacts', 'favorites'\n 'intes', 'invitations', 'leftContacts', 'members', 'messages'\n 'tags', 'topicPrefs', 'topics', 'stories', 'notifications',\n 'groups'\n]\n\n# called on every network break and page close\nexports.outdateStore = (store) ->\n router = store.get 'router'\n _teamId = router.getIn ['data', '_teamId']\n _roomId = router.getIn ['data', '_roomId']\n _toId = router.getIn ['data', '_toId']\n _storyId = router.getIn ['data', '_storyId']\n\n # clear data from store step by step, newStore is mutable reference\n newStore = store\n .set 'notices', Immutable.Map()\n .set 'bannerNotices', Immutable.Map()\n .set 'inteSettings', Immutable.List()\n .set 'device', schema.device\n # suppose there is a current team, clear data of other teams\n if _teamId?\n newStore = teamRelatesFields.reduce (acc, field) ->\n if newStore.hasIn([field, _teamId])\n acc.set(field, Immutable.Map())\n .setIn [field, _teamId], newStore.getIn([field, _teamId])\n else\n acc.set(field, Immutable.Map())\n , newStore\n # suppose a channel is focused, clear data of other channels\n _channelId = _roomId or _toId or _storyId\n if _channelId?\n currentMessages = newStore.getIn ['messages', _teamId, _channelId]\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n .setIn ['messages', _teamId, _channelId], currentMessages\n # otherwise, all messages can be cleared\n else\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n # otherwise, all fields can be cleared\n else\n teamRelatesFields.forEach (field) ->\n newStore = newStore.set field, Immutable.Map()\n```", "response": "var Immutable, schema, teamRelatesFields;\n\nImmutable = require('immutable');\n\nschema = require('../schema');\n\nteamRelatesFields = ['archivedTopics', 'contactPrefs', 'contacts', 'favorites', 'intes', 'invitations', 'leftContacts', 'members', 'messages', 'tags', 'topicPrefs', 'topics', 'stories', 'notifications', 'groups'];\n\n// called on every network break and page close\nexports.outdateStore = function(store) {\n var _channelId, _roomId, _storyId, _teamId, _toId, currentMessages, newStore, router;\n router = store.get('router');\n _teamId = router.getIn(['data', '_teamId']);\n _roomId = router.getIn(['data', '_roomId']);\n _toId = router.getIn(['data', '_toId']);\n _storyId = router.getIn(['data', '_storyId']);\n // clear data from store step by step, newStore is mutable reference\n newStore = store.set('notices', Immutable.Map()).set('bannerNotices', Immutable.Map()).set('inteSettings', Immutable.List()).set('device', schema.device);\n // suppose there is a current team, clear data of other teams\n if (_teamId != null) {\n newStore = teamRelatesFields.reduce(function(acc, field) {\n if (newStore.hasIn([field, _teamId])) {\n return acc.set(field, Immutable.Map()).setIn([field, _teamId], newStore.getIn([field, _teamId]));\n } else {\n return acc.set(field, Immutable.Map());\n }\n }, newStore);\n // suppose a channel is focused, clear data of other channels\n _channelId = _roomId || _toId || _storyId;\n if (_channelId != null) {\n currentMessages = newStore.getIn(['messages', _teamId, _channelId]);\n return newStore = newStore.setIn(['messages', _teamId], Immutable.Map()).setIn(['messages', _teamId, _channelId], currentMessages);\n } else {\n // otherwise, all messages can be cleared\n return newStore = newStore.setIn(['messages', _teamId], Immutable.Map());\n }\n } else {\n // otherwise, all fields can be cleared\n return teamRelatesFields.forEach(function(field) {\n return newStore = newStore.set(field, Immutable.Map());\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/misc.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/misc.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/updater/misc.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Immutable, schema, teamRelatesFields;\n\nImmutable = require('immutable');\n\nschema = require('../schema');\n\nteamRelatesFields = ['archivedTopics', 'contactPrefs', 'contacts', 'favorites', 'intes', 'invitations', 'leftContacts', 'members', 'messages', 'tags', 'topicPrefs', 'topics', 'stories', 'notifications', 'groups'];\n\n// called on every network break and page close\nexports.outdateStore = function(store) {\n var _channelId, _roomId, _storyId, _teamId, _toId, currentMessages, newStore, router;\n router = store.get('router');\n _teamId = router.getIn(['data', '_teamId']);\n _roomId = router.getIn(['data', '_roomId']);\n _toId = router.getIn(['data', '_toId']);\n _storyId = router.getIn(['data', '_storyId']);\n // clear data from store step by step, newStore is mutable reference\n newStore = store.set('notices', Immutable.Map()).set('bannerNotices', Immutable.Map()).set('inteSettings', Immutable.List()).set('device', schema.device);\n // suppose there is a current team, clear data of other teams\n if (_teamId != null) {\n newStore = teamRelatesFields.reduce(function(acc, field) {\n if (newStore.hasIn([field, _teamId])) {\n return acc.set(field, Immutable.Map()).setIn([field, _teamId], newStore.getIn([field, _teamId]));\n } else {\n return acc.set(field, Immutable.Map());\n }\n }, newStore);\n // suppose a channel is focused, clear data of other channels\n _channelId = _roomId || _toId || _storyId;\n if (_channelId != null) {\n currentMessages = newStore.getIn(['messages', _teamId, _channelId]);\n return newStore = newStore.setIn(['messages', _teamId], Immutable.Map()).setIn(['messages', _teamId, _channelId], currentMessages);\n } else {\n // otherwise, all messages can be cleared\n return newStore = newStore.setIn(['messages', _teamId], Immutable.Map());\n }\n } else {\n // otherwise, all fields can be cleared\n return teamRelatesFields.forEach(function(field) {\n return newStore = newStore.set(field, Immutable.Map());\n });\n }\n};\n```", "response": "Immutable = require 'immutable'\n\nschema = require '../schema'\n\nteamRelatesFields = [\n 'archivedTopics', 'contactPrefs', 'contacts', 'favorites'\n 'intes', 'invitations', 'leftContacts', 'members', 'messages'\n 'tags', 'topicPrefs', 'topics', 'stories', 'notifications',\n 'groups'\n]\n\n# called on every network break and page close\nexports.outdateStore = (store) ->\n router = store.get 'router'\n _teamId = router.getIn ['data', '_teamId']\n _roomId = router.getIn ['data', '_roomId']\n _toId = router.getIn ['data', '_toId']\n _storyId = router.getIn ['data', '_storyId']\n\n # clear data from store step by step, newStore is mutable reference\n newStore = store\n .set 'notices', Immutable.Map()\n .set 'bannerNotices', Immutable.Map()\n .set 'inteSettings', Immutable.List()\n .set 'device', schema.device\n # suppose there is a current team, clear data of other teams\n if _teamId?\n newStore = teamRelatesFields.reduce (acc, field) ->\n if newStore.hasIn([field, _teamId])\n acc.set(field, Immutable.Map())\n .setIn [field, _teamId], newStore.getIn([field, _teamId])\n else\n acc.set(field, Immutable.Map())\n , newStore\n # suppose a channel is focused, clear data of other channels\n _channelId = _roomId or _toId or _storyId\n if _channelId?\n currentMessages = newStore.getIn ['messages', _teamId, _channelId]\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n .setIn ['messages', _teamId, _channelId], currentMessages\n # otherwise, all messages can be cleared\n else\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n # otherwise, all fields can be cleared\n else\n teamRelatesFields.forEach (field) ->\n newStore = newStore.set field, Immutable.Map()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/misc.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/misc.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/updater/misc.coffee:1:completion", "type": "completion", "prompt": "Immutable = require 'immutable'\n\nschema = require '../schema'\n\nteamRelatesFields = [\n 'archivedTopics', 'contactPrefs', 'contacts', 'favorites'\n 'intes', 'invitations', 'leftContacts', 'members', 'messages'\n 'tags', 'topicPrefs', 'topics', 'stories', 'notifications',\n 'groups'\n]\n\n# called on every network break and page close\nexports.outdateStore = (store) ->\n router = store.get 'router'\n _teamId = router.getIn ['data', '_teamId']\n _roomId = router.getIn ['data', '_roomId']\n _toId = router.getIn ['data', '_toId']\n _storyId = router.getIn ['data', '_storyId']\n\n # clear data from store step by step, newStore is mutable reference\n newStore = store\n .set 'notices', Immutable.Map()\n .set 'bannerNotices', Immutable.Map()\n .set 'inteSettings', Immutable.List()", "response": ".set 'device', schema.device\n # suppose there is a current team, clear data of other teams\n if _teamId?\n newStore = teamRelatesFields.reduce (acc, field) ->\n if newStore.hasIn([field, _teamId])\n acc.set(field, Immutable.Map())\n .setIn [field, _teamId], newStore.getIn([field, _teamId])\n else\n acc.set(field, Immutable.Map())\n , newStore\n # suppose a channel is focused, clear data of other channels\n _channelId = _roomId or _toId or _storyId\n if _channelId?\n currentMessages = newStore.getIn ['messages', _teamId, _channelId]\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n .setIn ['messages', _teamId, _channelId], currentMessages\n # otherwise, all messages can be cleared\n else\n newStore = newStore\n .setIn ['messages', _teamId], Immutable.Map()\n # otherwise, all fields can be cleared\n else\n teamRelatesFields.forEach (field) ->\n newStore = newStore.set field, Immutable.Map()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/misc.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/misc.coffee", "line_start": 1, "line_end": 50} +{"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "launch() if ignition is on\n\nvolume: 10 if band isnt spinal_tap\n\nlet_the_wild_rumpus_begin() unless answer is no\n\nif car.speed < speed_limit then accelerate()\n\nprint \"My name is \" + @name", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "line_start": 1, "line_end": 9} +{"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nlaunch() if ignition is on\n\nvolume: 10 if band isnt spinal_tap\n\nlet_the_wild_rumpus_begin() unless answer is no\n\nif car.speed < speed_limit then accelerate()\n\nprint \"My name is \" + @name\n```", "response": "if (ignition === true) {\n launch();\n}\n\nif (band !== spinal_tap) {\n ({\n volume: 10\n });\n}\n\nif (answer !== false) {\n let_the_wild_rumpus_begin();\n}\n\nif (car.speed < speed_limit) {\n accelerate();\n}\n\nprint(\"My name is \" + this.name);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "line_start": 1, "line_end": 9} +{"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (ignition === true) {\n launch();\n}\n\nif (band !== spinal_tap) {\n ({\n volume: 10\n });\n}\n\nif (answer !== false) {\n let_the_wild_rumpus_begin();\n}\n\nif (car.speed < speed_limit) {\n accelerate();\n}\n\nprint(\"My name is \" + this.name);\n```", "response": "launch() if ignition is on\n\nvolume: 10 if band isnt spinal_tap\n\nlet_the_wild_rumpus_begin() unless answer is no\n\nif car.speed < speed_limit then accelerate()\n\nprint \"My name is \" + @name", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "line_start": 1, "line_end": 9} +{"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee:1:completion", "type": "completion", "prompt": "launch() if ignition is on\n\nvolume: 10 if band isnt spinal_tap", "response": "let_the_wild_rumpus_begin() unless answer is no\n\nif car.speed < speed_limit then accelerate()\n\nprint \"My name is \" + @name", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/aliases.coffee", "line_start": 1, "line_end": 9} +{"id": "gss/engine:src/engine/domains/Linear.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Linear extends Domain\n displayName: 'Linear'\n\n priority: 0\n\n Engine: c\n\n construct: () ->\n @paths ?= {}\n @instance = new c.SimplexSolver()\n @instance.autoSolve = false\n #@instance._store = []\n if @console.level > 2\n c.debug = true\n c.trace = true\n\n perform: ->\n if @constrained\n @constrained = @suggested = undefined\n if @instance._needsSolving\n @instance.solve()\n return @instance._changed\n else if @suggested\n @suggested = undefined\n @instance.resolve()\n return @instance._changed\n\n unedit: (variable) ->\n if constraint = @editing?['%' + (variable.name || variable)]\n #@instance.removeConstraint(constraint)\n cei = @instance._editVarMap.get(constraint.variable)\n @instance.removeColumn(cei.editMinus)\n @instance._editVarMap.delete(constraint.variable)\n delete @editing[(variable.name || variable)]\n\n #@removeConstraint(constraint)\n\n edit: (variable, strength, weight, continuation) ->\n unless @editing?[variable.name]\n constraint = new c.EditConstraint(variable, @strength(strength, 'strong'), @weight(weight))\n constraint.variable = variable\n @Constraint::inject @, constraint\n (@editing ||= {})[variable.name] = constraint\n\n return constraint\n\n nullify: (variable, full) ->\n @instance._externalParametricVars.delete(variable)\n variable.value = 0\n #if full", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 9, "line_end": 58} +{"id": "gss/engine:src/engine/domains/Linear.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Linear extends Domain\n displayName: 'Linear'\n\n priority: 0\n\n Engine: c\n\n construct: () ->\n @paths ?= {}\n @instance = new c.SimplexSolver()\n @instance.autoSolve = false\n #@instance._store = []\n if @console.level > 2\n c.debug = true\n c.trace = true\n\n perform: ->\n if @constrained\n @constrained = @suggested = undefined\n if @instance._needsSolving\n @instance.solve()\n return @instance._changed\n else if @suggested\n @suggested = undefined\n @instance.resolve()\n return @instance._changed\n\n unedit: (variable) ->\n if constraint = @editing?['%' + (variable.name || variable)]\n #@instance.removeConstraint(constraint)\n cei = @instance._editVarMap.get(constraint.variable)\n @instance.removeColumn(cei.editMinus)\n @instance._editVarMap.delete(constraint.variable)\n delete @editing[(variable.name || variable)]\n\n #@removeConstraint(constraint)\n\n edit: (variable, strength, weight, continuation) ->\n unless @editing?[variable.name]\n constraint = new c.EditConstraint(variable, @strength(strength, 'strong'), @weight(weight))\n constraint.variable = variable\n @Constraint::inject @, constraint\n (@editing ||= {})[variable.name] = constraint\n\n return constraint\n\n nullify: (variable, full) ->\n @instance._externalParametricVars.delete(variable)\n variable.value = 0\n #if full\n```", "response": "var Linear;\n\nLinear = (function() {\n class Linear extends Domain {\n construct() {\n if (this.paths == null) {\n this.paths = {};\n }\n this.instance = new c.SimplexSolver();\n this.instance.autoSolve = false;\n //@instance._store = []\n if (this.console.level > 2) {\n c.debug = true;\n return c.trace = true;\n }\n }\n\n perform() {\n if (this.constrained) {\n this.constrained = this.suggested = void 0;\n if (this.instance._needsSolving) {\n this.instance.solve();\n return this.instance._changed;\n }\n } else if (this.suggested) {\n this.suggested = void 0;\n this.instance.resolve();\n return this.instance._changed;\n }\n }\n\n unedit(variable) {\n var cei, constraint, ref;\n if (constraint = (ref = this.editing) != null ? ref['%' + (variable.name || variable)] : void 0) {\n //@instance.removeConstraint(constraint)\n cei = this.instance._editVarMap.get(constraint.variable);\n this.instance.removeColumn(cei.editMinus);\n this.instance._editVarMap.delete(constraint.variable);\n return delete this.editing[variable.name || variable];\n }\n }\n\n //@removeConstraint(constraint)\n edit(variable, strength, weight, continuation) {\n var constraint, ref;\n if (!((ref = this.editing) != null ? ref[variable.name] : void 0)) {\n constraint = new c.EditConstraint(variable, this.strength(strength, 'strong'), this.weight(weight));\n constraint.variable = variable;\n this.Constraint.prototype.inject(this, constraint);\n (this.editing || (this.editing = {}))[variable.name] = constraint;\n }\n return constraint;\n }\n\n nullify(variable, full) {\n this.instance._externalParametricVars.delete(variable);\n return variable.value = 0;\n }\n\n };\n\n Linear.prototype.displayName = 'Linear';\n\n Linear.prototype.priority = 0;\n\n Linear.prototype.Engine = c;\n\n return Linear;\n\n}).call(this);\n\n//if full", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 9, "line_end": 58} +{"id": "gss/engine:src/engine/domains/Linear.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Linear;\n\nLinear = (function() {\n class Linear extends Domain {\n construct() {\n if (this.paths == null) {\n this.paths = {};\n }\n this.instance = new c.SimplexSolver();\n this.instance.autoSolve = false;\n //@instance._store = []\n if (this.console.level > 2) {\n c.debug = true;\n return c.trace = true;\n }\n }\n\n perform() {\n if (this.constrained) {\n this.constrained = this.suggested = void 0;\n if (this.instance._needsSolving) {\n this.instance.solve();\n return this.instance._changed;\n }\n } else if (this.suggested) {\n this.suggested = void 0;\n this.instance.resolve();\n return this.instance._changed;\n }\n }\n\n unedit(variable) {\n var cei, constraint, ref;\n if (constraint = (ref = this.editing) != null ? ref['%' + (variable.name || variable)] : void 0) {\n //@instance.removeConstraint(constraint)\n cei = this.instance._editVarMap.get(constraint.variable);\n this.instance.removeColumn(cei.editMinus);\n this.instance._editVarMap.delete(constraint.variable);\n return delete this.editing[variable.name || variable];\n }\n }\n\n //@removeConstraint(constraint)\n edit(variable, strength, weight, continuation) {\n var constraint, ref;\n if (!((ref = this.editing) != null ? ref[variable.name] : void 0)) {\n constraint = new c.EditConstraint(variable, this.strength(strength, 'strong'), this.weight(weight));\n constraint.variable = variable;\n this.Constraint.prototype.inject(this, constraint);\n (this.editing || (this.editing = {}))[variable.name] = constraint;\n }\n return constraint;\n }\n\n nullify(variable, full) {\n this.instance._externalParametricVars.delete(variable);\n return variable.value = 0;\n }\n\n };\n\n Linear.prototype.displayName = 'Linear';\n\n Linear.prototype.priority = 0;\n\n Linear.prototype.Engine = c;\n\n return Linear;\n\n}).call(this);\n\n//if full\n```", "response": "class Linear extends Domain\n displayName: 'Linear'\n\n priority: 0\n\n Engine: c\n\n construct: () ->\n @paths ?= {}\n @instance = new c.SimplexSolver()\n @instance.autoSolve = false\n #@instance._store = []\n if @console.level > 2\n c.debug = true\n c.trace = true\n\n perform: ->\n if @constrained\n @constrained = @suggested = undefined\n if @instance._needsSolving\n @instance.solve()\n return @instance._changed\n else if @suggested\n @suggested = undefined\n @instance.resolve()\n return @instance._changed\n\n unedit: (variable) ->\n if constraint = @editing?['%' + (variable.name || variable)]\n #@instance.removeConstraint(constraint)\n cei = @instance._editVarMap.get(constraint.variable)\n @instance.removeColumn(cei.editMinus)\n @instance._editVarMap.delete(constraint.variable)\n delete @editing[(variable.name || variable)]\n\n #@removeConstraint(constraint)\n\n edit: (variable, strength, weight, continuation) ->\n unless @editing?[variable.name]\n constraint = new c.EditConstraint(variable, @strength(strength, 'strong'), @weight(weight))\n constraint.variable = variable\n @Constraint::inject @, constraint\n (@editing ||= {})[variable.name] = constraint\n\n return constraint\n\n nullify: (variable, full) ->\n @instance._externalParametricVars.delete(variable)\n variable.value = 0\n #if full", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 9, "line_end": 58} +{"id": "gss/engine:src/engine/domains/Linear.coffee:1:completion", "type": "completion", "prompt": "class Linear extends Domain\n displayName: 'Linear'\n\n priority: 0\n\n Engine: c\n\n construct: () ->\n @paths ?= {}\n @instance = new c.SimplexSolver()\n @instance.autoSolve = false\n #@instance._store = []\n if @console.level > 2\n c.debug = true\n c.trace = true\n\n perform: ->\n if @constrained\n @constrained = @suggested = undefined\n if @instance._needsSolving\n @instance.solve()\n return @instance._changed\n else if @suggested\n @suggested = undefined\n @instance.resolve()", "response": "return @instance._changed\n\n unedit: (variable) ->\n if constraint = @editing?['%' + (variable.name || variable)]\n #@instance.removeConstraint(constraint)\n cei = @instance._editVarMap.get(constraint.variable)\n @instance.removeColumn(cei.editMinus)\n @instance._editVarMap.delete(constraint.variable)\n delete @editing[(variable.name || variable)]\n\n #@removeConstraint(constraint)\n\n edit: (variable, strength, weight, continuation) ->\n unless @editing?[variable.name]\n constraint = new c.EditConstraint(variable, @strength(strength, 'strong'), @weight(weight))\n constraint.variable = variable\n @Constraint::inject @, constraint\n (@editing ||= {})[variable.name] = constraint\n\n return constraint\n\n nullify: (variable, full) ->\n @instance._externalParametricVars.delete(variable)\n variable.value = 0\n #if full", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 9, "line_end": 58} +{"id": "gss/engine:src/engine/domains/Linear.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#@instance.rows.delete(variable)\n\n suggest: (path, value, strength, weight, continuation) ->\n if typeof path == 'string'\n unless variable = @variables[path]\n variable = @Variable::declare(@, path)\n else\n variable = path\n\n @edit(variable, strength, weight, continuation)\n @instance.suggestValue(variable, value)\n variable.value = value\n @suggested = true\n return variable\n\n variable: (name) ->\n return new c.Variable name: name\n\n strength: (strength, byDefault = 'medium') ->\n return strength && c.Strength[strength] || c.Strength[byDefault]\n\n weight: (weight, operation) ->\n #if index = operation?.parent[0].index\n # return index / 1000\n return weight\n\n# Capture values coming from other domains", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 59, "line_end": 85} +{"id": "gss/engine:src/engine/domains/Linear.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#@instance.rows.delete(variable)\n\n suggest: (path, value, strength, weight, continuation) ->\n if typeof path == 'string'\n unless variable = @variables[path]\n variable = @Variable::declare(@, path)\n else\n variable = path\n\n @edit(variable, strength, weight, continuation)\n @instance.suggestValue(variable, value)\n variable.value = value\n @suggested = true\n return variable\n\n variable: (name) ->\n return new c.Variable name: name\n\n strength: (strength, byDefault = 'medium') ->\n return strength && c.Strength[strength] || c.Strength[byDefault]\n\n weight: (weight, operation) ->\n #if index = operation?.parent[0].index\n # return index / 1000\n return weight\n\n# Capture values coming from other domains\n```", "response": "//@instance.rows.delete(variable)\n({\n suggest: function(path, value, strength, weight, continuation) {\n var variable;\n if (typeof path === 'string') {\n if (!(variable = this.variables[path])) {\n variable = this.Variable.prototype.declare(this, path);\n }\n } else {\n variable = path;\n }\n this.edit(variable, strength, weight, continuation);\n this.instance.suggestValue(variable, value);\n variable.value = value;\n this.suggested = true;\n return variable;\n },\n variable: function(name) {\n return new c.Variable({\n name: name\n });\n },\n strength: function(strength, byDefault = 'medium') {\n return strength && c.Strength[strength] || c.Strength[byDefault];\n },\n weight: function(weight, operation) {\n //if index = operation?.parent[0].index\n // return index / 1000\n return weight;\n }\n});\n\n// Capture values coming from other domains", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 59, "line_end": 85} +{"id": "gss/engine:src/engine/domains/Linear.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n//@instance.rows.delete(variable)\n({\n suggest: function(path, value, strength, weight, continuation) {\n var variable;\n if (typeof path === 'string') {\n if (!(variable = this.variables[path])) {\n variable = this.Variable.prototype.declare(this, path);\n }\n } else {\n variable = path;\n }\n this.edit(variable, strength, weight, continuation);\n this.instance.suggestValue(variable, value);\n variable.value = value;\n this.suggested = true;\n return variable;\n },\n variable: function(name) {\n return new c.Variable({\n name: name\n });\n },\n strength: function(strength, byDefault = 'medium') {\n return strength && c.Strength[strength] || c.Strength[byDefault];\n },\n weight: function(weight, operation) {\n //if index = operation?.parent[0].index\n // return index / 1000\n return weight;\n }\n});\n\n// Capture values coming from other domains\n```", "response": "#@instance.rows.delete(variable)\n\n suggest: (path, value, strength, weight, continuation) ->\n if typeof path == 'string'\n unless variable = @variables[path]\n variable = @Variable::declare(@, path)\n else\n variable = path\n\n @edit(variable, strength, weight, continuation)\n @instance.suggestValue(variable, value)\n variable.value = value\n @suggested = true\n return variable\n\n variable: (name) ->\n return new c.Variable name: name\n\n strength: (strength, byDefault = 'medium') ->\n return strength && c.Strength[strength] || c.Strength[byDefault]\n\n weight: (weight, operation) ->\n #if index = operation?.parent[0].index\n # return index / 1000\n return weight\n\n# Capture values coming from other domains", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 59, "line_end": 85} +{"id": "gss/engine:src/engine/domains/Linear.coffee:2:completion", "type": "completion", "prompt": "#@instance.rows.delete(variable)\n\n suggest: (path, value, strength, weight, continuation) ->\n if typeof path == 'string'\n unless variable = @variables[path]\n variable = @Variable::declare(@, path)\n else\n variable = path\n\n @edit(variable, strength, weight, continuation)\n @instance.suggestValue(variable, value)\n variable.value = value\n @suggested = true", "response": "return variable\n\n variable: (name) ->\n return new c.Variable name: name\n\n strength: (strength, byDefault = 'medium') ->\n return strength && c.Strength[strength] || c.Strength[byDefault]\n\n weight: (weight, operation) ->\n #if index = operation?.parent[0].index\n # return index / 1000\n return weight\n\n# Capture values coming from other domains", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 59, "line_end": 85} +{"id": "gss/engine:src/engine/domains/Linear.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Linear.Mixin =\n yield: (result, engine, operation, continuation, scope, ascender) ->\n if typeof result == 'number'\n return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')\n\n\nLinear::Constraint = Constraint.extend {\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n return @get(engine, operation, ascending)\n\n after: (args, result, engine, operation, continuation, scope, ascender, ascending) ->\n if result.hashCode\n return ((engine.operations ||= {})[operation.hash ||= @toExpression(operation)] ||= {})[@toHash(ascending)] ||= result\n return result\n\n # Get cached operation by expression and set of input variables\n get: (engine, operation, scope) ->\n return engine.operations?[operation.hash ||= @toExpression(operation)]?[@toHash(scope)]\n\n yield: Linear.Mixin.yield\n\n inject: (engine, constraint) ->\n engine.instance.addConstraint(constraint)\n\n eject: (engine, constraint) ->\n engine.instance.removeConstraint(constraint)\n\n},\n '==': (left, right, strength, weight, engine, operation) ->\n return new c.Equation(left, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '>=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n '>': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n\nLinear::Variable = Variable.extend Linear.Mixin,\n get: (path, engine, operation) ->\n variable = @declare(engine, path)\n engine.unedit(variable)\n return variable", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 86, "line_end": 135} +{"id": "gss/engine:src/engine/domains/Linear.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nLinear.Mixin =\n yield: (result, engine, operation, continuation, scope, ascender) ->\n if typeof result == 'number'\n return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')\n\n\nLinear::Constraint = Constraint.extend {\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n return @get(engine, operation, ascending)\n\n after: (args, result, engine, operation, continuation, scope, ascender, ascending) ->\n if result.hashCode\n return ((engine.operations ||= {})[operation.hash ||= @toExpression(operation)] ||= {})[@toHash(ascending)] ||= result\n return result\n\n # Get cached operation by expression and set of input variables\n get: (engine, operation, scope) ->\n return engine.operations?[operation.hash ||= @toExpression(operation)]?[@toHash(scope)]\n\n yield: Linear.Mixin.yield\n\n inject: (engine, constraint) ->\n engine.instance.addConstraint(constraint)\n\n eject: (engine, constraint) ->\n engine.instance.removeConstraint(constraint)\n\n},\n '==': (left, right, strength, weight, engine, operation) ->\n return new c.Equation(left, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '>=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n '>': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n\nLinear::Variable = Variable.extend Linear.Mixin,\n get: (path, engine, operation) ->\n variable = @declare(engine, path)\n engine.unedit(variable)\n return variable\n```", "response": "Linear.Mixin = {\n yield: function(result, engine, operation, continuation, scope, ascender) {\n if (typeof result === 'number') {\n return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require');\n }\n }\n};\n\nLinear.prototype.Constraint = Constraint.extend({\n before: function(args, engine, operation, continuation, scope, ascender, ascending) {\n return this.get(engine, operation, ascending);\n },\n after: function(args, result, engine, operation, continuation, scope, ascender, ascending) {\n var base, base1, name, name1;\n if (result.hashCode) {\n return (base = ((base1 = (engine.operations || (engine.operations = {})))[name1 = operation.hash || (operation.hash = this.toExpression(operation))] || (base1[name1] = {})))[name = this.toHash(ascending)] || (base[name] = result);\n }\n return result;\n },\n // Get cached operation by expression and set of input variables\n get: function(engine, operation, scope) {\n var ref, ref1;\n return (ref = engine.operations) != null ? (ref1 = ref[operation.hash || (operation.hash = this.toExpression(operation))]) != null ? ref1[this.toHash(scope)] : void 0 : void 0;\n },\n yield: Linear.Mixin.yield,\n inject: function(engine, constraint) {\n return engine.instance.addConstraint(constraint);\n },\n eject: function(engine, constraint) {\n return engine.instance.removeConstraint(constraint);\n }\n}, {\n '==': function(left, right, strength, weight, engine, operation) {\n return new c.Equation(left, right, engine.strength(strength), engine.weight(weight, operation));\n },\n '<=': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.LEQ, right, engine.strength(strength), engine.weight(weight, operation));\n },\n '>=': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.GEQ, right, engine.strength(strength), engine.weight(weight, operation));\n },\n '<': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.LEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation));\n },\n '>': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.GEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation));\n }\n});\n\nLinear.prototype.Variable = Variable.extend(Linear.Mixin, {\n get: function(path, engine, operation) {\n var variable;\n variable = this.declare(engine, path);\n engine.unedit(variable);\n return variable;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 86, "line_end": 135} +{"id": "gss/engine:src/engine/domains/Linear.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nLinear.Mixin = {\n yield: function(result, engine, operation, continuation, scope, ascender) {\n if (typeof result === 'number') {\n return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require');\n }\n }\n};\n\nLinear.prototype.Constraint = Constraint.extend({\n before: function(args, engine, operation, continuation, scope, ascender, ascending) {\n return this.get(engine, operation, ascending);\n },\n after: function(args, result, engine, operation, continuation, scope, ascender, ascending) {\n var base, base1, name, name1;\n if (result.hashCode) {\n return (base = ((base1 = (engine.operations || (engine.operations = {})))[name1 = operation.hash || (operation.hash = this.toExpression(operation))] || (base1[name1] = {})))[name = this.toHash(ascending)] || (base[name] = result);\n }\n return result;\n },\n // Get cached operation by expression and set of input variables\n get: function(engine, operation, scope) {\n var ref, ref1;\n return (ref = engine.operations) != null ? (ref1 = ref[operation.hash || (operation.hash = this.toExpression(operation))]) != null ? ref1[this.toHash(scope)] : void 0 : void 0;\n },\n yield: Linear.Mixin.yield,\n inject: function(engine, constraint) {\n return engine.instance.addConstraint(constraint);\n },\n eject: function(engine, constraint) {\n return engine.instance.removeConstraint(constraint);\n }\n}, {\n '==': function(left, right, strength, weight, engine, operation) {\n return new c.Equation(left, right, engine.strength(strength), engine.weight(weight, operation));\n },\n '<=': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.LEQ, right, engine.strength(strength), engine.weight(weight, operation));\n },\n '>=': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.GEQ, right, engine.strength(strength), engine.weight(weight, operation));\n },\n '<': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.LEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation));\n },\n '>': function(left, right, strength, weight, engine, operation) {\n return new c.Inequality(left, c.GEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation));\n }\n});\n\nLinear.prototype.Variable = Variable.extend(Linear.Mixin, {\n get: function(path, engine, operation) {\n var variable;\n variable = this.declare(engine, path);\n engine.unedit(variable);\n return variable;\n }\n});\n```", "response": "Linear.Mixin =\n yield: (result, engine, operation, continuation, scope, ascender) ->\n if typeof result == 'number'\n return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')\n\n\nLinear::Constraint = Constraint.extend {\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n return @get(engine, operation, ascending)\n\n after: (args, result, engine, operation, continuation, scope, ascender, ascending) ->\n if result.hashCode\n return ((engine.operations ||= {})[operation.hash ||= @toExpression(operation)] ||= {})[@toHash(ascending)] ||= result\n return result\n\n # Get cached operation by expression and set of input variables\n get: (engine, operation, scope) ->\n return engine.operations?[operation.hash ||= @toExpression(operation)]?[@toHash(scope)]\n\n yield: Linear.Mixin.yield\n\n inject: (engine, constraint) ->\n engine.instance.addConstraint(constraint)\n\n eject: (engine, constraint) ->\n engine.instance.removeConstraint(constraint)\n\n},\n '==': (left, right, strength, weight, engine, operation) ->\n return new c.Equation(left, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '>=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n '>': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n\nLinear::Variable = Variable.extend Linear.Mixin,\n get: (path, engine, operation) ->\n variable = @declare(engine, path)\n engine.unedit(variable)\n return variable", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 86, "line_end": 135} +{"id": "gss/engine:src/engine/domains/Linear.coffee:3:completion", "type": "completion", "prompt": "Linear.Mixin =\n yield: (result, engine, operation, continuation, scope, ascender) ->\n if typeof result == 'number'\n return operation.parent.domain.suggest('%' + operation.command.toExpression(operation), result, 'require')\n\n\nLinear::Constraint = Constraint.extend {\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n return @get(engine, operation, ascending)\n\n after: (args, result, engine, operation, continuation, scope, ascender, ascending) ->\n if result.hashCode\n return ((engine.operations ||= {})[operation.hash ||= @toExpression(operation)] ||= {})[@toHash(ascending)] ||= result\n return result\n\n # Get cached operation by expression and set of input variables\n get: (engine, operation, scope) ->\n return engine.operations?[operation.hash ||= @toExpression(operation)]?[@toHash(scope)]\n\n yield: Linear.Mixin.yield\n\n inject: (engine, constraint) ->\n engine.instance.addConstraint(constraint)", "response": "eject: (engine, constraint) ->\n engine.instance.removeConstraint(constraint)\n\n},\n '==': (left, right, strength, weight, engine, operation) ->\n return new c.Equation(left, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '>=': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, right, engine.strength(strength), engine.weight(weight, operation))\n\n '<': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.LEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n '>': (left, right, strength, weight, engine, operation) ->\n return new c.Inequality(left, c.GEQ, engine['+'](right, 1), engine.strength(strength), engine.weight(weight, operation))\n\n\nLinear::Variable = Variable.extend Linear.Mixin,\n get: (path, engine, operation) ->\n variable = @declare(engine, path)\n engine.unedit(variable)\n return variable", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 86, "line_end": 135} +{"id": "gss/engine:src/engine/domains/Linear.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Linear::Variable.Expression = Variable.Expression.extend Linear.Mixin,\n\n '+': (left, right) ->\n return c.plus(left, right)\n\n '-': (left, right) ->\n return c.minus(left, right)\n\n '*': (left, right) ->\n return c.times(left, right)\n\n '/': (left, right) ->\n return c.divide(left, right)\n\n# Handle constraints wrapped into meta constructs provided by Input\nLinear::Meta = Command.Meta.extend {},\n 'object':\n execute: (constraint, engine, operation) ->\n if constraint?.hashCode?\n operation[1].command.add(constraint, engine, operation[1], operation[0].key)\n\n descend: (engine, operation) ->\n\n if meta = operation[0]\n continuation = meta.key\n scope = meta.scope && engine.identity[meta.scope] || engine.scope\n\n operation[1].parent = operation\n [\n operation[1].command.solve(engine, operation[1], continuation, scope, undefined, operation[0])\n engine,\n operation\n ]\n\nLinear::Stay = Command.extend {\n signature: [\n value: ['Variable']\n ]\n},\n stay: (value, engine, operation) ->\n engine.suggested = true\n engine.instance.addStay(value)\n return\n\nLinear::Remove = Command.extend {\n extras: 1\n\n signature: false\n},", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 136, "line_end": 185} +{"id": "gss/engine:src/engine/domains/Linear.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nLinear::Variable.Expression = Variable.Expression.extend Linear.Mixin,\n\n '+': (left, right) ->\n return c.plus(left, right)\n\n '-': (left, right) ->\n return c.minus(left, right)\n\n '*': (left, right) ->\n return c.times(left, right)\n\n '/': (left, right) ->\n return c.divide(left, right)\n\n# Handle constraints wrapped into meta constructs provided by Input\nLinear::Meta = Command.Meta.extend {},\n 'object':\n execute: (constraint, engine, operation) ->\n if constraint?.hashCode?\n operation[1].command.add(constraint, engine, operation[1], operation[0].key)\n\n descend: (engine, operation) ->\n\n if meta = operation[0]\n continuation = meta.key\n scope = meta.scope && engine.identity[meta.scope] || engine.scope\n\n operation[1].parent = operation\n [\n operation[1].command.solve(engine, operation[1], continuation, scope, undefined, operation[0])\n engine,\n operation\n ]\n\nLinear::Stay = Command.extend {\n signature: [\n value: ['Variable']\n ]\n},\n stay: (value, engine, operation) ->\n engine.suggested = true\n engine.instance.addStay(value)\n return\n\nLinear::Remove = Command.extend {\n extras: 1\n\n signature: false\n},\n```", "response": "Linear.prototype.Variable.Expression = Variable.Expression.extend(Linear.Mixin, {\n '+': function(left, right) {\n return c.plus(left, right);\n },\n '-': function(left, right) {\n return c.minus(left, right);\n },\n '*': function(left, right) {\n return c.times(left, right);\n },\n '/': function(left, right) {\n return c.divide(left, right);\n }\n});\n\n// Handle constraints wrapped into meta constructs provided by Input\nLinear.prototype.Meta = Command.Meta.extend({}, {\n 'object': {\n execute: function(constraint, engine, operation) {\n if ((constraint != null ? constraint.hashCode : void 0) != null) {\n return operation[1].command.add(constraint, engine, operation[1], operation[0].key);\n }\n },\n descend: function(engine, operation) {\n var continuation, meta, scope;\n if (meta = operation[0]) {\n continuation = meta.key;\n scope = meta.scope && engine.identity[meta.scope] || engine.scope;\n }\n operation[1].parent = operation;\n return [operation[1].command.solve(engine, operation[1], continuation, scope, void 0, operation[0]), engine, operation];\n }\n }\n});\n\nLinear.prototype.Stay = Command.extend({\n signature: [\n {\n value: ['Variable']\n }\n ]\n}, {\n stay: function(value, engine, operation) {\n engine.suggested = true;\n engine.instance.addStay(value);\n }\n});\n\nLinear.prototype.Remove = Command.extend({\n extras: 1,\n signature: false\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 136, "line_end": 185} +{"id": "gss/engine:src/engine/domains/Linear.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nLinear.prototype.Variable.Expression = Variable.Expression.extend(Linear.Mixin, {\n '+': function(left, right) {\n return c.plus(left, right);\n },\n '-': function(left, right) {\n return c.minus(left, right);\n },\n '*': function(left, right) {\n return c.times(left, right);\n },\n '/': function(left, right) {\n return c.divide(left, right);\n }\n});\n\n// Handle constraints wrapped into meta constructs provided by Input\nLinear.prototype.Meta = Command.Meta.extend({}, {\n 'object': {\n execute: function(constraint, engine, operation) {\n if ((constraint != null ? constraint.hashCode : void 0) != null) {\n return operation[1].command.add(constraint, engine, operation[1], operation[0].key);\n }\n },\n descend: function(engine, operation) {\n var continuation, meta, scope;\n if (meta = operation[0]) {\n continuation = meta.key;\n scope = meta.scope && engine.identity[meta.scope] || engine.scope;\n }\n operation[1].parent = operation;\n return [operation[1].command.solve(engine, operation[1], continuation, scope, void 0, operation[0]), engine, operation];\n }\n }\n});\n\nLinear.prototype.Stay = Command.extend({\n signature: [\n {\n value: ['Variable']\n }\n ]\n}, {\n stay: function(value, engine, operation) {\n engine.suggested = true;\n engine.instance.addStay(value);\n }\n});\n\nLinear.prototype.Remove = Command.extend({\n extras: 1,\n signature: false\n});\n```", "response": "Linear::Variable.Expression = Variable.Expression.extend Linear.Mixin,\n\n '+': (left, right) ->\n return c.plus(left, right)\n\n '-': (left, right) ->\n return c.minus(left, right)\n\n '*': (left, right) ->\n return c.times(left, right)\n\n '/': (left, right) ->\n return c.divide(left, right)\n\n# Handle constraints wrapped into meta constructs provided by Input\nLinear::Meta = Command.Meta.extend {},\n 'object':\n execute: (constraint, engine, operation) ->\n if constraint?.hashCode?\n operation[1].command.add(constraint, engine, operation[1], operation[0].key)\n\n descend: (engine, operation) ->\n\n if meta = operation[0]\n continuation = meta.key\n scope = meta.scope && engine.identity[meta.scope] || engine.scope\n\n operation[1].parent = operation\n [\n operation[1].command.solve(engine, operation[1], continuation, scope, undefined, operation[0])\n engine,\n operation\n ]\n\nLinear::Stay = Command.extend {\n signature: [\n value: ['Variable']\n ]\n},\n stay: (value, engine, operation) ->\n engine.suggested = true\n engine.instance.addStay(value)\n return\n\nLinear::Remove = Command.extend {\n extras: 1\n\n signature: false\n},", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 136, "line_end": 185} +{"id": "gss/engine:src/engine/domains/Linear.coffee:4:completion", "type": "completion", "prompt": "Linear::Variable.Expression = Variable.Expression.extend Linear.Mixin,\n\n '+': (left, right) ->\n return c.plus(left, right)\n\n '-': (left, right) ->\n return c.minus(left, right)\n\n '*': (left, right) ->\n return c.times(left, right)\n\n '/': (left, right) ->\n return c.divide(left, right)\n\n# Handle constraints wrapped into meta constructs provided by Input\nLinear::Meta = Command.Meta.extend {},\n 'object':\n execute: (constraint, engine, operation) ->\n if constraint?.hashCode?\n operation[1].command.add(constraint, engine, operation[1], operation[0].key)\n\n descend: (engine, operation) ->\n\n if meta = operation[0]", "response": "continuation = meta.key\n scope = meta.scope && engine.identity[meta.scope] || engine.scope\n\n operation[1].parent = operation\n [\n operation[1].command.solve(engine, operation[1], continuation, scope, undefined, operation[0])\n engine,\n operation\n ]\n\nLinear::Stay = Command.extend {\n signature: [\n value: ['Variable']\n ]\n},\n stay: (value, engine, operation) ->\n engine.suggested = true\n engine.instance.addStay(value)\n return\n\nLinear::Remove = Command.extend {\n extras: 1\n\n signature: false\n},", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 136, "line_end": 185} +{"id": "gss/engine:src/engine/domains/Linear.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "remove: (args ..., engine) ->\n engine.remove.apply(engine, args)\n\n\n\n\n# Phantom js doesnt enforce order of numerical keys in plain objects.\n# The hack enforces arrays as base structure.\ndo ->\n unless c.isUnordered?\n obj = {'10': 1, '9': 1}\n for property of obj\n break\n if c.isUnordered = (property > 9)\n set = c.HashTable.prototype.set\n c.HashTable.prototype.set = ->\n if !@_store.push\n store = @_store\n @_store = []\n for property of store\n @_store[property] = store[property]\n\n return set.apply(@, arguments)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 186, "line_end": 209} +{"id": "gss/engine:src/engine/domains/Linear.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nremove: (args ..., engine) ->\n engine.remove.apply(engine, args)\n\n\n\n\n# Phantom js doesnt enforce order of numerical keys in plain objects.\n# The hack enforces arrays as base structure.\ndo ->\n unless c.isUnordered?\n obj = {'10': 1, '9': 1}\n for property of obj\n break\n if c.isUnordered = (property > 9)\n set = c.HashTable.prototype.set\n c.HashTable.prototype.set = ->\n if !@_store.push\n store = @_store\n @_store = []\n for property of store\n @_store[property] = store[property]\n\n return set.apply(@, arguments)\n```", "response": "var splice = [].splice;\n\n({\n remove: function(...args) {\n var engine, ref;\n ref = args, [...args] = ref, [engine] = splice.call(args, -1);\n return engine.remove.apply(engine, args);\n }\n});\n\n(function() { // Phantom js doesnt enforce order of numerical keys in plain objects.\n // The hack enforces arrays as base structure.\n var obj, property, set;\n if (c.isUnordered == null) {\n obj = {\n '10': 1,\n '9': 1\n };\n for (property in obj) {\n break;\n }\n if (c.isUnordered = property > 9) {\n set = c.HashTable.prototype.set;\n return c.HashTable.prototype.set = function() {\n var store;\n if (!this._store.push) {\n store = this._store;\n this._store = [];\n for (property in store) {\n this._store[property] = store[property];\n }\n }\n return set.apply(this, arguments);\n };\n }\n }\n})();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 186, "line_end": 209} +{"id": "gss/engine:src/engine/domains/Linear.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar splice = [].splice;\n\n({\n remove: function(...args) {\n var engine, ref;\n ref = args, [...args] = ref, [engine] = splice.call(args, -1);\n return engine.remove.apply(engine, args);\n }\n});\n\n(function() { // Phantom js doesnt enforce order of numerical keys in plain objects.\n // The hack enforces arrays as base structure.\n var obj, property, set;\n if (c.isUnordered == null) {\n obj = {\n '10': 1,\n '9': 1\n };\n for (property in obj) {\n break;\n }\n if (c.isUnordered = property > 9) {\n set = c.HashTable.prototype.set;\n return c.HashTable.prototype.set = function() {\n var store;\n if (!this._store.push) {\n store = this._store;\n this._store = [];\n for (property in store) {\n this._store[property] = store[property];\n }\n }\n return set.apply(this, arguments);\n };\n }\n }\n})();\n```", "response": "remove: (args ..., engine) ->\n engine.remove.apply(engine, args)\n\n\n\n\n# Phantom js doesnt enforce order of numerical keys in plain objects.\n# The hack enforces arrays as base structure.\ndo ->\n unless c.isUnordered?\n obj = {'10': 1, '9': 1}\n for property of obj\n break\n if c.isUnordered = (property > 9)\n set = c.HashTable.prototype.set\n c.HashTable.prototype.set = ->\n if !@_store.push\n store = @_store\n @_store = []\n for property of store\n @_store[property] = store[property]\n\n return set.apply(@, arguments)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 186, "line_end": 209} +{"id": "gss/engine:src/engine/domains/Linear.coffee:5:completion", "type": "completion", "prompt": "remove: (args ..., engine) ->\n engine.remove.apply(engine, args)\n\n\n\n\n# Phantom js doesnt enforce order of numerical keys in plain objects.\n# The hack enforces arrays as base structure.\ndo ->\n unless c.isUnordered?\n obj = {'10': 1, '9': 1}", "response": "for property of obj\n break\n if c.isUnordered = (property > 9)\n set = c.HashTable.prototype.set\n c.HashTable.prototype.set = ->\n if !@_store.push\n store = @_store\n @_store = []\n for property of store\n @_store[property] = store[property]\n\n return set.apply(@, arguments)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/domains/Linear.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Linear.coffee", "line_start": 186, "line_end": 209} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2018 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'));\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.debounce(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 120, {\n leading: false,\n maxWait: 500\n }));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2018 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'));\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.debounce(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 120, {\n leading: false,\n maxWait: 500\n }));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->", "response": "$title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "31207fc23b89c9a0e232c38d9cf4c24f9e247f4b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/31207fc23b89c9a0e232c38d9cf4c24f9e247f4b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'));\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.debounce(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 120, {\n leading: false,\n maxWait: 500\n }));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "31207fc23b89c9a0e232c38d9cf4c24f9e247f4b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/31207fc23b89c9a0e232c38d9cf4c24f9e247f4b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'));\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.debounce(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 120, {\n leading: false,\n maxWait: 500\n }));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "31207fc23b89c9a0e232c38d9cf4c24f9e247f4b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/31207fc23b89c9a0e232c38d9cf4c24f9e247f4b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->", "response": "$title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n widgetBodyHeight -= parseInt($widgetBody.css('marginTop')) + parseInt($widgetBody.css('marginBottom'))\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "31207fc23b89c9a0e232c38d9cf4c24f9e247f4b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/31207fc23b89c9a0e232c38d9cf4c24f9e247f4b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.debounce(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 120, {\n leading: false,\n maxWait: 500\n }));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.debounce(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 120, {\n leading: false,\n maxWait: 500\n }));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()", "response": "sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.debounce(->\n scope.$apply ->\n sizer()\n , 120, { leading: false, maxWait: 500 })\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "08680403c1ab72b7789517426293681c2224eada", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/08680403c1ab72b7789517426293681c2224eada/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.widgetLayout != null) {\n return scope.widgetLayout.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()", "response": "sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.widgetLayout?\n scope.widgetLayout.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.layout?\n scope.layout.widget.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "d6074320b57a8763c1fbff5ef45de0f9bc4e6752", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/d6074320b57a8763c1fbff5ef45de0f9bc4e6752/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.layout?\n scope.layout.widget.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.layout != null) {\n return scope.layout.widget.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "d6074320b57a8763c1fbff5ef45de0f9bc4e6752", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/d6074320b57a8763c1fbff5ef45de0f9bc4e6752/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n $widgetBody.height(Math.floor(widgetBodyHeight));\n if (scope.layout != null) {\n return scope.layout.widget.widgetBodyHeight = widgetBodyHeight;\n }\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.layout?\n scope.layout.widget.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "d6074320b57a8763c1fbff5ef45de0f9bc4e6752", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/d6074320b57a8763c1fbff5ef45de0f9bc4e6752/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()", "response": "sizer = ->\n $title = $widget.find '.title'\n $footer = $widget.find '.widget-footer'\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height Math.floor(widgetBodyHeight)\n\n if scope.layout?\n scope.layout.widget.widgetBodyHeight = widgetBodyHeight\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout sizer, 100\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off 'resize'\n\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "d6074320b57a8763c1fbff5ef45de0f9bc4e6752", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/d6074320b57a8763c1fbff5ef45de0f9bc4e6752/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 49} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "fafb2c2e28728d8df0d094190af98831523a6e0b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/fafb2c2e28728d8df0d094190af98831523a6e0b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n return $widgetBody.height(Math.floor(widgetBodyHeight));\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "fafb2c2e28728d8df0d094190af98831523a6e0b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/fafb2c2e28728d8df0d094190af98831523a6e0b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight();\n return $widgetBody.height(Math.floor(widgetBodyHeight));\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "fafb2c2e28728d8df0d094190af98831523a6e0b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/fafb2c2e28728d8df0d094190af98831523a6e0b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()", "response": "sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "fafb2c2e28728d8df0d094190af98831523a6e0b", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/fafb2c2e28728d8df0d094190af98831523a6e0b/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.height() - $title.height() - $footer.height()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.height() - $title.height() - $footer.height()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }\n```", "response": "/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.height() - $title.height() - $footer.height();\n return $widgetBody.height(Math.floor(widgetBodyHeight));\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2015 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\ncyclotronDirectives.directive('widgetBody', function($timeout) {\n return {\n restrict: 'C',\n link: function(scope, element, attrs) {\n var $widget, $widgetBody, sizer, timer;\n $widgetBody = $(element);\n $widget = $widgetBody.parent();\n sizer = function() {\n var $footer, $title, widgetBodyHeight;\n $title = $widget.find('.title');\n $footer = $widget.find('.widget-footer');\n widgetBodyHeight = $widget.height() - $title.height() - $footer.height();\n return $widgetBody.height(Math.floor(widgetBodyHeight));\n };\n // Update on window resizing\n $widget.add('.title, .widget-footer').on('resize', _.throttle(function() {\n return scope.$apply(function() {\n return sizer();\n });\n }, 65));\n // Run now & again in 100ms\n sizer();\n timer = $timeout(sizer, 100);\n scope.$on('$destroy', function() {\n $timeout.cancel(timer);\n return $widget.off('resize');\n });\n }\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()\n\n sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.height() - $title.height() - $footer.height()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'widgetBody', ($timeout) ->\n {\n restrict: 'C'\n\n link: (scope, element, attrs) ->\n $widgetBody = $(element)\n $widget = $widgetBody.parent()", "response": "sizer = ->\n $title = $widget.find('.title')\n $footer = $widget.find('.widget-footer')\n widgetBodyHeight = $widget.height() - $title.height() - $footer.height()\n $widgetBody.height(Math.floor(widgetBodyHeight))\n\n # Update on window resizing\n $widget.add('.title, .widget-footer').on 'resize', _.throttle(->\n scope.$apply ->\n sizer()\n , 65)\n\n # Run now & again in 100ms\n sizer()\n timer = $timeout(sizer, 100)\n\n scope.$on '$destroy', ->\n $timeout.cancel timer\n $widget.off('resize')\n\n return\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/dashboards/directives/directives.widgetBody.coffee", "line_start": 1, "line_end": 46} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n\n if typeof(input) is 'function'\n return output\n\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '-' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "efe8ce18704ae43383e4177aa7de1a2619bd4e67", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/efe8ce18704ae43383e4177aa7de1a2619bd4e67/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:completion", "type": "completion", "prompt": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n\n if typeof(input) is 'function'", "response": "return output\n\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '-' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "efe8ce18704ae43383e4177aa7de1a2619bd4e67", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/efe8ce18704ae43383e4177aa7de1a2619bd4e67/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n return output\n\n\nmodule.exports = Dumper", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "efe8ce18704ae43383e4177aa7de1a2619bd4e67", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/efe8ce18704ae43383e4177aa7de1a2619bd4e67/src/Dumper.coffee", "line_start": 51, "line_end": 59} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:2:completion", "type": "completion", "prompt": "Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "response": "return output\n\n\nmodule.exports = Dumper", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "efe8ce18704ae43383e4177aa7de1a2619bd4e67", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/efe8ce18704ae43383e4177aa7de1a2619bd4e67/src/Dumper.coffee", "line_start": 51, "line_end": 59} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n\n if typeof(input) is 'function'\n return output\n\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '- ' +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "a9309b40ac8831aa95845b61ca5ceec6a3d806bf", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/a9309b40ac8831aa95845b61ca5ceec6a3d806bf/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:completion", "type": "completion", "prompt": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n\n if typeof(input) is 'function'", "response": "return output\n\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '- ' +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "a9309b40ac8831aa95845b61ca5ceec6a3d806bf", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/a9309b40ac8831aa95845b61ca5ceec6a3d806bf/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "(if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n return output\n\n\nmodule.exports = Dumper", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "a9309b40ac8831aa95845b61ca5ceec6a3d806bf", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/a9309b40ac8831aa95845b61ca5ceec6a3d806bf/src/Dumper.coffee", "line_start": 51, "line_end": 58} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:2:completion", "type": "completion", "prompt": "(if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "response": "return output\n\n\nmodule.exports = Dumper", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "a9309b40ac8831aa95845b61ca5ceec6a3d806bf", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/a9309b40ac8831aa95845b61ca5ceec6a3d806bf/src/Dumper.coffee", "line_start": 51, "line_end": 58} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '- ' +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "3cbcddc35b3b0392db5b2b2962849177a7a3b254", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/3cbcddc35b3b0392db5b2b2962849177a7a3b254/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nUtils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '- ' +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n```", "response": "var Dumper, Inline, Utils;\n\nUtils = require('./Utils');\n\nInline = require('./Inline');\n\nDumper = (function() {\n // Dumper dumps JavaScript variables to YAML strings.\n\n class Dumper {\n // Dumps a JavaScript value to YAML.\n\n // @param [Object] input The JavaScript value\n // @param [Integer] inline The level where you switch to inline YAML\n // @param [Integer] indent The level of indentation (used internally)\n // @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n // @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n\n // @return [String] The YAML representation of the JavaScript value\n\n dump(input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) {\n var i, key, len, output, prefix, results, results1, value, willBeInlined;\n output = '';\n prefix = (indent ? Utils.strRepeat(' ', indent) : '');\n if (inline <= 0 || typeof input !== 'object' || input instanceof Date || Utils.isEmpty(input)) {\n return output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder);\n } else {\n if (input instanceof Array) {\n results = [];\n for (i = 0, len = input.length; i < len; i++) {\n value = input[i];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results.push(output += prefix + '- ' + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results;\n } else {\n results1 = [];\n for (key in input) {\n value = input[key];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results1.push(output += prefix + Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results1;\n }\n }\n }\n\n };\n\n // The amount of spaces to use for indentation of nested nodes.\n Dumper.indentation = 4;\n\n return Dumper;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "3cbcddc35b3b0392db5b2b2962849177a7a3b254", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/3cbcddc35b3b0392db5b2b2962849177a7a3b254/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dumper, Inline, Utils;\n\nUtils = require('./Utils');\n\nInline = require('./Inline');\n\nDumper = (function() {\n // Dumper dumps JavaScript variables to YAML strings.\n\n class Dumper {\n // Dumps a JavaScript value to YAML.\n\n // @param [Object] input The JavaScript value\n // @param [Integer] inline The level where you switch to inline YAML\n // @param [Integer] indent The level of indentation (used internally)\n // @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n // @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n\n // @return [String] The YAML representation of the JavaScript value\n\n dump(input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) {\n var i, key, len, output, prefix, results, results1, value, willBeInlined;\n output = '';\n prefix = (indent ? Utils.strRepeat(' ', indent) : '');\n if (inline <= 0 || typeof input !== 'object' || input instanceof Date || Utils.isEmpty(input)) {\n return output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder);\n } else {\n if (input instanceof Array) {\n results = [];\n for (i = 0, len = input.length; i < len; i++) {\n value = input[i];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results.push(output += prefix + '- ' + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results;\n } else {\n results1 = [];\n for (key in input) {\n value = input[key];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results1.push(output += prefix + Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results1;\n }\n }\n }\n\n };\n\n // The amount of spaces to use for indentation of nested nodes.\n Dumper.indentation = 4;\n\n return Dumper;\n\n}).call(this);\n```", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '- ' +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "3cbcddc35b3b0392db5b2b2962849177a7a3b254", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/3cbcddc35b3b0392db5b2b2962849177a7a3b254/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:completion", "type": "completion", "prompt": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')", "response": "if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '- ' +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "3cbcddc35b3b0392db5b2b2962849177a7a3b254", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/3cbcddc35b3b0392db5b2b2962849177a7a3b254/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '-' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "e3efe9d4ee17efad2583bdb82cb26527b749c67b", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/e3efe9d4ee17efad2583bdb82cb26527b749c67b/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nUtils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '-' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n```", "response": "var Dumper, Inline, Utils;\n\nUtils = require('./Utils');\n\nInline = require('./Inline');\n\nDumper = (function() {\n // Dumper dumps JavaScript variables to YAML strings.\n\n class Dumper {\n // Dumps a JavaScript value to YAML.\n\n // @param [Object] input The JavaScript value\n // @param [Integer] inline The level where you switch to inline YAML\n // @param [Integer] indent The level of indentation (used internally)\n // @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n // @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n\n // @return [String] The YAML representation of the JavaScript value\n\n dump(input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) {\n var i, key, len, output, prefix, results, results1, value, willBeInlined;\n output = '';\n prefix = (indent ? Utils.strRepeat(' ', indent) : '');\n if (inline <= 0 || typeof input !== 'object' || input instanceof Date || Utils.isEmpty(input)) {\n return output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder);\n } else {\n if (input instanceof Array) {\n results = [];\n for (i = 0, len = input.length; i < len; i++) {\n value = input[i];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results.push(output += prefix + '-' + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results;\n } else {\n results1 = [];\n for (key in input) {\n value = input[key];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results1.push(output += prefix + Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results1;\n }\n }\n }\n\n };\n\n // The amount of spaces to use for indentation of nested nodes.\n Dumper.indentation = 4;\n\n return Dumper;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "e3efe9d4ee17efad2583bdb82cb26527b749c67b", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/e3efe9d4ee17efad2583bdb82cb26527b749c67b/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dumper, Inline, Utils;\n\nUtils = require('./Utils');\n\nInline = require('./Inline');\n\nDumper = (function() {\n // Dumper dumps JavaScript variables to YAML strings.\n\n class Dumper {\n // Dumps a JavaScript value to YAML.\n\n // @param [Object] input The JavaScript value\n // @param [Integer] inline The level where you switch to inline YAML\n // @param [Integer] indent The level of indentation (used internally)\n // @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n // @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n\n // @return [String] The YAML representation of the JavaScript value\n\n dump(input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) {\n var i, key, len, output, prefix, results, results1, value, willBeInlined;\n output = '';\n prefix = (indent ? Utils.strRepeat(' ', indent) : '');\n if (inline <= 0 || typeof input !== 'object' || input instanceof Date || Utils.isEmpty(input)) {\n return output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder);\n } else {\n if (input instanceof Array) {\n results = [];\n for (i = 0, len = input.length; i < len; i++) {\n value = input[i];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results.push(output += prefix + '-' + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results;\n } else {\n results1 = [];\n for (key in input) {\n value = input[key];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n results1.push(output += prefix + Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : ''));\n }\n return results1;\n }\n }\n }\n\n };\n\n // The amount of spaces to use for indentation of nested nodes.\n Dumper.indentation = 4;\n\n return Dumper;\n\n}).call(this);\n```", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '-' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "e3efe9d4ee17efad2583bdb82cb26527b749c67b", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/e3efe9d4ee17efad2583bdb82cb26527b749c67b/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:completion", "type": "completion", "prompt": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')", "response": "if inline <= 0 or typeof(input) isnt 'object' or input instanceof Date or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n if input instanceof Array\n for value in input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n '-' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n else\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "e3efe9d4ee17efad2583bdb82cb26527b749c67b", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/e3efe9d4ee17efad2583bdb82cb26527b749c67b/src/Dumper.coffee", "line_start": 1, "line_end": 50} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n isAHash = not(input instanceof Array)\n\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n (if isAHash then Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' else '-') +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n return output\n\n\nmodule.exports = Dumper", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "c6cbcf0326723c5f0013490d1fea489694790775", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/c6cbcf0326723c5f0013490d1fea489694790775/src/Dumper.coffee", "line_start": 1, "line_end": 45} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nUtils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n isAHash = not(input instanceof Array)\n\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n (if isAHash then Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' else '-') +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n return output\n\n\nmodule.exports = Dumper\n```", "response": "var Dumper, Inline, Utils;\n\nUtils = require('./Utils');\n\nInline = require('./Inline');\n\nDumper = (function() {\n // Dumper dumps JavaScript variables to YAML strings.\n\n class Dumper {\n // Dumps a JavaScript value to YAML.\n\n // @param [Object] input The JavaScript value\n // @param [Integer] inline The level where you switch to inline YAML\n // @param [Integer] indent The level of indentation (used internally)\n // @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n // @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n\n // @return [String] The YAML representation of the JavaScript value\n\n dump(input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) {\n var isAHash, key, output, prefix, value, willBeInlined;\n output = '';\n prefix = (indent ? Utils.strRepeat(' ', indent) : '');\n if (inline <= 0 || typeof input !== 'object' || Utils.isEmpty(input)) {\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder);\n } else {\n isAHash = !(input instanceof Array);\n for (key in input) {\n value = input[key];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n output += prefix + (isAHash ? Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' : '-') + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : '');\n }\n }\n return output;\n }\n\n };\n\n // The amount of spaces to use for indentation of nested nodes.\n Dumper.indentation = 4;\n\n return Dumper;\n\n}).call(this);\n\nmodule.exports = Dumper;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "c6cbcf0326723c5f0013490d1fea489694790775", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/c6cbcf0326723c5f0013490d1fea489694790775/src/Dumper.coffee", "line_start": 1, "line_end": 45} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dumper, Inline, Utils;\n\nUtils = require('./Utils');\n\nInline = require('./Inline');\n\nDumper = (function() {\n // Dumper dumps JavaScript variables to YAML strings.\n\n class Dumper {\n // Dumps a JavaScript value to YAML.\n\n // @param [Object] input The JavaScript value\n // @param [Integer] inline The level where you switch to inline YAML\n // @param [Integer] indent The level of indentation (used internally)\n // @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n // @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n\n // @return [String] The YAML representation of the JavaScript value\n\n dump(input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) {\n var isAHash, key, output, prefix, value, willBeInlined;\n output = '';\n prefix = (indent ? Utils.strRepeat(' ', indent) : '');\n if (inline <= 0 || typeof input !== 'object' || Utils.isEmpty(input)) {\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder);\n } else {\n isAHash = !(input instanceof Array);\n for (key in input) {\n value = input[key];\n willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);\n output += prefix + (isAHash ? Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' : '-') + (willBeInlined ? ' ' : \"\\n\") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? \"\\n\" : '');\n }\n }\n return output;\n }\n\n };\n\n // The amount of spaces to use for indentation of nested nodes.\n Dumper.indentation = 4;\n\n return Dumper;\n\n}).call(this);\n\nmodule.exports = Dumper;\n```", "response": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->\n output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n isAHash = not(input instanceof Array)\n\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n (if isAHash then Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' else '-') +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n return output\n\n\nmodule.exports = Dumper", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "c6cbcf0326723c5f0013490d1fea489694790775", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/c6cbcf0326723c5f0013490d1fea489694790775/src/Dumper.coffee", "line_start": 1, "line_end": 45} +{"id": "jeremyfa/yaml.js:src/Dumper.coffee:1:completion", "type": "completion", "prompt": "Utils = require './Utils'\nInline = require './Inline'\n\n# Dumper dumps JavaScript variables to YAML strings.\n#\nclass Dumper\n\n # The amount of spaces to use for indentation of nested nodes.\n @indentation: 4\n\n\n # Dumps a JavaScript value to YAML.\n #\n # @param [Object] input The JavaScript value\n # @param [Integer] inline The level where you switch to inline YAML\n # @param [Integer] indent The level of indentation (used internally)\n # @param [Boolean] exceptionOnInvalidType true if an exception must be thrown on invalid types (a JavaScript resource or object), false otherwise\n # @param [Function] objectEncoder A function to serialize custom objects, null otherwise\n #\n # @return [String] The YAML representation of the JavaScript value\n #\n dump: (input, inline = 0, indent = 0, exceptionOnInvalidType = false, objectEncoder = null) ->", "response": "output = ''\n prefix = (if indent then Utils.strRepeat(' ', indent) else '')\n\n if inline <= 0 or typeof(input) isnt 'object' or Utils.isEmpty(input)\n output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder)\n\n else\n isAHash = not(input instanceof Array)\n\n for key, value of input\n willBeInlined = (inline - 1 <= 0 or typeof(value) isnt 'object' or Utils.isEmpty(value))\n\n output +=\n prefix +\n (if isAHash then Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' else '-') +\n (if willBeInlined then ' ' else \"\\n\") +\n @dump(value, inline - 1, (if willBeInlined then 0 else indent + @indentation), exceptionOnInvalidType, objectEncoder) +\n (if willBeInlined then \"\\n\" else '')\n\n return output\n\n\nmodule.exports = Dumper", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyfa/yaml.js", "path": "src/Dumper.coffee", "license": "MIT", "commit": "c6cbcf0326723c5f0013490d1fea489694790775", "stars": 887, "source_url": "https://github.com/jeremyfa/yaml.js/blob/c6cbcf0326723c5f0013490d1fea489694790775/src/Dumper.coffee", "line_start": 1, "line_end": 45} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/html.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "xss = require 'xss'\n\nmodule.exports = util =\n stripHtml: (html) ->\n return html unless html and toString.call(html) is '[object String]'\n xss html,\n whiteList: []\n stripIgnoreTag: true\n stripIgnoreTagBody: ['script', 'style']\n ###*\n * Only keep the html between body tags\n * @param {String} html content\n * @return {String} content between bodys\n ###\n extractBodyContent: (html = '') ->\n matches = html.match /]*>((.|[\\n\\r])*)<\\/body>/im\n return matches?[1] or html", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/html.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/html.coffee", "line_start": 1, "line_end": 17} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/html.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nxss = require 'xss'\n\nmodule.exports = util =\n stripHtml: (html) ->\n return html unless html and toString.call(html) is '[object String]'\n xss html,\n whiteList: []\n stripIgnoreTag: true\n stripIgnoreTagBody: ['script', 'style']\n ###*\n * Only keep the html between body tags\n * @param {String} html content\n * @return {String} content between bodys\n ###\n extractBodyContent: (html = '') ->\n matches = html.match /]*>((.|[\\n\\r])*)<\\/body>/im\n return matches?[1] or html\n```", "response": "var util, xss;\n\nxss = require('xss');\n\nmodule.exports = util = {\n stripHtml: function(html) {\n if (!(html && toString.call(html) === '[object String]')) {\n return html;\n }\n return xss(html, {\n whiteList: [],\n stripIgnoreTag: true,\n stripIgnoreTagBody: ['script', 'style']\n });\n },\n /**\n * Only keep the html between body tags\n * @param {String} html content\n * @return {String} content between bodys\n */\n extractBodyContent: function(html = '') {\n var matches;\n matches = html.match(/]*>((.|[\\n\\r])*)<\\/body>/im);\n return (matches != null ? matches[1] : void 0) || html;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/html.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/html.coffee", "line_start": 1, "line_end": 17} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/html.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar util, xss;\n\nxss = require('xss');\n\nmodule.exports = util = {\n stripHtml: function(html) {\n if (!(html && toString.call(html) === '[object String]')) {\n return html;\n }\n return xss(html, {\n whiteList: [],\n stripIgnoreTag: true,\n stripIgnoreTagBody: ['script', 'style']\n });\n },\n /**\n * Only keep the html between body tags\n * @param {String} html content\n * @return {String} content between bodys\n */\n extractBodyContent: function(html = '') {\n var matches;\n matches = html.match(/]*>((.|[\\n\\r])*)<\\/body>/im);\n return (matches != null ? matches[1] : void 0) || html;\n }\n};\n```", "response": "xss = require 'xss'\n\nmodule.exports = util =\n stripHtml: (html) ->\n return html unless html and toString.call(html) is '[object String]'\n xss html,\n whiteList: []\n stripIgnoreTag: true\n stripIgnoreTagBody: ['script', 'style']\n ###*\n * Only keep the html between body tags\n * @param {String} html content\n * @return {String} content between bodys\n ###\n extractBodyContent: (html = '') ->\n matches = html.match /]*>((.|[\\n\\r])*)<\\/body>/im\n return matches?[1] or html", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/html.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/html.coffee", "line_start": 1, "line_end": 17} +{"id": "jianliaoim/talk-os:talk-api2x/server/util/html.coffee:1:completion", "type": "completion", "prompt": "xss = require 'xss'\n\nmodule.exports = util =\n stripHtml: (html) ->\n return html unless html and toString.call(html) is '[object String]'\n xss html,\n whiteList: []\n stripIgnoreTag: true", "response": "stripIgnoreTagBody: ['script', 'style']\n ###*\n * Only keep the html between body tags\n * @param {String} html content\n * @return {String} content between bodys\n ###\n extractBodyContent: (html = '') ->\n matches = html.match /]*>((.|[\\n\\r])*)<\\/body>/im\n return matches?[1] or html", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/util/html.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/util/html.coffee", "line_start": 1, "line_end": 17} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'form-link'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n willSubmit: T.bool\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n\n getDefaultProps: ->\n onChange: (->)\n onSubmit: (->)\n readOnly: false\n willSubmit: false\n\n getInitialState: ->\n data: @props.data or Immutable.Map protoData\n isDiscovered: @props.data?\n isDiscovering: false\n\n componentDidMount: ->\n @_onDiscover = debounce @onDiscover, 1000\n\n if @props.displayMode is 'edit'\n @setState\n isDiscovered: true\n\n componentWillReceiveProps: (nextProps) ->\n if not @props.willSubmit and nextProps.willSubmit\n @props.onSubmit @state.data\n\n if not nextProps.data?\n @setState\n data: Immutable.Map protoData\n isDiscovered: false\n\n if @props.displayMode is 'edit'\n if not @props.readOnly and nextProps.readOnly\n @setState\n data: @props.data or Immutable.Map protoData\n\n componentWillUnmount: ->\n @_onDiscover = null\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n handelTitleChange: (event) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'form-link'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n willSubmit: T.bool\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n\n getDefaultProps: ->\n onChange: (->)\n onSubmit: (->)\n readOnly: false\n willSubmit: false\n\n getInitialState: ->\n data: @props.data or Immutable.Map protoData\n isDiscovered: @props.data?\n isDiscovering: false\n\n componentDidMount: ->\n @_onDiscover = debounce @onDiscover, 1000\n\n if @props.displayMode is 'edit'\n @setState\n isDiscovered: true\n\n componentWillReceiveProps: (nextProps) ->\n if not @props.willSubmit and nextProps.willSubmit\n @props.onSubmit @state.data\n\n if not nextProps.data?\n @setState\n data: Immutable.Map protoData\n isDiscovered: false\n\n if @props.displayMode is 'edit'\n if not @props.readOnly and nextProps.readOnly\n @setState\n data: @props.data or Immutable.Map protoData\n\n componentWillUnmount: ->\n @_onDiscover = null\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n handelTitleChange: (event) ->\n```", "response": "module.exports = React.createClass({\n displayName: 'form-link',\n propTypes: {\n data: T.instanceOf(Immutable.Map),\n onChange: T.func,\n onSubmit: T.func,\n readOnly: T.bool,\n willSubmit: T.bool,\n displayMode: T.oneOf(['create', 'edit']).isRequired\n },\n getDefaultProps: function() {\n return {\n onChange: (function() {}),\n onSubmit: (function() {}),\n readOnly: false,\n willSubmit: false\n };\n },\n getInitialState: function() {\n return {\n data: this.props.data || Immutable.Map(protoData),\n isDiscovered: this.props.data != null,\n isDiscovering: false\n };\n },\n componentDidMount: function() {\n this._onDiscover = debounce(this.onDiscover, 1000);\n if (this.props.displayMode === 'edit') {\n return this.setState({\n isDiscovered: true\n });\n }\n },\n componentWillReceiveProps: function(nextProps) {\n if (!this.props.willSubmit && nextProps.willSubmit) {\n this.props.onSubmit(this.state.data);\n }\n if (nextProps.data == null) {\n this.setState({\n data: Immutable.Map(protoData),\n isDiscovered: false\n });\n }\n if (this.props.displayMode === 'edit') {\n if (!this.props.readOnly && nextProps.readOnly) {\n return this.setState({\n data: this.props.data || Immutable.Map(protoData)\n });\n }\n }\n },\n componentWillUnmount: function() {\n return this._onDiscover = null;\n },\n handleTextChange: function(event) {\n return this.willChange('text', event.target.value);\n },\n handelTitleChange: function(event) {}\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'form-link',\n propTypes: {\n data: T.instanceOf(Immutable.Map),\n onChange: T.func,\n onSubmit: T.func,\n readOnly: T.bool,\n willSubmit: T.bool,\n displayMode: T.oneOf(['create', 'edit']).isRequired\n },\n getDefaultProps: function() {\n return {\n onChange: (function() {}),\n onSubmit: (function() {}),\n readOnly: false,\n willSubmit: false\n };\n },\n getInitialState: function() {\n return {\n data: this.props.data || Immutable.Map(protoData),\n isDiscovered: this.props.data != null,\n isDiscovering: false\n };\n },\n componentDidMount: function() {\n this._onDiscover = debounce(this.onDiscover, 1000);\n if (this.props.displayMode === 'edit') {\n return this.setState({\n isDiscovered: true\n });\n }\n },\n componentWillReceiveProps: function(nextProps) {\n if (!this.props.willSubmit && nextProps.willSubmit) {\n this.props.onSubmit(this.state.data);\n }\n if (nextProps.data == null) {\n this.setState({\n data: Immutable.Map(protoData),\n isDiscovered: false\n });\n }\n if (this.props.displayMode === 'edit') {\n if (!this.props.readOnly && nextProps.readOnly) {\n return this.setState({\n data: this.props.data || Immutable.Map(protoData)\n });\n }\n }\n },\n componentWillUnmount: function() {\n return this._onDiscover = null;\n },\n handleTextChange: function(event) {\n return this.willChange('text', event.target.value);\n },\n handelTitleChange: function(event) {}\n});\n```", "response": "module.exports = React.createClass\n displayName: 'form-link'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n willSubmit: T.bool\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n\n getDefaultProps: ->\n onChange: (->)\n onSubmit: (->)\n readOnly: false\n willSubmit: false\n\n getInitialState: ->\n data: @props.data or Immutable.Map protoData\n isDiscovered: @props.data?\n isDiscovering: false\n\n componentDidMount: ->\n @_onDiscover = debounce @onDiscover, 1000\n\n if @props.displayMode is 'edit'\n @setState\n isDiscovered: true\n\n componentWillReceiveProps: (nextProps) ->\n if not @props.willSubmit and nextProps.willSubmit\n @props.onSubmit @state.data\n\n if not nextProps.data?\n @setState\n data: Immutable.Map protoData\n isDiscovered: false\n\n if @props.displayMode is 'edit'\n if not @props.readOnly and nextProps.readOnly\n @setState\n data: @props.data or Immutable.Map protoData\n\n componentWillUnmount: ->\n @_onDiscover = null\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n handelTitleChange: (event) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'form-link'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n willSubmit: T.bool\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n\n getDefaultProps: ->\n onChange: (->)\n onSubmit: (->)\n readOnly: false\n willSubmit: false\n\n getInitialState: ->\n data: @props.data or Immutable.Map protoData\n isDiscovered: @props.data?\n isDiscovering: false\n\n componentDidMount: ->\n @_onDiscover = debounce @onDiscover, 1000", "response": "if @props.displayMode is 'edit'\n @setState\n isDiscovered: true\n\n componentWillReceiveProps: (nextProps) ->\n if not @props.willSubmit and nextProps.willSubmit\n @props.onSubmit @state.data\n\n if not nextProps.data?\n @setState\n data: Immutable.Map protoData\n isDiscovered: false\n\n if @props.displayMode is 'edit'\n if not @props.readOnly and nextProps.readOnly\n @setState\n data: @props.data or Immutable.Map protoData\n\n componentWillUnmount: ->\n @_onDiscover = null\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n handelTitleChange: (event) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@willChange 'title', event.target.value\n\n handelURLChange: (event) ->\n @willChange 'url', event.target.value\n if @props.displayMode is 'create'\n @_onDiscover event.target.value.trim()\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n if @state.isDiscovered\n @props.onChange newState.data\n\n onDiscover: (url) ->\n if not @isMounted()\n return\n\n if not (url.trim().length and util.isUrl url)\n return\n\n setState = (data) =>\n newState = assign {},\n data: Immutable.Map(data) if data?\n isDiscovered: true\n isDiscovering: false\n\n @setState newState\n if data?\n @props.onChange newState.data\n\n @setState\n isDiscovering: true\n , ->\n discoverActions\n .urlmeta url\n , (resp) ->\n resp.url = url\n setState resp\n , (error) ->\n setState()\n notifyActions.error lang.getText('read-link-failure')\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n render: ->\n form className: cx('form-table', 'is-dashed': not @state.isDiscovered), onSubmit: @onFormSubmit,", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 76, "line_end": 125} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@willChange 'title', event.target.value\n\n handelURLChange: (event) ->\n @willChange 'url', event.target.value\n if @props.displayMode is 'create'\n @_onDiscover event.target.value.trim()\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n if @state.isDiscovered\n @props.onChange newState.data\n\n onDiscover: (url) ->\n if not @isMounted()\n return\n\n if not (url.trim().length and util.isUrl url)\n return\n\n setState = (data) =>\n newState = assign {},\n data: Immutable.Map(data) if data?\n isDiscovered: true\n isDiscovering: false\n\n @setState newState\n if data?\n @props.onChange newState.data\n\n @setState\n isDiscovering: true\n , ->\n discoverActions\n .urlmeta url\n , (resp) ->\n resp.url = url\n setState resp\n , (error) ->\n setState()\n notifyActions.error lang.getText('read-link-failure')\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n render: ->\n form className: cx('form-table', 'is-dashed': not @state.isDiscovered), onSubmit: @onFormSubmit,\n```", "response": "this.willChange('title', event.target.value({\n handelURLChange: function(event) {\n this.willChange('url', event.target.value);\n if (this.props.displayMode === 'create') {\n return this._onDiscover(event.target.value.trim());\n }\n },\n willChange: function(key, value) {\n var newState;\n newState = {\n data: this.state.data.set(key, value)\n };\n this.setState(newState);\n if (this.state.isDiscovered) {\n return this.props.onChange(newState.data);\n }\n },\n onDiscover: function(url) {\n var setState;\n if (!this.isMounted()) {\n return;\n }\n if (!(url.trim().length && util.isUrl(url))) {\n return;\n }\n setState = (data) => {\n var newState;\n newState = assign({}, {\n data: data != null ? Immutable.Map(data) : void 0,\n isDiscovered: true,\n isDiscovering: false\n });\n this.setState(newState);\n if (data != null) {\n return this.props.onChange(newState.data);\n }\n };\n return this.setState({\n isDiscovering: true\n }, function() {\n return discoverActions.urlmeta(url, function(resp) {\n resp.url = url;\n return setState(resp);\n }, function(error) {\n setState();\n return notifyActions.error(lang.getText('read-link-failure'));\n });\n });\n },\n onFormSubmit: function(event) {\n event.preventDefault();\n return this.props.onSubmit(this.state.data);\n },\n render: function() {\n return form({\n className: cx('form-table', {\n 'is-dashed': !this.state.isDiscovered\n }),\n onSubmit: this.onFormSubmit\n });\n }\n}));", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 76, "line_end": 125} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis.willChange('title', event.target.value({\n handelURLChange: function(event) {\n this.willChange('url', event.target.value);\n if (this.props.displayMode === 'create') {\n return this._onDiscover(event.target.value.trim());\n }\n },\n willChange: function(key, value) {\n var newState;\n newState = {\n data: this.state.data.set(key, value)\n };\n this.setState(newState);\n if (this.state.isDiscovered) {\n return this.props.onChange(newState.data);\n }\n },\n onDiscover: function(url) {\n var setState;\n if (!this.isMounted()) {\n return;\n }\n if (!(url.trim().length && util.isUrl(url))) {\n return;\n }\n setState = (data) => {\n var newState;\n newState = assign({}, {\n data: data != null ? Immutable.Map(data) : void 0,\n isDiscovered: true,\n isDiscovering: false\n });\n this.setState(newState);\n if (data != null) {\n return this.props.onChange(newState.data);\n }\n };\n return this.setState({\n isDiscovering: true\n }, function() {\n return discoverActions.urlmeta(url, function(resp) {\n resp.url = url;\n return setState(resp);\n }, function(error) {\n setState();\n return notifyActions.error(lang.getText('read-link-failure'));\n });\n });\n },\n onFormSubmit: function(event) {\n event.preventDefault();\n return this.props.onSubmit(this.state.data);\n },\n render: function() {\n return form({\n className: cx('form-table', {\n 'is-dashed': !this.state.isDiscovered\n }),\n onSubmit: this.onFormSubmit\n });\n }\n}));\n```", "response": "@willChange 'title', event.target.value\n\n handelURLChange: (event) ->\n @willChange 'url', event.target.value\n if @props.displayMode is 'create'\n @_onDiscover event.target.value.trim()\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n if @state.isDiscovered\n @props.onChange newState.data\n\n onDiscover: (url) ->\n if not @isMounted()\n return\n\n if not (url.trim().length and util.isUrl url)\n return\n\n setState = (data) =>\n newState = assign {},\n data: Immutable.Map(data) if data?\n isDiscovered: true\n isDiscovering: false\n\n @setState newState\n if data?\n @props.onChange newState.data\n\n @setState\n isDiscovering: true\n , ->\n discoverActions\n .urlmeta url\n , (resp) ->\n resp.url = url\n setState resp\n , (error) ->\n setState()\n notifyActions.error lang.getText('read-link-failure')\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n render: ->\n form className: cx('form-table', 'is-dashed': not @state.isDiscovered), onSubmit: @onFormSubmit,", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 76, "line_end": 125} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:2:completion", "type": "completion", "prompt": "@willChange 'title', event.target.value\n\n handelURLChange: (event) ->\n @willChange 'url', event.target.value\n if @props.displayMode is 'create'\n @_onDiscover event.target.value.trim()\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n if @state.isDiscovered\n @props.onChange newState.data\n\n onDiscover: (url) ->\n if not @isMounted()\n return\n\n if not (url.trim().length and util.isUrl url)\n return\n\n setState = (data) =>\n newState = assign {},\n data: Immutable.Map(data) if data?", "response": "isDiscovered: true\n isDiscovering: false\n\n @setState newState\n if data?\n @props.onChange newState.data\n\n @setState\n isDiscovering: true\n , ->\n discoverActions\n .urlmeta url\n , (resp) ->\n resp.url = url\n setState resp\n , (error) ->\n setState()\n notifyActions.error lang.getText('read-link-failure')\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n render: ->\n form className: cx('form-table', 'is-dashed': not @state.isDiscovered), onSubmit: @onFormSubmit,", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 76, "line_end": 125} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fieldset {},\n div className: 'form-row flex-horiz',\n if @state.isDiscovering\n span className: 'loading-circle flex-static',\n LiteLoadingCircle\n size: 14\n else if @state.data.get('faviconUrl')?.length > 0\n span className: 'image-box is-favicon flex-static', style: backgroundImage: \"url(#{ @state.data.get 'faviconUrl' })\"\n else noscript()\n input\n type: 'text'\n value: @state.data.get('url') or ''\n onChange: @handelURLChange\n readOnly: @props.readOnly\n autoFocus: @props.displayMode is 'create'\n className: 'text-row font-normal text-overflow'\n placeholder: if not @props.readOnly then lang.getText('share-link-title-placeholder')\n div className: 'form-row', hidden: not @state.isDiscovered,\n input\n type: 'text'\n value: @state.data.get('title') or ''\n onChange: @handelTitleChange\n readOnly: @props.readOnly\n autoFocus: not @props.readOnly\n className: 'text-row font-large text-overflow'\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-title'\n div className: 'form-row flex-horiz', hidden: not @state.isDiscovered,\n if @state.data.get('imageUrl')?.length > 0\n span className: 'image-box is-pic flex-static', style: backgroundImage: \"url(#{ @state.data.get 'imageUrl' })\"\n else noscript()\n textarea\n value: @state.data.get('text') or ''\n onChange: @handleTextChange\n readOnly: @props.readOnly\n className: (cx 'textarea-row font-normal', 'is-resized': @state.data.get('imageUrl')?.length > 0)\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-desc'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 126, "line_end": 161} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfieldset {},\n div className: 'form-row flex-horiz',\n if @state.isDiscovering\n span className: 'loading-circle flex-static',\n LiteLoadingCircle\n size: 14\n else if @state.data.get('faviconUrl')?.length > 0\n span className: 'image-box is-favicon flex-static', style: backgroundImage: \"url(#{ @state.data.get 'faviconUrl' })\"\n else noscript()\n input\n type: 'text'\n value: @state.data.get('url') or ''\n onChange: @handelURLChange\n readOnly: @props.readOnly\n autoFocus: @props.displayMode is 'create'\n className: 'text-row font-normal text-overflow'\n placeholder: if not @props.readOnly then lang.getText('share-link-title-placeholder')\n div className: 'form-row', hidden: not @state.isDiscovered,\n input\n type: 'text'\n value: @state.data.get('title') or ''\n onChange: @handelTitleChange\n readOnly: @props.readOnly\n autoFocus: not @props.readOnly\n className: 'text-row font-large text-overflow'\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-title'\n div className: 'form-row flex-horiz', hidden: not @state.isDiscovered,\n if @state.data.get('imageUrl')?.length > 0\n span className: 'image-box is-pic flex-static', style: backgroundImage: \"url(#{ @state.data.get 'imageUrl' })\"\n else noscript()\n textarea\n value: @state.data.get('text') or ''\n onChange: @handleTextChange\n readOnly: @props.readOnly\n className: (cx 'textarea-row font-normal', 'is-resized': @state.data.get('imageUrl')?.length > 0)\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-desc'\n```", "response": "var ref, ref1, ref2;\n\nfieldset({}, div({\n className: 'form-row flex-horiz'\n}, this.state.isDiscovering ? span({\n className: 'loading-circle flex-static'\n}, LiteLoadingCircle({\n size: 14\n})) : ((ref = this.state.data.get('faviconUrl')) != null ? ref.length : void 0) > 0 ? span({\n className: 'image-box is-favicon flex-static',\n style: {\n backgroundImage: `url(${this.state.data.get('faviconUrl')})`\n }\n}) : noscript(), input({\n type: 'text',\n value: this.state.data.get('url') || '',\n onChange: this.handelURLChange,\n readOnly: this.props.readOnly,\n autoFocus: this.props.displayMode === 'create',\n className: 'text-row font-normal text-overflow',\n placeholder: !this.props.readOnly ? lang.getText('share-link-title-placeholder') : void 0\n})), div({\n className: 'form-row',\n hidden: !this.state.isDiscovered\n}, input({\n type: 'text',\n value: this.state.data.get('title') || '',\n onChange: this.handelTitleChange,\n readOnly: this.props.readOnly,\n autoFocus: !this.props.readOnly,\n className: 'text-row font-large text-overflow',\n placeholder: !this.props.readOnly ? lang.getText('placeholder-enter-title') : void 0\n})), div({\n className: 'form-row flex-horiz',\n hidden: !this.state.isDiscovered\n}, ((ref1 = this.state.data.get('imageUrl')) != null ? ref1.length : void 0) > 0 ? span({\n className: 'image-box is-pic flex-static',\n style: {\n backgroundImage: `url(${this.state.data.get('imageUrl')})`\n }\n}) : noscript(), textarea({\n value: this.state.data.get('text') || '',\n onChange: this.handleTextChange,\n readOnly: this.props.readOnly,\n className: cx('textarea-row font-normal', {\n 'is-resized': ((ref2 = this.state.data.get('imageUrl')) != null ? ref2.length : void 0) > 0\n }),\n placeholder: !this.props.readOnly ? lang.getText('placeholder-enter-desc') : void 0\n})));", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 126, "line_end": 161} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar ref, ref1, ref2;\n\nfieldset({}, div({\n className: 'form-row flex-horiz'\n}, this.state.isDiscovering ? span({\n className: 'loading-circle flex-static'\n}, LiteLoadingCircle({\n size: 14\n})) : ((ref = this.state.data.get('faviconUrl')) != null ? ref.length : void 0) > 0 ? span({\n className: 'image-box is-favicon flex-static',\n style: {\n backgroundImage: `url(${this.state.data.get('faviconUrl')})`\n }\n}) : noscript(), input({\n type: 'text',\n value: this.state.data.get('url') || '',\n onChange: this.handelURLChange,\n readOnly: this.props.readOnly,\n autoFocus: this.props.displayMode === 'create',\n className: 'text-row font-normal text-overflow',\n placeholder: !this.props.readOnly ? lang.getText('share-link-title-placeholder') : void 0\n})), div({\n className: 'form-row',\n hidden: !this.state.isDiscovered\n}, input({\n type: 'text',\n value: this.state.data.get('title') || '',\n onChange: this.handelTitleChange,\n readOnly: this.props.readOnly,\n autoFocus: !this.props.readOnly,\n className: 'text-row font-large text-overflow',\n placeholder: !this.props.readOnly ? lang.getText('placeholder-enter-title') : void 0\n})), div({\n className: 'form-row flex-horiz',\n hidden: !this.state.isDiscovered\n}, ((ref1 = this.state.data.get('imageUrl')) != null ? ref1.length : void 0) > 0 ? span({\n className: 'image-box is-pic flex-static',\n style: {\n backgroundImage: `url(${this.state.data.get('imageUrl')})`\n }\n}) : noscript(), textarea({\n value: this.state.data.get('text') || '',\n onChange: this.handleTextChange,\n readOnly: this.props.readOnly,\n className: cx('textarea-row font-normal', {\n 'is-resized': ((ref2 = this.state.data.get('imageUrl')) != null ? ref2.length : void 0) > 0\n }),\n placeholder: !this.props.readOnly ? lang.getText('placeholder-enter-desc') : void 0\n})));\n```", "response": "fieldset {},\n div className: 'form-row flex-horiz',\n if @state.isDiscovering\n span className: 'loading-circle flex-static',\n LiteLoadingCircle\n size: 14\n else if @state.data.get('faviconUrl')?.length > 0\n span className: 'image-box is-favicon flex-static', style: backgroundImage: \"url(#{ @state.data.get 'faviconUrl' })\"\n else noscript()\n input\n type: 'text'\n value: @state.data.get('url') or ''\n onChange: @handelURLChange\n readOnly: @props.readOnly\n autoFocus: @props.displayMode is 'create'\n className: 'text-row font-normal text-overflow'\n placeholder: if not @props.readOnly then lang.getText('share-link-title-placeholder')\n div className: 'form-row', hidden: not @state.isDiscovered,\n input\n type: 'text'\n value: @state.data.get('title') or ''\n onChange: @handelTitleChange\n readOnly: @props.readOnly\n autoFocus: not @props.readOnly\n className: 'text-row font-large text-overflow'\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-title'\n div className: 'form-row flex-horiz', hidden: not @state.isDiscovered,\n if @state.data.get('imageUrl')?.length > 0\n span className: 'image-box is-pic flex-static', style: backgroundImage: \"url(#{ @state.data.get 'imageUrl' })\"\n else noscript()\n textarea\n value: @state.data.get('text') or ''\n onChange: @handleTextChange\n readOnly: @props.readOnly\n className: (cx 'textarea-row font-normal', 'is-resized': @state.data.get('imageUrl')?.length > 0)\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-desc'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 126, "line_end": 161} +{"id": "jianliaoim/talk-os:talk-web/client/app/form-link.coffee:3:completion", "type": "completion", "prompt": "fieldset {},\n div className: 'form-row flex-horiz',\n if @state.isDiscovering\n span className: 'loading-circle flex-static',\n LiteLoadingCircle\n size: 14\n else if @state.data.get('faviconUrl')?.length > 0\n span className: 'image-box is-favicon flex-static', style: backgroundImage: \"url(#{ @state.data.get 'faviconUrl' })\"\n else noscript()\n input\n type: 'text'\n value: @state.data.get('url') or ''\n onChange: @handelURLChange\n readOnly: @props.readOnly\n autoFocus: @props.displayMode is 'create'\n className: 'text-row font-normal text-overflow'\n placeholder: if not @props.readOnly then lang.getText('share-link-title-placeholder')\n div className: 'form-row', hidden: not @state.isDiscovered,", "response": "input\n type: 'text'\n value: @state.data.get('title') or ''\n onChange: @handelTitleChange\n readOnly: @props.readOnly\n autoFocus: not @props.readOnly\n className: 'text-row font-large text-overflow'\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-title'\n div className: 'form-row flex-horiz', hidden: not @state.isDiscovered,\n if @state.data.get('imageUrl')?.length > 0\n span className: 'image-box is-pic flex-static', style: backgroundImage: \"url(#{ @state.data.get 'imageUrl' })\"\n else noscript()\n textarea\n value: @state.data.get('text') or ''\n onChange: @handleTextChange\n readOnly: @props.readOnly\n className: (cx 'textarea-row font-normal', 'is-resized': @state.data.get('imageUrl')?.length > 0)\n placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-desc'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-link.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-link.coffee", "line_start": 126, "line_end": 161} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "((root, factory) ->\n # AMD\n if ('function' is typeof define) and define.amd?\n define([], factory)\n # CommonJS\n else if exports?\n module.exports = factory()\n # no module system\n else\n root.UrlPattern = factory()\n)(this, ->\n UrlPattern = (arg, allowedSegmentChars) ->\n\n if allowedSegmentChars\n this.allowedSegmentChars = allowedSegmentChars\n\n # self awareness\n if arg instanceof UrlPattern\n this.isRegex = arg.isRegex\n this.regex = arg.regex\n this.names = arg.names\n return this\n\n this.isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or this.isRegex\n throw new TypeError 'argument must be a regex or a string'\n if this.isRegex\n this.regex = arg\n else\n this.compile(arg)\n return this\n\n UrlPattern.prototype.allowedSegmentChars = 'a-zA-Z0-9-_ %'\n\n UrlPattern.prototype.match = (url) ->\n match = this.regex.exec url\n unless match?\n return null\n\n captured = match.slice(1)\n if this.isRegex\n return captured", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 1, "line_end": 42} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "((root, factory) ->\n # AMD\n if ('function' is typeof define) and define.amd?\n define([], factory)\n # CommonJS\n else if exports?\n module.exports = factory()\n # no module system\n else\n root.UrlPattern = factory()\n)(this, ->\n UrlPattern = (arg, allowedSegmentChars) ->\n\n if allowedSegmentChars\n this.allowedSegmentChars = allowedSegmentChars\n\n # self awareness\n if arg instanceof UrlPattern\n this.isRegex = arg.isRegex\n this.regex = arg.regex\n this.names = arg.names", "response": "return this\n\n this.isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or this.isRegex\n throw new TypeError 'argument must be a regex or a string'\n if this.isRegex\n this.regex = arg\n else\n this.compile(arg)\n return this\n\n UrlPattern.prototype.allowedSegmentChars = 'a-zA-Z0-9-_ %'\n\n UrlPattern.prototype.match = (url) ->\n match = this.regex.exec url\n unless match?\n return null\n\n captured = match.slice(1)\n if this.isRegex\n return captured", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 1, "line_end": 42} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "bound = {}\n for value, i in captured\n name = this.names[i]\n # nothing captured for this binding\n unless value?\n continue\n # already bound\n if bound[name]?\n # capture multiple bindings for same name in an array\n unless Array.isArray bound[name]\n bound[name] = [bound[name]]\n bound[name].push value\n else\n bound[name] = value\n return bound\n\n alphanumericRegex = new RegExp '^[a-zA-Z0-9]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error \"`:` must be followed by at least one alphanumeric character that is the variable name at #{index}\"\n names.push string.slice(sliceBegin + 1, index)\n regexString += \"([\" + that.allowedSegmentChars + \"]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 44, "line_end": 89} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:completion", "type": "completion", "prompt": "bound = {}\n for value, i in captured\n name = this.names[i]\n # nothing captured for this binding\n unless value?\n continue\n # already bound\n if bound[name]?\n # capture multiple bindings for same name in an array\n unless Array.isArray bound[name]\n bound[name] = [bound[name]]\n bound[name].push value\n else\n bound[name] = value\n return bound\n\n alphanumericRegex = new RegExp '^[a-zA-Z0-9]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->", "response": "string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error \"`:` must be followed by at least one alphanumeric character that is the variable name at #{index}\"\n names.push string.slice(sliceBegin + 1, index)\n regexString += \"([\" + that.allowedSegmentChars + \"]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 44, "line_end": 89} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'\n leave()\n openParens--\n if openParens < 0\n throw new Error \"did not expect ) at #{index}\"\n regexString += ')?'\n else if char is '*'\n leave()\n regexString += '(.*?)'\n names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')\n\n if openParens > 0\n throw new Error \"unclosed parentheses at #{index}\"\n\n leave()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 91, "line_end": 130} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nenter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'\n leave()\n openParens--\n if openParens < 0\n throw new Error \"did not expect ) at #{index}\"\n regexString += ')?'\n else if char is '*'\n leave()\n regexString += '(.*?)'\n names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')\n\n if openParens > 0\n throw new Error \"unclosed parentheses at #{index}\"\n\n leave()\n```", "response": "var char, enter, length;\n\nenter = function(nextMode) {\n var mode, sliceBegin;\n if (nextMode === mode) {\n return;\n }\n leave();\n sliceBegin = index;\n return mode = nextMode;\n};\n\nlength = string.length;\n\nwhile (++index < length) {\n char = string.charAt(index);\n if (char === ':') {\n if (mode === 'variable') {\n throw new Error(`cannot start variable right after variable at ${index}`);\n }\n enter('variable');\n } else if (char === '(') {\n leave();\n openParens++;\n regexString += '(?:';\n } else if (char === ')') {\n leave();\n openParens--;\n if (openParens < 0) {\n throw new Error(`did not expect ) at ${index}`);\n }\n regexString += ')?';\n } else if (char === '*') {\n leave();\n regexString += '(.*?)';\n names.push('_');\n } else {\n switch (mode) {\n case 'variable':\n if (!this.isAlphanumeric(char)) {\n enter('static');\n }\n break;\n case '?':\n enter('static');\n }\n }\n}\n\nif (openParens > 0) {\n throw new Error(`unclosed parentheses at ${index}`);\n}\n\nleave();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 91, "line_end": 130} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar char, enter, length;\n\nenter = function(nextMode) {\n var mode, sliceBegin;\n if (nextMode === mode) {\n return;\n }\n leave();\n sliceBegin = index;\n return mode = nextMode;\n};\n\nlength = string.length;\n\nwhile (++index < length) {\n char = string.charAt(index);\n if (char === ':') {\n if (mode === 'variable') {\n throw new Error(`cannot start variable right after variable at ${index}`);\n }\n enter('variable');\n } else if (char === '(') {\n leave();\n openParens++;\n regexString += '(?:';\n } else if (char === ')') {\n leave();\n openParens--;\n if (openParens < 0) {\n throw new Error(`did not expect ) at ${index}`);\n }\n regexString += ')?';\n } else if (char === '*') {\n leave();\n regexString += '(.*?)';\n names.push('_');\n } else {\n switch (mode) {\n case 'variable':\n if (!this.isAlphanumeric(char)) {\n enter('static');\n }\n break;\n case '?':\n enter('static');\n }\n }\n}\n\nif (openParens > 0) {\n throw new Error(`unclosed parentheses at ${index}`);\n}\n\nleave();\n```", "response": "enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'\n leave()\n openParens--\n if openParens < 0\n throw new Error \"did not expect ) at #{index}\"\n regexString += ')?'\n else if char is '*'\n leave()\n regexString += '(.*?)'\n names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')\n\n if openParens > 0\n throw new Error \"unclosed parentheses at #{index}\"\n\n leave()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 91, "line_end": 130} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:completion", "type": "completion", "prompt": "enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'\n leave()", "response": "openParens--\n if openParens < 0\n throw new Error \"did not expect ) at #{index}\"\n regexString += ')?'\n else if char is '*'\n leave()\n regexString += '(.*?)'\n names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')\n\n if openParens > 0\n throw new Error \"unclosed parentheses at #{index}\"\n\n leave()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 91, "line_end": 130} +{"id": "snd/url-pattern:src/url-pattern.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "regexString += '$'\n\n this.names = names\n this.regex = new RegExp regexString\n\n UrlPattern.newPattern = ->\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.')\n\n return UrlPattern\n)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 132, "line_end": 141} +{"id": "snd/url-pattern:src/url-pattern.coffee:4:completion", "type": "completion", "prompt": "regexString += '$'\n\n this.names = names\n this.regex = new RegExp regexString", "response": "UrlPattern.newPattern = ->\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.')\n\n return UrlPattern\n)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "a5a67e15b13108b72d84dd7911fd22d0655df243", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/a5a67e15b13108b72d84dd7911fd22d0655df243/src/url-pattern.coffee", "line_start": 132, "line_end": 141} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "((root, factory) ->\n # AMD\n if ('function' is typeof define) and define.amd?\n define([], factory)\n # CommonJS\n else if exports?\n module.exports = factory()\n # no module system\n else\n root.UrlPattern = factory()\n)(this, ->\n UrlPattern = (arg) ->\n # self awareness\n if arg instanceof UrlPattern\n this.isRegex = arg.isRegex\n this.regex = arg.regex\n this.names = arg.names\n return this\n\n this.isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or this.isRegex\n throw new TypeError 'argument must be a regex or a string'\n if this.isRegex\n this.regex = arg\n else\n this.compile(arg)\n return this\n\n UrlPattern.prototype.match = (url) ->\n match = this.regex.exec url\n unless match?\n return null\n\n captured = match.slice(1)\n if this.isRegex\n return captured\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n # nothing captured for this binding\n unless value?\n continue\n # already bound\n if bound[name]?\n # capture multiple bindings for same name in an array\n unless Array.isArray bound[name]\n bound[name] = [bound[name]]\n bound[name].push value\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "((root, factory) ->\n # AMD\n if ('function' is typeof define) and define.amd?\n define([], factory)\n # CommonJS\n else if exports?\n module.exports = factory()\n # no module system\n else\n root.UrlPattern = factory()\n)(this, ->\n UrlPattern = (arg) ->\n # self awareness\n if arg instanceof UrlPattern\n this.isRegex = arg.isRegex\n this.regex = arg.regex\n this.names = arg.names\n return this\n\n this.isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or this.isRegex\n throw new TypeError 'argument must be a regex or a string'\n if this.isRegex\n this.regex = arg\n else", "response": "this.compile(arg)\n return this\n\n UrlPattern.prototype.match = (url) ->\n match = this.regex.exec url\n unless match?\n return null\n\n captured = match.slice(1)\n if this.isRegex\n return captured\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n # nothing captured for this binding\n unless value?\n continue\n # already bound\n if bound[name]?\n # capture multiple bindings for same name in an array\n unless Array.isArray bound[name]\n bound[name] = [bound[name]]\n bound[name].push value\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "alphanumericRegex = new RegExp '^[a-zA-Z0-9-_]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error \"`:` must be followed by at least one alphanumeric character that is the variable name at #{index}\"\n names.push string.slice(sliceBegin + 1, index)\n regexString += \"([a-zA-Z0-9-_]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'\n\n enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 54, "line_end": 103} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:completion", "type": "completion", "prompt": "alphanumericRegex = new RegExp '^[a-zA-Z0-9-_]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error \"`:` must be followed by at least one alphanumeric character that is the variable name at #{index}\"", "response": "names.push string.slice(sliceBegin + 1, index)\n regexString += \"([a-zA-Z0-9-_]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'\n\n enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 54, "line_end": 103} +{"id": "snd/url-pattern:src/url-pattern.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "leave()\n openParens--\n if openParens < 0\n throw new Error \"did not expect ) at #{index}\"\n regexString += ')?'\n else if char is '*'\n leave()\n regexString += '(.*?)'\n names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 104, "line_end": 119} +{"id": "snd/url-pattern:src/url-pattern.coffee:4:completion", "type": "completion", "prompt": "leave()\n openParens--\n if openParens < 0\n throw new Error \"did not expect ) at #{index}\"\n regexString += ')?'\n else if char is '*'\n leave()\n regexString += '(.*?)'", "response": "names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 104, "line_end": 119} +{"id": "snd/url-pattern:src/url-pattern.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if openParens > 0\n throw new Error \"unclosed parentheses at #{index}\"\n\n leave()\n\n regexString += '$'\n\n this.names = names\n this.regex = new RegExp regexString\n\n UrlPattern.newPattern = ->\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.')\n\n return UrlPattern\n)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 121, "line_end": 135} +{"id": "snd/url-pattern:src/url-pattern.coffee:5:completion", "type": "completion", "prompt": "if openParens > 0\n throw new Error \"unclosed parentheses at #{index}\"\n\n leave()\n\n regexString += '$'", "response": "this.names = names\n this.regex = new RegExp regexString\n\n UrlPattern.newPattern = ->\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.')\n\n return UrlPattern\n)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/99f6a1abf50d2232a6ab9c10500e7ff803c7a4bd/src/url-pattern.coffee", "line_start": 121, "line_end": 135} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "alphanumericRegex = new RegExp '^[a-zA-Z0-9]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error \"`:` must be followed by at least one alphanumeric character that is the variable name at #{index}\"\n names.push string.slice(sliceBegin + 1, index)\n regexString += \"([a-zA-Z0-9]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'\n\n enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "79b0fc14543e2ad500ba90b477d19cca1de53770", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/79b0fc14543e2ad500ba90b477d19cca1de53770/src/url-pattern.coffee", "line_start": 54, "line_end": 103} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:completion", "type": "completion", "prompt": "alphanumericRegex = new RegExp '^[a-zA-Z0-9]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error \"`:` must be followed by at least one alphanumeric character that is the variable name at #{index}\"", "response": "names.push string.slice(sliceBegin + 1, index)\n regexString += \"([a-zA-Z0-9]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'\n\n enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n throw new Error \"cannot start variable right after variable at #{index}\"\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'\n else if char is ')'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "79b0fc14543e2ad500ba90b477d19cca1de53770", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/79b0fc14543e2ad500ba90b477d19cca1de53770/src/url-pattern.coffee", "line_start": 54, "line_end": 103} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "alphanumericRegex = new RegExp '^[a-zA-Z0-9]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error '`:` must be followed by at least one alphanumeric character that is the variable name'\n names.push string.slice(sliceBegin + 1, index)\n regexString += \"([a-zA-Z0-9]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'\n\n enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n # TODO print last variable name as well as position in the source string\n throw new Error 'cannot start variable right after variable'\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "12be7b58cc25443cca8b3c60edaf7132a458c3c2", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/12be7b58cc25443cca8b3c60edaf7132a458c3c2/src/url-pattern.coffee", "line_start": 54, "line_end": 103} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:completion", "type": "completion", "prompt": "alphanumericRegex = new RegExp '^[a-zA-Z0-9]+$'\n\n UrlPattern.prototype.isAlphanumeric = (string) ->\n alphanumericRegex.test(string)\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.compile = (string) ->\n names = []\n regexString = '^'\n mode = '?'\n sliceBegin = 0\n openParens = 0\n\n that = this\n\n index = -1\n\n leave = ->\n switch mode\n when 'variable'\n if (index - sliceBegin) < 2\n throw new Error '`:` must be followed by at least one alphanumeric character that is the variable name'", "response": "names.push string.slice(sliceBegin + 1, index)\n regexString += \"([a-zA-Z0-9]+)\"\n when 'static'\n regexString += that.escapeForRegex(string.slice(sliceBegin, index))\n mode = '?'\n\n enter = (nextMode) ->\n if nextMode is mode\n return\n leave()\n sliceBegin = index\n mode = nextMode\n\n length = string.length\n while ++index < length\n char = string.charAt(index)\n if char is ':'\n if mode is 'variable'\n # TODO print last variable name as well as position in the source string\n throw new Error 'cannot start variable right after variable'\n enter('variable')\n else if char is '('\n leave()\n openParens++\n regexString += '(?:'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "12be7b58cc25443cca8b3c60edaf7132a458c3c2", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/12be7b58cc25443cca8b3c60edaf7132a458c3c2/src/url-pattern.coffee", "line_start": 54, "line_end": 103} +{"id": "snd/url-pattern:src/url-pattern.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else if char is ')'\n leave()\n openParens--\n if openParens < 0\n throw new Error 'did not expect )'\n regexString += ')?'\n else if char is '*'\n leave()\n regexString += '(.*?)'\n names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "12be7b58cc25443cca8b3c60edaf7132a458c3c2", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/12be7b58cc25443cca8b3c60edaf7132a458c3c2/src/url-pattern.coffee", "line_start": 104, "line_end": 120} +{"id": "snd/url-pattern:src/url-pattern.coffee:4:completion", "type": "completion", "prompt": "else if char is ')'\n leave()\n openParens--\n if openParens < 0\n throw new Error 'did not expect )'\n regexString += ')?'\n else if char is '*'\n leave()", "response": "regexString += '(.*?)'\n names.push '_'\n else\n switch mode\n when 'variable'\n unless this.isAlphanumeric char\n enter('static')\n when '?'\n enter('static')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "12be7b58cc25443cca8b3c60edaf7132a458c3c2", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/12be7b58cc25443cca8b3c60edaf7132a458c3c2/src/url-pattern.coffee", "line_start": 104, "line_end": 120} +{"id": "snd/url-pattern:src/url-pattern.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if openParens > 0\n throw new Error 'unclosed parentheses'\n\n leave()\n\n regexString += '$'\n\n this.names = names\n this.regex = new RegExp regexString\n\n UrlPattern.newPattern = ->\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.')\n\n return UrlPattern\n)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "12be7b58cc25443cca8b3c60edaf7132a458c3c2", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/12be7b58cc25443cca8b3c60edaf7132a458c3c2/src/url-pattern.coffee", "line_start": 122, "line_end": 136} +{"id": "snd/url-pattern:src/url-pattern.coffee:5:completion", "type": "completion", "prompt": "if openParens > 0\n throw new Error 'unclosed parentheses'\n\n leave()\n\n regexString += '$'", "response": "this.names = names\n this.regex = new RegExp regexString\n\n UrlPattern.newPattern = ->\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.')\n\n return UrlPattern\n)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "12be7b58cc25443cca8b3c60edaf7132a458c3c2", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/12be7b58cc25443cca8b3c60edaf7132a458c3c2/src/url-pattern.coffee", "line_start": 122, "line_end": 136} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "((root, factory) ->\n # AMD\n if ('function' is typeof define) and define.amd?\n define([], factory)\n # CommonJS\n else if exports?\n module.exports = factory()\n # no module system\n else\n root.UrlPattern = factory()\n)(this, ->\n UrlPattern = (arg, separator) ->\n # self awareness\n if arg instanceof UrlPattern\n this.isRegex = arg.isRegex\n this.regex = arg.regex\n this.names = arg.names\n return this\n\n this.isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or this.isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n if this.isRegex\n this.regex = arg\n else\n this.regex = new RegExp this.toRegexString arg, separator\n this.names = this.getNames arg, separator\n return this\n\n UrlPattern.prototype.match = (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n if this.isRegex\n return captured", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "3c07d9518b4cc00732526aa0bddddb9e77cb62c3", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/3c07d9518b4cc00732526aa0bddddb9e77cb62c3/src/url-pattern.coffee", "line_start": 1, "line_end": 39} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "((root, factory) ->\n # AMD\n if ('function' is typeof define) and define.amd?\n define([], factory)\n # CommonJS\n else if exports?\n module.exports = factory()\n # no module system\n else\n root.UrlPattern = factory()\n)(this, ->\n UrlPattern = (arg, separator) ->\n # self awareness\n if arg instanceof UrlPattern\n this.isRegex = arg.isRegex\n this.regex = arg.regex\n this.names = arg.names\n return this", "response": "this.isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or this.isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n if this.isRegex\n this.regex = arg\n else\n this.regex = new RegExp this.toRegexString arg, separator\n this.names = this.getNames arg, separator\n return this\n\n UrlPattern.prototype.match = (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n if this.isRegex\n return captured", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "3c07d9518b4cc00732526aa0bddddb9e77cb62c3", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/3c07d9518b4cc00732526aa0bddddb9e77cb62c3/src/url-pattern.coffee", "line_start": 1, "line_end": 39} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "bound = {}\n for value, i in captured\n name = this.names[i]\n unless value?\n continue\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.getNames = (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = this.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'\n\n names = []\n results = regex.exec arg\n\n while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n UrlPattern.prototype.escapeSeparators = (string, separator = '/') ->\n escapedSeparator = UrlPattern.prototype.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "3c07d9518b4cc00732526aa0bddddb9e77cb62c3", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/3c07d9518b4cc00732526aa0bddddb9e77cb62c3/src/url-pattern.coffee", "line_start": 41, "line_end": 82} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:completion", "type": "completion", "prompt": "bound = {}\n for value, i in captured\n name = this.names[i]\n unless value?\n continue\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n # source: http://stackoverflow.com/a/3561711\n UrlPattern.prototype.escapeForRegex = (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n UrlPattern.prototype.getNames = (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = this.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'", "response": "names = []\n results = regex.exec arg\n\n while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n UrlPattern.prototype.escapeSeparators = (string, separator = '/') ->\n escapedSeparator = UrlPattern.prototype.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "3c07d9518b4cc00732526aa0bddddb9e77cb62c3", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/3c07d9518b4cc00732526aa0bddddb9e77cb62c3/src/url-pattern.coffee", "line_start": 41, "line_end": 82} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "UrlPattern.prototype.toRegexString = (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = UrlPattern.prototype.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')\n\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = UrlPattern.prototype.escapeForRegex separator\n UrlPattern.prototype.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"\n\n UrlPattern.newPattern = () ->\n # helpful hint for new API\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.');\n\n return UrlPattern\n)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "3c07d9518b4cc00732526aa0bddddb9e77cb62c3", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/3c07d9518b4cc00732526aa0bddddb9e77cb62c3/src/url-pattern.coffee", "line_start": 84, "line_end": 112} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:completion", "type": "completion", "prompt": "UrlPattern.prototype.toRegexString = (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = UrlPattern.prototype.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')\n\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the", "response": "# separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = UrlPattern.prototype.escapeForRegex separator\n UrlPattern.prototype.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"\n\n UrlPattern.newPattern = () ->\n # helpful hint for new API\n throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.');\n\n return UrlPattern\n)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "3c07d9518b4cc00732526aa0bddddb9e77cb62c3", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/3c07d9518b4cc00732526aa0bddddb9e77cb62c3/src/url-pattern.coffee", "line_start": 84, "line_end": 112} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "UrlPattern.prototype.toRegexString = (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = UrlPattern.prototype.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')\n\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = UrlPattern.prototype.escapeForRegex separator\n UrlPattern.prototype.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"\n\n return UrlPattern\n)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "69591232ec0c3075a2acde838e08d20f320e6a64", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/69591232ec0c3075a2acde838e08d20f320e6a64/src/url-pattern.coffee", "line_start": 84, "line_end": 108} +{"id": "snd/url-pattern:src/url-pattern.coffee:3:completion", "type": "completion", "prompt": "UrlPattern.prototype.toRegexString = (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = UrlPattern.prototype.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')", "response": "# replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = UrlPattern.prototype.escapeForRegex separator\n UrlPattern.prototype.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"\n\n return UrlPattern\n)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "69591232ec0c3075a2acde838e08d20f320e6a64", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/69591232ec0c3075a2acde838e08d20f320e6a64/src/url-pattern.coffee", "line_start": 84, "line_end": 108} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n unless value?\n continue\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "800100c4826722322532dfb70388c6fce0baa287", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/800100c4826722322532dfb70388c6fce0baa287/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n unless value?\n continue\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'\n```", "response": "module.exports = {\n PatternPrototype: {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (value == null) {\n continue;\n }\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n },\n newPattern: function(arg, separator = '/') {\n var isRegex, pattern, regexString;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n [':', '*'].forEach(function(forbidden) {\n if (separator === forbidden) {\n throw new Error(`separator can't be ${forbidden}`);\n }\n });\n pattern = Object.create(module.exports.PatternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : (regexString = module.exports.toRegexString(arg, separator), new RegExp(regexString));\n if (!isRegex) {\n pattern.names = module.exports.getNames(arg, separator);\n }\n return pattern;\n },\n // source: http://stackoverflow.com/a/3561711\n escapeForRegex: function(string) {\n return string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n },\n getNames: function(arg, separator = '/') {\n var escapedSeparator, regex;\n if (arg instanceof RegExp) {\n return [];\n }\n escapedSeparator = module.exports.escapeForRegex(separator);\n return regex = new RegExp(`((:?:[^${escapedSeparator}\\(\\)]+)|(?:[\\*]))`, 'g');\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "800100c4826722322532dfb70388c6fce0baa287", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/800100c4826722322532dfb70388c6fce0baa287/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = {\n PatternPrototype: {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (value == null) {\n continue;\n }\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n },\n newPattern: function(arg, separator = '/') {\n var isRegex, pattern, regexString;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n [':', '*'].forEach(function(forbidden) {\n if (separator === forbidden) {\n throw new Error(`separator can't be ${forbidden}`);\n }\n });\n pattern = Object.create(module.exports.PatternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : (regexString = module.exports.toRegexString(arg, separator), new RegExp(regexString));\n if (!isRegex) {\n pattern.names = module.exports.getNames(arg, separator);\n }\n return pattern;\n },\n // source: http://stackoverflow.com/a/3561711\n escapeForRegex: function(string) {\n return string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n },\n getNames: function(arg, separator = '/') {\n var escapedSeparator, regex;\n if (arg instanceof RegExp) {\n return [];\n }\n escapedSeparator = module.exports.escapeForRegex(separator);\n return regex = new RegExp(`((:?:[^${escapedSeparator}\\(\\)]+)|(?:[\\*]))`, 'g');\n }\n};\n```", "response": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n unless value?\n continue\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "800100c4826722322532dfb70388c6fce0baa287", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/800100c4826722322532dfb70388c6fce0baa287/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n unless value?\n continue\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->", "response": "isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "800100c4826722322532dfb70388c6fce0baa287", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/800100c4826722322532dfb70388c6fce0baa287/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "names = []\n results = regex.exec arg\n\n while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator\n\n toRegexString: (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')\n\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "800100c4826722322532dfb70388c6fce0baa287", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/800100c4826722322532dfb70388c6fce0baa287/src/url-pattern.coffee", "line_start": 51, "line_end": 93} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:completion", "type": "completion", "prompt": "names = []\n results = regex.exec arg\n\n while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator", "response": "toRegexString: (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')\n\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "800100c4826722322532dfb70388c6fce0baa287", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/800100c4826722322532dfb70388c6fce0baa287/src/url-pattern.coffee", "line_start": 51, "line_end": 93} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n continue if value is undefined\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'\n\n names = []", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "d10b524745158ca445adcde1e0dda2bfc4d5e195", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/d10b524745158ca445adcde1e0dda2bfc4d5e195/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n continue if value is undefined\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'\n\n names = []\n```", "response": "module.exports = {\n PatternPrototype: {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (value === void 0) {\n continue;\n }\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n },\n newPattern: function(arg, separator = '/') {\n var isRegex, pattern, regexString;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n [':', '*'].forEach(function(forbidden) {\n if (separator === forbidden) {\n throw new Error(`separator can't be ${forbidden}`);\n }\n });\n pattern = Object.create(module.exports.PatternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : (regexString = module.exports.toRegexString(arg, separator), new RegExp(regexString));\n if (!isRegex) {\n pattern.names = module.exports.getNames(arg, separator);\n }\n return pattern;\n },\n // source: http://stackoverflow.com/a/3561711\n escapeForRegex: function(string) {\n return string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n },\n getNames: function(arg, separator = '/') {\n var escapedSeparator, names, regex;\n if (arg instanceof RegExp) {\n return [];\n }\n escapedSeparator = module.exports.escapeForRegex(separator);\n regex = new RegExp(`((:?:[^${escapedSeparator}\\(\\)]+)|(?:[\\*]))`, 'g');\n return names = [];\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "d10b524745158ca445adcde1e0dda2bfc4d5e195", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/d10b524745158ca445adcde1e0dda2bfc4d5e195/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = {\n PatternPrototype: {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (value === void 0) {\n continue;\n }\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n },\n newPattern: function(arg, separator = '/') {\n var isRegex, pattern, regexString;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n [':', '*'].forEach(function(forbidden) {\n if (separator === forbidden) {\n throw new Error(`separator can't be ${forbidden}`);\n }\n });\n pattern = Object.create(module.exports.PatternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : (regexString = module.exports.toRegexString(arg, separator), new RegExp(regexString));\n if (!isRegex) {\n pattern.names = module.exports.getNames(arg, separator);\n }\n return pattern;\n },\n // source: http://stackoverflow.com/a/3561711\n escapeForRegex: function(string) {\n return string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n },\n getNames: function(arg, separator = '/') {\n var escapedSeparator, names, regex;\n if (arg instanceof RegExp) {\n return [];\n }\n escapedSeparator = module.exports.escapeForRegex(separator);\n regex = new RegExp(`((:?:[^${escapedSeparator}\\(\\)]+)|(?:[\\*]))`, 'g');\n return names = [];\n }\n};\n```", "response": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n continue if value is undefined\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'\n\n names = []", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "d10b524745158ca445adcde1e0dda2bfc4d5e195", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/d10b524745158ca445adcde1e0dda2bfc4d5e195/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n continue if value is undefined\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex", "response": "throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}\\(\\)]+)|(?:[\\*]))\", 'g'\n\n names = []", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "d10b524745158ca445adcde1e0dda2bfc4d5e195", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/d10b524745158ca445adcde1e0dda2bfc4d5e195/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "results = regex.exec arg\n\n while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator\n\n toRegexString: (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')\n\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "d10b524745158ca445adcde1e0dda2bfc4d5e195", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/d10b524745158ca445adcde1e0dda2bfc4d5e195/src/url-pattern.coffee", "line_start": 51, "line_end": 92} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:completion", "type": "completion", "prompt": "results = regex.exec arg\n\n while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator\n\n toRegexString: (string, separator = '/') ->", "response": "# escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n stringWithEscapedSeparators = stringWithEscapedSeparators\n # replace optional param\n .replace(/\\((.*?)\\)/g, '(?:$1)?')\n # replace wildcard patterns\n .replace(/\\*/g, '(.*?)')\n\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n return \"^#{stringWithEscapedSeparators}$\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "d10b524745158ca445adcde1e0dda2bfc4d5e195", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/d10b524745158ca445adcde1e0dda2bfc4d5e195/src/url-pattern.coffee", "line_start": 51, "line_end": 92} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}]+)|(?:[\\*]))\", 'g'\n\n names = []\n results = regex.exec arg", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}]+)|(?:[\\*]))\", 'g'\n\n names = []\n results = regex.exec arg\n```", "response": "module.exports = {\n PatternPrototype: {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n },\n newPattern: function(arg, separator = '/') {\n var isRegex, pattern, regexString;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n [':', '*'].forEach(function(forbidden) {\n if (separator === forbidden) {\n throw new Error(`separator can't be ${forbidden}`);\n }\n });\n pattern = Object.create(module.exports.PatternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : (regexString = module.exports.toRegexString(arg, separator), new RegExp(regexString));\n if (!isRegex) {\n pattern.names = module.exports.getNames(arg, separator);\n }\n return pattern;\n },\n // source: http://stackoverflow.com/a/3561711\n escapeForRegex: function(string) {\n return string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n },\n getNames: function(arg, separator = '/') {\n var escapedSeparator, names, regex, results;\n if (arg instanceof RegExp) {\n return [];\n }\n escapedSeparator = module.exports.escapeForRegex(separator);\n regex = new RegExp(`((:?:[^${escapedSeparator}]+)|(?:[\\*]))`, 'g');\n names = [];\n return results = regex.exec(arg);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = {\n PatternPrototype: {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n },\n newPattern: function(arg, separator = '/') {\n var isRegex, pattern, regexString;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n [':', '*'].forEach(function(forbidden) {\n if (separator === forbidden) {\n throw new Error(`separator can't be ${forbidden}`);\n }\n });\n pattern = Object.create(module.exports.PatternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : (regexString = module.exports.toRegexString(arg, separator), new RegExp(regexString));\n if (!isRegex) {\n pattern.names = module.exports.getNames(arg, separator);\n }\n return pattern;\n },\n // source: http://stackoverflow.com/a/3561711\n escapeForRegex: function(string) {\n return string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n },\n getNames: function(arg, separator = '/') {\n var escapedSeparator, names, regex, results;\n if (arg instanceof RegExp) {\n return [];\n }\n escapedSeparator = module.exports.escapeForRegex(separator);\n regex = new RegExp(`((:?:[^${escapedSeparator}]+)|(?:[\\*]))`, 'g');\n names = [];\n return results = regex.exec(arg);\n }\n};\n```", "response": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n [':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}]+)|(?:[\\*]))\", 'g'\n\n names = []\n results = regex.exec arg", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "module.exports =\n\n PatternPrototype:\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\n newPattern: (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'", "response": "[':', '*'].forEach (forbidden) ->\n if separator is forbidden\n throw new Error \"separator can't be #{forbidden}\"\n pattern = Object.create module.exports.PatternPrototype\n pattern.isRegex = isRegex\n pattern.regex =\n if isRegex\n arg\n else\n regexString = module.exports.toRegexString arg, separator\n new RegExp regexString\n pattern.names = module.exports.getNames arg, separator unless isRegex\n return pattern\n\n # source: http://stackoverflow.com/a/3561711\n escapeForRegex: (string) ->\n string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n\n getNames: (arg, separator = '/') ->\n return [] if arg instanceof RegExp\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp \"((:?:[^#{escapedSeparator}]+)|(?:[\\*]))\", 'g'\n\n names = []\n results = regex.exec arg", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 1, "line_end": 50} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator\n\n toRegexString: (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n # finally replace wildcard patterns\n '^' + stringWithEscapedSeparators.replace(/\\*/g, '(.*)') + '$'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 51, "line_end": 85} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwhile results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator\n\n toRegexString: (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n # finally replace wildcard patterns\n '^' + stringWithEscapedSeparators.replace(/\\*/g, '(.*)') + '$'\n```", "response": "var name, results,\n indexOf = [].indexOf;\n\nwhile (results != null) {\n name = results[1].slice(1);\n if (name === '_') {\n throw new TypeError(`:_ can't be used as a pattern name in pattern ${arg}`);\n }\n if (indexOf.call(names, name) >= 0) {\n throw new TypeError(`duplicate pattern name :${name} in pattern ${arg}`);\n }\n names.push(name || '_');\n results = regex.exec(arg);\n}\n\nnames;\n\n({\n escapeSeparators: function(string, separator = '/') {\n var escapedSeparator, regex;\n escapedSeparator = module.exports.escapeForRegex(separator);\n regex = new RegExp(escapedSeparator, 'g');\n return string.replace(regex, escapedSeparator);\n },\n toRegexString: function(string, separator = '/') {\n var escapedSeparator, stringWithEscapedSeparators;\n // escape the seperators in the pattern string such that\n // regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators(string, separator);\n // replace named segment pattern strings (:pattern) with\n // regexes that capture and match everything until the \\\\ char (in case the\n // separator was escaped) or the separator char (in case the separator\n // didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex(separator);\n module.exports.getNames(string, separator).forEach(function(name) {\n return stringWithEscapedSeparators = stringWithEscapedSeparators.replace(':' + name, `([^\\\\${separator}]+)`);\n });\n // finally replace wildcard patterns\n return '^' + stringWithEscapedSeparators.replace(/\\*/g, '(.*)') + '$';\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 51, "line_end": 85} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar name, results,\n indexOf = [].indexOf;\n\nwhile (results != null) {\n name = results[1].slice(1);\n if (name === '_') {\n throw new TypeError(`:_ can't be used as a pattern name in pattern ${arg}`);\n }\n if (indexOf.call(names, name) >= 0) {\n throw new TypeError(`duplicate pattern name :${name} in pattern ${arg}`);\n }\n names.push(name || '_');\n results = regex.exec(arg);\n}\n\nnames;\n\n({\n escapeSeparators: function(string, separator = '/') {\n var escapedSeparator, regex;\n escapedSeparator = module.exports.escapeForRegex(separator);\n regex = new RegExp(escapedSeparator, 'g');\n return string.replace(regex, escapedSeparator);\n },\n toRegexString: function(string, separator = '/') {\n var escapedSeparator, stringWithEscapedSeparators;\n // escape the seperators in the pattern string such that\n // regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators(string, separator);\n // replace named segment pattern strings (:pattern) with\n // regexes that capture and match everything until the \\\\ char (in case the\n // separator was escaped) or the separator char (in case the separator\n // didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex(separator);\n module.exports.getNames(string, separator).forEach(function(name) {\n return stringWithEscapedSeparators = stringWithEscapedSeparators.replace(':' + name, `([^\\\\${separator}]+)`);\n });\n // finally replace wildcard patterns\n return '^' + stringWithEscapedSeparators.replace(/\\*/g, '(.*)') + '$';\n }\n});\n```", "response": "while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator\n\n toRegexString: (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n # finally replace wildcard patterns\n '^' + stringWithEscapedSeparators.replace(/\\*/g, '(.*)') + '$'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 51, "line_end": 85} +{"id": "snd/url-pattern:src/url-pattern.coffee:2:completion", "type": "completion", "prompt": "while results?\n name = results[1].slice(1)\n\n if name is '_'\n throw new TypeError(\":_ can't be used as a pattern name in pattern #{arg}\")\n\n if name in names\n throw new TypeError(\"duplicate pattern name :#{name} in pattern #{arg}\")\n\n names.push name || '_'\n results = regex.exec arg\n names\n\n escapeSeparators: (string, separator = '/') ->\n escapedSeparator = module.exports.escapeForRegex separator\n regex = new RegExp escapedSeparator, 'g'\n string.replace regex, escapedSeparator", "response": "toRegexString: (string, separator = '/') ->\n # escape the seperators in the pattern string such that\n # regex command chars (., ^, $, ...) can be used as separators\n stringWithEscapedSeparators = module.exports.escapeSeparators string, separator\n\n # replace named segment pattern strings (:pattern) with\n # regexes that capture and match everything until the \\\\ char (in case the\n # separator was escaped) or the separator char (in case the separator\n # didn't need escaping)\n escapedSeparator = module.exports.escapeForRegex separator\n module.exports.getNames(string, separator).forEach (name) ->\n stringWithEscapedSeparators = stringWithEscapedSeparators\n .replace(':' + name,\"([^\\\\#{separator}]+)\")\n\n # finally replace wildcard patterns\n '^' + stringWithEscapedSeparators.replace(/\\*/g, '(.*)') + '$'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "8a2e5902b618b702af7c77c3aa61b2b1d572c43a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/8a2e5902b618b702af7c77c3aa61b2b1d572c43a/src/url-pattern.coffee", "line_start": 51, "line_end": 85} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "util = require './util'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\nmodule.exports = (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n pattern = Object.create patternPrototype\n pattern.isRegex = isRegex\n pattern.regex = if isRegex then arg else new RegExp util.toRegexString arg\n pattern.names = util.getNames arg unless isRegex\n return pattern", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nutil = require './util'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\nmodule.exports = (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n pattern = Object.create patternPrototype\n pattern.isRegex = isRegex\n pattern.regex = if isRegex then arg else new RegExp util.toRegexString arg\n pattern.names = util.getNames arg unless isRegex\n return pattern\n```", "response": "var patternPrototype, util;\n\nutil = require('./util');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg, separator = '/') {\n var isRegex, pattern;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n pattern = Object.create(patternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : new RegExp(util.toRegexString(arg));\n if (!isRegex) {\n pattern.names = util.getNames(arg);\n }\n return pattern;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar patternPrototype, util;\n\nutil = require('./util');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg, separator = '/') {\n var isRegex, pattern;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n pattern = Object.create(patternPrototype);\n pattern.isRegex = isRegex;\n pattern.regex = isRegex ? arg : new RegExp(util.toRegexString(arg));\n if (!isRegex) {\n pattern.names = util.getNames(arg);\n }\n return pattern;\n};\n```", "response": "util = require './util'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n return bound\n\nmodule.exports = (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n pattern = Object.create patternPrototype\n pattern.isRegex = isRegex\n pattern.regex = if isRegex then arg else new RegExp util.toRegexString arg\n pattern.names = util.getNames arg unless isRegex\n return pattern", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "util = require './util'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []", "response": "bound._.push value\n else\n bound[name] = value\n\n return bound\n\nmodule.exports = (arg, separator = '/') ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n pattern = Object.create patternPrototype\n pattern.isRegex = isRegex\n pattern.regex = if isRegex then arg else new RegExp util.toRegexString arg\n pattern.names = util.getNames arg unless isRegex\n return pattern", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "7a949d79610b4a174753a939303a928b5267633b", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/7a949d79610b4a174753a939303a928b5267633b/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "5e21c51e4cc717efff2f23c4ea1d31aab566500d", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/5e21c51e4cc717efff2f23c4ea1d31aab566500d/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncommon = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p\n```", "response": "var common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "5e21c51e4cc717efff2f23c4ea1d31aab566500d", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/5e21c51e4cc717efff2f23c4ea1d31aab566500d/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n if (bound._ == null) {\n bound._ = [];\n }\n bound._.push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};\n```", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []\n bound._.push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "5e21c51e4cc717efff2f23c4ea1d31aab566500d", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/5e21c51e4cc717efff2f23c4ea1d31aab566500d/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name is '_'\n bound._ ?= []", "response": "bound._.push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "5e21c51e4cc717efff2f23c4ea1d31aab566500d", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/5e21c51e4cc717efff2f23c4ea1d31aab566500d/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name == '_'\n bound[name] = bound[name] || []\n bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "4a21bb69296b83a320aaf26cefcaeedf97592b8a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/4a21bb69296b83a320aaf26cefcaeedf97592b8a/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncommon = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name == '_'\n bound[name] = bound[name] || []\n bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p\n```", "response": "var common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n bound[name] = bound[name] || [];\n bound[name].push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "4a21bb69296b83a320aaf26cefcaeedf97592b8a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/4a21bb69296b83a320aaf26cefcaeedf97592b8a/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n bound[name] = bound[name] || [];\n bound[name].push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};\n```", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name == '_'\n bound[name] = bound[name] || []\n bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "4a21bb69296b83a320aaf26cefcaeedf97592b8a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/4a21bb69296b83a320aaf26cefcaeedf97592b8a/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = this.regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if this.isRegex\n\n bound = {}\n for value, i in captured\n name = this.names[i]\n if name == '_'\n bound[name] = bound[name] || []", "response": "bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "4a21bb69296b83a320aaf26cefcaeedf97592b8a", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/4a21bb69296b83a320aaf26cefcaeedf97592b8a/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}\n for value, i in captured\n name = @names[i]\n if name == '_'\n bound[name] = bound[name] || []\n bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "01e35866381fddb5f2813e8a932f4f2ad7c1ab84", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/01e35866381fddb5f2813e8a932f4f2ad7c1ab84/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncommon = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}\n for value, i in captured\n name = @names[i]\n if name == '_'\n bound[name] = bound[name] || []\n bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p\n```", "response": "var common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n bound[name] = bound[name] || [];\n bound[name].push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "01e35866381fddb5f2813e8a932f4f2ad7c1ab84", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/01e35866381fddb5f2813e8a932f4f2ad7c1ab84/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, len, match, name, value;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, len = captured.length; j < len; i = ++j) {\n value = captured[i];\n name = this.names[i];\n if (name === '_') {\n bound[name] = bound[name] || [];\n bound[name].push(value);\n } else {\n bound[name] = value;\n }\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};\n```", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}\n for value, i in captured\n name = @names[i]\n if name == '_'\n bound[name] = bound[name] || []\n bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "01e35866381fddb5f2813e8a932f4f2ad7c1ab84", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/01e35866381fddb5f2813e8a932f4f2ad7c1ab84/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}\n for value, i in captured\n name = @names[i]\n if name == '_'\n bound[name] = bound[name] || []", "response": "bound[name].push value\n else\n bound[name] = value\n\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "01e35866381fddb5f2813e8a932f4f2ad7c1ab84", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/01e35866381fddb5f2813e8a932f4f2ad7c1ab84/src/url-pattern.coffee", "line_start": 1, "line_end": 30} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}\n bound[@names[i]] = captured[i] for i in [0...captured.length]\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6/src/url-pattern.coffee", "line_start": 1, "line_end": 23} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncommon = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}\n bound[@names[i]] = captured[i] for i in [0...captured.length]\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p\n```", "response": "var common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, match, ref;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, ref = captured.length; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {\n bound[this.names[i]] = captured[i];\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6/src/url-pattern.coffee", "line_start": 1, "line_end": 23} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar common, patternPrototype;\n\ncommon = require('./common');\n\npatternPrototype = {\n match: function(url) {\n var bound, captured, i, j, match, ref;\n match = this.regex.exec(url);\n if (match == null) {\n return null;\n }\n captured = match.slice(1);\n if (this.isRegex) {\n return captured;\n }\n bound = {};\n for (i = j = 0, ref = captured.length; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {\n bound[this.names[i]] = captured[i];\n }\n return bound;\n }\n};\n\nmodule.exports = function(arg) {\n var isRegex, p;\n isRegex = arg instanceof RegExp;\n if (!(('string' === typeof arg) || isRegex)) {\n throw new TypeError('argument must be a regex or a string');\n }\n p = Object.create(patternPrototype);\n p.isRegex = isRegex;\n p.regex = isRegex ? arg : new RegExp(common.toRegexString(arg));\n if (!isRegex) {\n p.names = common.getNames(arg);\n }\n return p;\n};\n```", "response": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}\n bound[@names[i]] = captured[i] for i in [0...captured.length]\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6/src/url-pattern.coffee", "line_start": 1, "line_end": 23} +{"id": "snd/url-pattern:src/url-pattern.coffee:1:completion", "type": "completion", "prompt": "common = require './common'\n\npatternPrototype =\n match: (url) ->\n match = @regex.exec url\n return null unless match?\n\n captured = match.slice(1)\n return captured if @isRegex\n\n bound = {}", "response": "bound[@names[i]] = captured[i] for i in [0...captured.length]\n bound\n\nmodule.exports = (arg) ->\n isRegex = arg instanceof RegExp\n unless ('string' is typeof arg) or isRegex\n throw new TypeError 'argument must be a regex or a string'\n p = Object.create patternPrototype\n p.isRegex = isRegex\n p.regex = if isRegex then arg else new RegExp common.toRegexString arg\n p.names = common.getNames arg unless isRegex\n p", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "snd/url-pattern", "path": "src/url-pattern.coffee", "license": "MIT", "commit": "f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6", "stars": 588, "source_url": "https://github.com/snd/url-pattern/blob/f7dd35fe1c0b652708271c268ac2bb1c6eaba3d6/src/url-pattern.coffee", "line_start": 1, "line_end": 23} +{"id": "oozcitak/xmlbuilder-js:test/issues/239.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "path = require('path')\nfs = require('fs')\n\nsuite 'Tests specific to issues:', ->\n test 'Issue #239: Not possible to build a list of non-unique elements non-contiguously with JSON', ->\n\n obj = root:\n '#text1': [\n { node: 'value1' }\n { node: 'value2' }\n ]\n '#comment': 'comment node'\n '#text2': [\n { node: 'value3' }\n { node: 'value4' }\n ]\n\n doc = xml(obj, { headless: true })\n\n eq(\n doc.end({ pretty: true })\n \"\"\"\n \n value1\n value2\n \n value3\n value4\n \n \"\"\"\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/239.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/239.coffee", "line_start": 1, "line_end": 31} +{"id": "oozcitak/xmlbuilder-js:test/issues/239.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npath = require('path')\nfs = require('fs')\n\nsuite 'Tests specific to issues:', ->\n test 'Issue #239: Not possible to build a list of non-unique elements non-contiguously with JSON', ->\n\n obj = root:\n '#text1': [\n { node: 'value1' }\n { node: 'value2' }\n ]\n '#comment': 'comment node'\n '#text2': [\n { node: 'value3' }\n { node: 'value4' }\n ]\n\n doc = xml(obj, { headless: true })\n\n eq(\n doc.end({ pretty: true })\n \"\"\"\n \n value1\n value2\n \n value3\n value4\n \n \"\"\"\n )\n```", "response": "var fs, path;\n\npath = require('path');\n\nfs = require('fs');\n\nsuite('Tests specific to issues:', function() {\n return test('Issue #239: Not possible to build a list of non-unique elements non-contiguously with JSON', function() {\n var doc, obj;\n obj = {\n root: {\n '#text1': [\n {\n node: 'value1'\n },\n {\n node: 'value2'\n }\n ],\n '#comment': 'comment node',\n '#text2': [\n {\n node: 'value3'\n },\n {\n node: 'value4'\n }\n ]\n }\n };\n doc = xml(obj, {\n headless: true\n });\n return eq(doc.end({\n pretty: true\n }), `\n value1\n value2\n \n value3\n value4\n`);\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/239.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/239.coffee", "line_start": 1, "line_end": 31} +{"id": "oozcitak/xmlbuilder-js:test/issues/239.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs, path;\n\npath = require('path');\n\nfs = require('fs');\n\nsuite('Tests specific to issues:', function() {\n return test('Issue #239: Not possible to build a list of non-unique elements non-contiguously with JSON', function() {\n var doc, obj;\n obj = {\n root: {\n '#text1': [\n {\n node: 'value1'\n },\n {\n node: 'value2'\n }\n ],\n '#comment': 'comment node',\n '#text2': [\n {\n node: 'value3'\n },\n {\n node: 'value4'\n }\n ]\n }\n };\n doc = xml(obj, {\n headless: true\n });\n return eq(doc.end({\n pretty: true\n }), `\n value1\n value2\n \n value3\n value4\n`);\n });\n});\n```", "response": "path = require('path')\nfs = require('fs')\n\nsuite 'Tests specific to issues:', ->\n test 'Issue #239: Not possible to build a list of non-unique elements non-contiguously with JSON', ->\n\n obj = root:\n '#text1': [\n { node: 'value1' }\n { node: 'value2' }\n ]\n '#comment': 'comment node'\n '#text2': [\n { node: 'value3' }\n { node: 'value4' }\n ]\n\n doc = xml(obj, { headless: true })\n\n eq(\n doc.end({ pretty: true })\n \"\"\"\n \n value1\n value2\n \n value3\n value4\n \n \"\"\"\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/239.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/239.coffee", "line_start": 1, "line_end": 31} +{"id": "oozcitak/xmlbuilder-js:test/issues/239.coffee:1:completion", "type": "completion", "prompt": "path = require('path')\nfs = require('fs')\n\nsuite 'Tests specific to issues:', ->\n test 'Issue #239: Not possible to build a list of non-unique elements non-contiguously with JSON', ->\n\n obj = root:\n '#text1': [\n { node: 'value1' }\n { node: 'value2' }\n ]\n '#comment': 'comment node'\n '#text2': [\n { node: 'value3' }\n { node: 'value4' }", "response": "]\n\n doc = xml(obj, { headless: true })\n\n eq(\n doc.end({ pretty: true })\n \"\"\"\n \n value1\n value2\n \n value3\n value4\n \n \"\"\"\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/239.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/239.coffee", "line_start": 1, "line_end": 31} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "webdriverSync = require('webdriver-sync')\n\nglobal.browser = if process.env.HEADLESS\n new webdriverSync.PhantomJSDriver()\nelse\n new webdriverSync.ChromeDriver()\n\nbrowser.eval = (code) ->\n browser.executeScript(\"return #{code}\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwebdriverSync = require('webdriver-sync')\n\nglobal.browser = if process.env.HEADLESS\n new webdriverSync.PhantomJSDriver()\nelse\n new webdriverSync.ChromeDriver()\n\nbrowser.eval = (code) ->\n browser.executeScript(\"return #{code}\")\n```", "response": "var webdriverSync;\n\nwebdriverSync = require('webdriver-sync');\n\nglobal.browser = process.env.HEADLESS ? new webdriverSync.PhantomJSDriver() : new webdriverSync.ChromeDriver();\n\nbrowser.eval = function(code) {\n return browser.executeScript(`return ${code}`);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar webdriverSync;\n\nwebdriverSync = require('webdriver-sync');\n\nglobal.browser = process.env.HEADLESS ? new webdriverSync.PhantomJSDriver() : new webdriverSync.ChromeDriver();\n\nbrowser.eval = function(code) {\n return browser.executeScript(`return ${code}`);\n};\n```", "response": "webdriverSync = require('webdriver-sync')\n\nglobal.browser = if process.env.HEADLESS\n new webdriverSync.PhantomJSDriver()\nelse\n new webdriverSync.ChromeDriver()\n\nbrowser.eval = (code) ->\n browser.executeScript(\"return #{code}\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:completion", "type": "completion", "prompt": "webdriverSync = require('webdriver-sync')\n\nglobal.browser = if process.env.HEADLESS\n new webdriverSync.PhantomJSDriver()", "response": "else\n new webdriverSync.ChromeDriver()\n\nbrowser.eval = (code) ->\n browser.executeScript(\"return #{code}\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 9} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "wd = require('webdriver-sync')\n\nbeforeAll ->\n global.browser = if process.env.HEADLESS then new wd.PhantomJSDriver() else new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "663b9c1613501f7cc95ff8bfefed4cc53e57077a", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/663b9c1613501f7cc95ff8bfefed4cc53e57077a/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwd = require('webdriver-sync')\n\nbeforeAll ->\n global.browser = if process.env.HEADLESS then new wd.PhantomJSDriver() else new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")\n```", "response": "var wd;\n\nwd = require('webdriver-sync');\n\nbeforeAll(function() {\n global.browser = process.env.HEADLESS ? new wd.PhantomJSDriver() : new wd.ChromeDriver();\n return browser.eval = function(code) {\n return browser.executeScript(`return ${code}`);\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "663b9c1613501f7cc95ff8bfefed4cc53e57077a", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/663b9c1613501f7cc95ff8bfefed4cc53e57077a/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar wd;\n\nwd = require('webdriver-sync');\n\nbeforeAll(function() {\n global.browser = process.env.HEADLESS ? new wd.PhantomJSDriver() : new wd.ChromeDriver();\n return browser.eval = function(code) {\n return browser.executeScript(`return ${code}`);\n };\n});\n```", "response": "wd = require('webdriver-sync')\n\nbeforeAll ->\n global.browser = if process.env.HEADLESS then new wd.PhantomJSDriver() else new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "663b9c1613501f7cc95ff8bfefed4cc53e57077a", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/663b9c1613501f7cc95ff8bfefed4cc53e57077a/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:completion", "type": "completion", "prompt": "wd = require('webdriver-sync')", "response": "beforeAll ->\n global.browser = if process.env.HEADLESS then new wd.PhantomJSDriver() else new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "663b9c1613501f7cc95ff8bfefed4cc53e57077a", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/663b9c1613501f7cc95ff8bfefed4cc53e57077a/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "wd = require('webdriver-sync')\n\nbeforeAll ->\n global.browser = new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "47d0cad03f6a0d008152e75ba57a5e444b63fabe", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/47d0cad03f6a0d008152e75ba57a5e444b63fabe/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwd = require('webdriver-sync')\n\nbeforeAll ->\n global.browser = new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")\n```", "response": "var wd;\n\nwd = require('webdriver-sync');\n\nbeforeAll(function() {\n global.browser = new wd.ChromeDriver();\n return browser.eval = function(code) {\n return browser.executeScript(`return ${code}`);\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "47d0cad03f6a0d008152e75ba57a5e444b63fabe", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/47d0cad03f6a0d008152e75ba57a5e444b63fabe/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar wd;\n\nwd = require('webdriver-sync');\n\nbeforeAll(function() {\n global.browser = new wd.ChromeDriver();\n return browser.eval = function(code) {\n return browser.executeScript(`return ${code}`);\n };\n});\n```", "response": "wd = require('webdriver-sync')\n\nbeforeAll ->\n global.browser = new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "47d0cad03f6a0d008152e75ba57a5e444b63fabe", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/47d0cad03f6a0d008152e75ba57a5e444b63fabe/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:completion", "type": "completion", "prompt": "wd = require('webdriver-sync')", "response": "beforeAll ->\n global.browser = new wd.ChromeDriver()\n browser.eval = (code) -> browser.executeScript(\"return #{code}\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "47d0cad03f6a0d008152e75ba57a5e444b63fabe", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/47d0cad03f6a0d008152e75ba57a5e444b63fabe/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "wd = require 'webdriver-sync'\n\nbeforeEach ->\n global.browser = new wd.ChromeDriver()\n\nafterEach ->\n browser.quit()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "d364cd7bb81b2f871793684df515c920cb13324f", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/d364cd7bb81b2f871793684df515c920cb13324f/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwd = require 'webdriver-sync'\n\nbeforeEach ->\n global.browser = new wd.ChromeDriver()\n\nafterEach ->\n browser.quit()\n```", "response": "var wd;\n\nwd = require('webdriver-sync');\n\nbeforeEach(function() {\n return global.browser = new wd.ChromeDriver();\n});\n\nafterEach(function() {\n return browser.quit();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "d364cd7bb81b2f871793684df515c920cb13324f", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/d364cd7bb81b2f871793684df515c920cb13324f/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar wd;\n\nwd = require('webdriver-sync');\n\nbeforeEach(function() {\n return global.browser = new wd.ChromeDriver();\n});\n\nafterEach(function() {\n return browser.quit();\n});\n```", "response": "wd = require 'webdriver-sync'\n\nbeforeEach ->\n global.browser = new wd.ChromeDriver()\n\nafterEach ->\n browser.quit()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "d364cd7bb81b2f871793684df515c920cb13324f", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/d364cd7bb81b2f871793684df515c920cb13324f/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:completion", "type": "completion", "prompt": "wd = require 'webdriver-sync'\n\nbeforeEach ->", "response": "global.browser = new wd.ChromeDriver()\n\nafterEach ->\n browser.quit()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "d364cd7bb81b2f871793684df515c920cb13324f", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/d364cd7bb81b2f871793684df515c920cb13324f/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "wd = require 'wd'\n\nbeforeEach (done) ->\n global.browser = wd.remote()\n browser.init\n browserName: process.env.USE_BROWSER || 'phantomjs'\n , done\n\n\nafterEach ->\n browser.quit()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 11} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwd = require 'wd'\n\nbeforeEach (done) ->\n global.browser = wd.remote()\n browser.init\n browserName: process.env.USE_BROWSER || 'phantomjs'\n , done\n\n\nafterEach ->\n browser.quit()\n```", "response": "var wd;\n\nwd = require('wd');\n\nbeforeEach(function(done) {\n global.browser = wd.remote();\n return browser.init({\n browserName: process.env.USE_BROWSER || 'phantomjs'\n }, done);\n});\n\nafterEach(function() {\n return browser.quit();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 11} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar wd;\n\nwd = require('wd');\n\nbeforeEach(function(done) {\n global.browser = wd.remote();\n return browser.init({\n browserName: process.env.USE_BROWSER || 'phantomjs'\n }, done);\n});\n\nafterEach(function() {\n return browser.quit();\n});\n```", "response": "wd = require 'wd'\n\nbeforeEach (done) ->\n global.browser = wd.remote()\n browser.init\n browserName: process.env.USE_BROWSER || 'phantomjs'\n , done\n\n\nafterEach ->\n browser.quit()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 11} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:completion", "type": "completion", "prompt": "wd = require 'wd'\n\nbeforeEach (done) ->\n global.browser = wd.remote()\n browser.init", "response": "browserName: process.env.USE_BROWSER || 'phantomjs'\n , done\n\n\nafterEach ->\n browser.quit()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 11} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "wd = require 'wd'\n\nbeforeAll (done) ->\n global.browser = wd.remote()\n browser.init\n browserName: process.env.USE_BROWSER || 'phantomjs'\n , done", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "0af6711c0ec0b192705a7fee01ef9e6d834ffe47", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0af6711c0ec0b192705a7fee01ef9e6d834ffe47/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwd = require 'wd'\n\nbeforeAll (done) ->\n global.browser = wd.remote()\n browser.init\n browserName: process.env.USE_BROWSER || 'phantomjs'\n , done\n```", "response": "var wd;\n\nwd = require('wd');\n\nbeforeAll(function(done) {\n global.browser = wd.remote();\n return browser.init({\n browserName: process.env.USE_BROWSER || 'phantomjs'\n }, done);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "0af6711c0ec0b192705a7fee01ef9e6d834ffe47", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0af6711c0ec0b192705a7fee01ef9e6d834ffe47/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar wd;\n\nwd = require('wd');\n\nbeforeAll(function(done) {\n global.browser = wd.remote();\n return browser.init({\n browserName: process.env.USE_BROWSER || 'phantomjs'\n }, done);\n});\n```", "response": "wd = require 'wd'\n\nbeforeAll (done) ->\n global.browser = wd.remote()\n browser.init\n browserName: process.env.USE_BROWSER || 'phantomjs'\n , done", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "0af6711c0ec0b192705a7fee01ef9e6d834ffe47", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0af6711c0ec0b192705a7fee01ef9e6d834ffe47/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "linemanjs/lineman:test/spec-e2e/helpers/browser.coffee:1:completion", "type": "completion", "prompt": "wd = require 'wd'\n\nbeforeAll (done) ->", "response": "global.browser = wd.remote()\n browser.init\n browserName: process.env.USE_BROWSER || 'phantomjs'\n , done", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/browser.coffee", "license": "MIT", "commit": "0af6711c0ec0b192705a7fee01ef9e6d834ffe47", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0af6711c0ec0b192705a7fee01ef9e6d834ffe47/test/spec-e2e/helpers/browser.coffee", "line_start": 1, "line_end": 7} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require 'fs'\n_ = require 'underscore'\n\n# Use CodeMirror in Node for syntax highlighting, per\n# https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight\nCodeMirror = require 'codemirror/addon/runmode/runmode.node.js'\nrequire 'codemirror/mode/coffeescript/coffeescript.js'\nrequire 'codemirror/mode/javascript/javascript.js'\n\nCoffeeScript = require '../../lib/coffeescript'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane.\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n include = (file) -> fs.readFileSync(\"documentation/v2/#{file}\", 'utf-8')\n\n highlight = (language, code) ->\n # Adapted from https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight.\n html = ''\n curStyle = null\n accum = ''\n\n esc = (str) ->\n str.replace /[<&]/g, (ch) ->\n if ch is '&' then '&' else '<'\n\n flush = ->\n if curStyle\n html += \"#{esc accum}\"\n else\n html += esc accum\n\n CodeMirror.runMode code, {name: language}, (text, style) ->\n if style isnt curStyle\n flush()\n curStyle = style\n accum = text\n else\n accum += text\n flush()\n\n html\n\n output = render {file, cs, js, highlight, include, run}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "63d3b699d7f28ba10e097e9dc3e8b57aca84b77a", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/code.coffee", "line_start": 1, "line_end": 47} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require 'fs'\n_ = require 'underscore'\n\n# Use CodeMirror in Node for syntax highlighting, per\n# https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight\nCodeMirror = require 'codemirror/addon/runmode/runmode.node.js'\nrequire 'codemirror/mode/coffeescript/coffeescript.js'\nrequire 'codemirror/mode/javascript/javascript.js'\n\nCoffeeScript = require '../../lib/coffeescript'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane.\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n include = (file) -> fs.readFileSync(\"documentation/v2/#{file}\", 'utf-8')\n\n highlight = (language, code) ->\n # Adapted from https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight.\n html = ''\n curStyle = null\n accum = ''\n\n esc = (str) ->\n str.replace /[<&]/g, (ch) ->\n if ch is '&' then '&' else '<'\n\n flush = ->\n if curStyle\n html += \"#{esc accum}\"\n else\n html += esc accum\n\n CodeMirror.runMode code, {name: language}, (text, style) ->\n if style isnt curStyle\n flush()\n curStyle = style\n accum = text\n else\n accum += text\n flush()\n\n html\n\n output = render {file, cs, js, highlight, include, run}\n```", "response": "var CodeMirror, CoffeeScript, _, fs;\n\nfs = require('fs');\n\n_ = require('underscore');\n\n// Use CodeMirror in Node for syntax highlighting, per\n// https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight\nCodeMirror = require('codemirror/addon/runmode/runmode.node.js');\n\nrequire('codemirror/mode/coffeescript/coffeescript.js');\n\nrequire('codemirror/mode/javascript/javascript.js');\n\nCoffeeScript = require('../../lib/coffeescript');\n\nmodule.exports = function() {\n return function(file, run = false) {\n var cs, highlight, include, js, output, render;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true // This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane.\n });\n render = _.template(fs.readFileSync('documentation/v2/code.html', 'utf-8'));\n include = function(file) {\n return fs.readFileSync(`documentation/v2/${file}`, 'utf-8');\n };\n highlight = function(language, code) {\n var accum, curStyle, esc, flush, html;\n // Adapted from https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight.\n html = '';\n curStyle = null;\n accum = '';\n esc = function(str) {\n return str.replace(/[<&]/g, function(ch) {\n if (ch === '&') {\n return '&';\n } else {\n return '<';\n }\n });\n };\n flush = function() {\n if (curStyle) {\n return html += `${esc(accum)}`;\n } else {\n return html += esc(accum);\n }\n };\n CodeMirror.runMode(code, {\n name: language\n }, function(text, style) {\n if (style !== curStyle) {\n flush();\n curStyle = style;\n return accum = text;\n } else {\n return accum += text;\n }\n });\n flush();\n return html;\n };\n return output = render({file, cs, js, highlight, include, run});\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "63d3b699d7f28ba10e097e9dc3e8b57aca84b77a", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/code.coffee", "line_start": 1, "line_end": 47} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CodeMirror, CoffeeScript, _, fs;\n\nfs = require('fs');\n\n_ = require('underscore');\n\n// Use CodeMirror in Node for syntax highlighting, per\n// https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight\nCodeMirror = require('codemirror/addon/runmode/runmode.node.js');\n\nrequire('codemirror/mode/coffeescript/coffeescript.js');\n\nrequire('codemirror/mode/javascript/javascript.js');\n\nCoffeeScript = require('../../lib/coffeescript');\n\nmodule.exports = function() {\n return function(file, run = false) {\n var cs, highlight, include, js, output, render;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true // This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane.\n });\n render = _.template(fs.readFileSync('documentation/v2/code.html', 'utf-8'));\n include = function(file) {\n return fs.readFileSync(`documentation/v2/${file}`, 'utf-8');\n };\n highlight = function(language, code) {\n var accum, curStyle, esc, flush, html;\n // Adapted from https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight.\n html = '';\n curStyle = null;\n accum = '';\n esc = function(str) {\n return str.replace(/[<&]/g, function(ch) {\n if (ch === '&') {\n return '&';\n } else {\n return '<';\n }\n });\n };\n flush = function() {\n if (curStyle) {\n return html += `${esc(accum)}`;\n } else {\n return html += esc(accum);\n }\n };\n CodeMirror.runMode(code, {\n name: language\n }, function(text, style) {\n if (style !== curStyle) {\n flush();\n curStyle = style;\n return accum = text;\n } else {\n return accum += text;\n }\n });\n flush();\n return html;\n };\n return output = render({file, cs, js, highlight, include, run});\n };\n};\n```", "response": "fs = require 'fs'\n_ = require 'underscore'\n\n# Use CodeMirror in Node for syntax highlighting, per\n# https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight\nCodeMirror = require 'codemirror/addon/runmode/runmode.node.js'\nrequire 'codemirror/mode/coffeescript/coffeescript.js'\nrequire 'codemirror/mode/javascript/javascript.js'\n\nCoffeeScript = require '../../lib/coffeescript'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane.\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n include = (file) -> fs.readFileSync(\"documentation/v2/#{file}\", 'utf-8')\n\n highlight = (language, code) ->\n # Adapted from https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight.\n html = ''\n curStyle = null\n accum = ''\n\n esc = (str) ->\n str.replace /[<&]/g, (ch) ->\n if ch is '&' then '&' else '<'\n\n flush = ->\n if curStyle\n html += \"#{esc accum}\"\n else\n html += esc accum\n\n CodeMirror.runMode code, {name: language}, (text, style) ->\n if style isnt curStyle\n flush()\n curStyle = style\n accum = text\n else\n accum += text\n flush()\n\n html\n\n output = render {file, cs, js, highlight, include, run}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "63d3b699d7f28ba10e097e9dc3e8b57aca84b77a", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/code.coffee", "line_start": 1, "line_end": 47} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:completion", "type": "completion", "prompt": "fs = require 'fs'\n_ = require 'underscore'\n\n# Use CodeMirror in Node for syntax highlighting, per\n# https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight\nCodeMirror = require 'codemirror/addon/runmode/runmode.node.js'\nrequire 'codemirror/mode/coffeescript/coffeescript.js'\nrequire 'codemirror/mode/javascript/javascript.js'\n\nCoffeeScript = require '../../lib/coffeescript'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane.\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n include = (file) -> fs.readFileSync(\"documentation/v2/#{file}\", 'utf-8')\n\n highlight = (language, code) ->\n # Adapted from https://github.com/codemirror/CodeMirror/blob/master/bin/source-highlight.\n html = ''\n curStyle = null", "response": "accum = ''\n\n esc = (str) ->\n str.replace /[<&]/g, (ch) ->\n if ch is '&' then '&' else '<'\n\n flush = ->\n if curStyle\n html += \"#{esc accum}\"\n else\n html += esc accum\n\n CodeMirror.runMode code, {name: language}, (text, style) ->\n if style isnt curStyle\n flush()\n curStyle = style\n accum = text\n else\n accum += text\n flush()\n\n html\n\n output = render {file, cs, js, highlight, include, run}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "63d3b699d7f28ba10e097e9dc3e8b57aca84b77a", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/code.coffee", "line_start": 1, "line_end": 47} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffeescript'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "4cc701a9da0132efbb5c58c142cec0348443ec1d", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffeescript'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}\n```", "response": "var CoffeeScript, _, fs;\n\nfs = require('fs');\n\n_ = require('underscore');\n\nCoffeeScript = require('../../lib/coffeescript');\n\nmodule.exports = function() {\n return function(file, run = false) {\n var cs, js, output, render;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true // This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n });\n render = _.template(fs.readFileSync('documentation/v2/code.html', 'utf-8'));\n return output = render({file, cs, js, run});\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "4cc701a9da0132efbb5c58c142cec0348443ec1d", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CoffeeScript, _, fs;\n\nfs = require('fs');\n\n_ = require('underscore');\n\nCoffeeScript = require('../../lib/coffeescript');\n\nmodule.exports = function() {\n return function(file, run = false) {\n var cs, js, output, render;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true // This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n });\n render = _.template(fs.readFileSync('documentation/v2/code.html', 'utf-8'));\n return output = render({file, cs, js, run});\n };\n};\n```", "response": "fs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffeescript'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "4cc701a9da0132efbb5c58c142cec0348443ec1d", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:completion", "type": "completion", "prompt": "fs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffeescript'", "response": "module.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "4cc701a9da0132efbb5c58c142cec0348443ec1d", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffee-script'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "14382abc2d8786af128c06b1eb0a08af67836687", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/14382abc2d8786af128c06b1eb0a08af67836687/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffee-script'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}\n```", "response": "var CoffeeScript, _, fs;\n\nfs = require('fs');\n\n_ = require('underscore');\n\nCoffeeScript = require('../../lib/coffee-script');\n\nmodule.exports = function() {\n return function(file, run = false) {\n var cs, js, output, render;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true // This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n });\n render = _.template(fs.readFileSync('documentation/v2/code.html', 'utf-8'));\n return output = render({file, cs, js, run});\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "14382abc2d8786af128c06b1eb0a08af67836687", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/14382abc2d8786af128c06b1eb0a08af67836687/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CoffeeScript, _, fs;\n\nfs = require('fs');\n\n_ = require('underscore');\n\nCoffeeScript = require('../../lib/coffee-script');\n\nmodule.exports = function() {\n return function(file, run = false) {\n var cs, js, output, render;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true // This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n });\n render = _.template(fs.readFileSync('documentation/v2/code.html', 'utf-8'));\n return output = render({file, cs, js, run});\n };\n};\n```", "response": "fs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffee-script'\n\n\nmodule.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "14382abc2d8786af128c06b1eb0a08af67836687", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/14382abc2d8786af128c06b1eb0a08af67836687/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:completion", "type": "completion", "prompt": "fs = require 'fs'\n_ = require 'underscore'\nCoffeeScript = require '../../lib/coffee-script'", "response": "module.exports = ->\n (file, run = no) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes # This is just the initial JavaScript output; it is replaced by dynamic compilation on changes of the CoffeeScript pane\n render = _.template fs.readFileSync('documentation/v2/code.html', 'utf-8')\n output = render {file, cs, js, run}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "14382abc2d8786af128c06b1eb0a08af67836687", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/14382abc2d8786af128c06b1eb0a08af67836687/documentation/v2/code.coffee", "line_start": 1, "line_end": 11} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require 'fs'\nCoffeeScript = require '../../lib/coffee-script'\n\n\nmodule.exports = ->\n (file, executable = no, showLoad = yes) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes\n \"\"\"\n \n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "512b580820141b9466846f7722c89bea8fb8ede3", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/512b580820141b9466846f7722c89bea8fb8ede3/documentation/v2/code.coffee", "line_start": 1, "line_end": 20} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require 'fs'\nCoffeeScript = require '../../lib/coffee-script'\n\n\nmodule.exports = ->\n (file, executable = no, showLoad = yes) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes\n \"\"\"\n \n \"\"\"\n```", "response": "var CoffeeScript, fs;\n\nfs = require('fs');\n\nCoffeeScript = require('../../lib/coffee-script');\n\nmodule.exports = function() {\n return function(file, executable = false, showLoad = true) {\n var cs, js;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true\n });\n return ``;\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "512b580820141b9466846f7722c89bea8fb8ede3", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/512b580820141b9466846f7722c89bea8fb8ede3/documentation/v2/code.coffee", "line_start": 1, "line_end": 20} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CoffeeScript, fs;\n\nfs = require('fs');\n\nCoffeeScript = require('../../lib/coffee-script');\n\nmodule.exports = function() {\n return function(file, executable = false, showLoad = true) {\n var cs, js;\n cs = fs.readFileSync(`documentation/examples/${file}.coffee`, 'utf-8');\n js = CoffeeScript.compile(cs, {\n bare: true\n });\n return ``;\n };\n};\n```", "response": "fs = require 'fs'\nCoffeeScript = require '../../lib/coffee-script'\n\n\nmodule.exports = ->\n (file, executable = no, showLoad = yes) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes\n \"\"\"\n \n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "512b580820141b9466846f7722c89bea8fb8ede3", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/512b580820141b9466846f7722c89bea8fb8ede3/documentation/v2/code.coffee", "line_start": 1, "line_end": 20} +{"id": "jashkenas/coffeescript:documentation/v2/code.coffee:1:completion", "type": "completion", "prompt": "fs = require 'fs'\nCoffeeScript = require '../../lib/coffee-script'\n\n\nmodule.exports = ->\n (file, executable = no, showLoad = yes) ->\n cs = fs.readFileSync \"documentation/examples/#{file}.coffee\", 'utf-8'\n js = CoffeeScript.compile cs, bare: yes\n \"\"\"\n \n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "documentation/v2/code.coffee", "license": "MIT", "commit": "512b580820141b9466846f7722c89bea8fb8ede3", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/512b580820141b9466846f7722c89bea8fb8ede3/documentation/v2/code.coffee", "line_start": 1, "line_end": 20} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'\n dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'spec/vendor/sinon-1.7.3/sinon.js',\n 'bucky.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']", "source_lang": "", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/Gruntfile.coffee", "line_start": 1, "line_end": 41} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'\n dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'spec/vendor/sinon-1.7.3/sinon.js',\n 'bucky.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']\n```", "response": "module.exports = function(grunt) {\n grunt.initConfig({\n pkg: grunt.file.readJSON(\"package.json\"),\n coffee: {\n compile: {\n files: {\n 'bucky.js': 'bucky.coffee',\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n }\n }\n },\n watch: {\n coffee: {\n files: ['bucky.coffee', 'spec/bucky.spec.coffee'],\n tasks: [\"coffee\", \"uglify\"]\n }\n },\n uglify: {\n options: {\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n },\n dist: {\n src: 'bucky.js',\n dest: 'bucky.min.js'\n }\n },\n jasmine: {\n options: {\n specs: ['spec/bucky.spec.js']\n },\n src: ['spec/vendor/jquery-1.10.2/jquery.js', 'spec/vendor/underscore-1.5.2/underscore.js', 'spec/vendor/backbone-1.0.0/backbone.js', 'spec/vendor/sinon-1.7.3/sinon.js', 'bucky.js']\n }\n });\n grunt.loadNpmTasks('grunt-contrib-watch');\n grunt.loadNpmTasks('grunt-contrib-uglify');\n grunt.loadNpmTasks('grunt-contrib-coffee');\n grunt.loadNpmTasks('grunt-contrib-jasmine');\n grunt.registerTask('default', ['coffee', 'uglify']);\n grunt.registerTask('build', ['coffee', 'uglify', 'jasmine']);\n return grunt.registerTask('test', ['coffee', 'uglify', 'jasmine']);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/Gruntfile.coffee", "line_start": 1, "line_end": 41} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function(grunt) {\n grunt.initConfig({\n pkg: grunt.file.readJSON(\"package.json\"),\n coffee: {\n compile: {\n files: {\n 'bucky.js': 'bucky.coffee',\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n }\n }\n },\n watch: {\n coffee: {\n files: ['bucky.coffee', 'spec/bucky.spec.coffee'],\n tasks: [\"coffee\", \"uglify\"]\n }\n },\n uglify: {\n options: {\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n },\n dist: {\n src: 'bucky.js',\n dest: 'bucky.min.js'\n }\n },\n jasmine: {\n options: {\n specs: ['spec/bucky.spec.js']\n },\n src: ['spec/vendor/jquery-1.10.2/jquery.js', 'spec/vendor/underscore-1.5.2/underscore.js', 'spec/vendor/backbone-1.0.0/backbone.js', 'spec/vendor/sinon-1.7.3/sinon.js', 'bucky.js']\n }\n });\n grunt.loadNpmTasks('grunt-contrib-watch');\n grunt.loadNpmTasks('grunt-contrib-uglify');\n grunt.loadNpmTasks('grunt-contrib-coffee');\n grunt.loadNpmTasks('grunt-contrib-jasmine');\n grunt.registerTask('default', ['coffee', 'uglify']);\n grunt.registerTask('build', ['coffee', 'uglify', 'jasmine']);\n return grunt.registerTask('test', ['coffee', 'uglify', 'jasmine']);\n};\n```", "response": "module.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'\n dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'spec/vendor/sinon-1.7.3/sinon.js',\n 'bucky.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/Gruntfile.coffee", "line_start": 1, "line_end": 41} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:completion", "type": "completion", "prompt": "module.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'", "response": "dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'spec/vendor/sinon-1.7.3/sinon.js',\n 'bucky.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/646ab9ebcbcaaab4e68c7fcbf66e109dd418b3b3/Gruntfile.coffee", "line_start": 1, "line_end": 41} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'\n dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'mixen.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']", "source_lang": "", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "72021f1c4c29a0ca0f815263561bcca7e7a18fe6", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/72021f1c4c29a0ca0f815263561bcca7e7a18fe6/Gruntfile.coffee", "line_start": 1, "line_end": 40} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'\n dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'mixen.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']\n```", "response": "module.exports = function(grunt) {\n grunt.initConfig({\n pkg: grunt.file.readJSON(\"package.json\"),\n coffee: {\n compile: {\n files: {\n 'bucky.js': 'bucky.coffee',\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n }\n }\n },\n watch: {\n coffee: {\n files: ['bucky.coffee', 'spec/bucky.spec.coffee'],\n tasks: [\"coffee\", \"uglify\"]\n }\n },\n uglify: {\n options: {\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n },\n dist: {\n src: 'bucky.js',\n dest: 'bucky.min.js'\n }\n },\n jasmine: {\n options: {\n specs: ['spec/bucky.spec.js']\n },\n src: ['spec/vendor/jquery-1.10.2/jquery.js', 'spec/vendor/underscore-1.5.2/underscore.js', 'spec/vendor/backbone-1.0.0/backbone.js', 'mixen.js']\n }\n });\n grunt.loadNpmTasks('grunt-contrib-watch');\n grunt.loadNpmTasks('grunt-contrib-uglify');\n grunt.loadNpmTasks('grunt-contrib-coffee');\n grunt.loadNpmTasks('grunt-contrib-jasmine');\n grunt.registerTask('default', ['coffee', 'uglify']);\n grunt.registerTask('build', ['coffee', 'uglify', 'jasmine']);\n return grunt.registerTask('test', ['coffee', 'uglify', 'jasmine']);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "72021f1c4c29a0ca0f815263561bcca7e7a18fe6", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/72021f1c4c29a0ca0f815263561bcca7e7a18fe6/Gruntfile.coffee", "line_start": 1, "line_end": 40} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function(grunt) {\n grunt.initConfig({\n pkg: grunt.file.readJSON(\"package.json\"),\n coffee: {\n compile: {\n files: {\n 'bucky.js': 'bucky.coffee',\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n }\n }\n },\n watch: {\n coffee: {\n files: ['bucky.coffee', 'spec/bucky.spec.coffee'],\n tasks: [\"coffee\", \"uglify\"]\n }\n },\n uglify: {\n options: {\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n },\n dist: {\n src: 'bucky.js',\n dest: 'bucky.min.js'\n }\n },\n jasmine: {\n options: {\n specs: ['spec/bucky.spec.js']\n },\n src: ['spec/vendor/jquery-1.10.2/jquery.js', 'spec/vendor/underscore-1.5.2/underscore.js', 'spec/vendor/backbone-1.0.0/backbone.js', 'mixen.js']\n }\n });\n grunt.loadNpmTasks('grunt-contrib-watch');\n grunt.loadNpmTasks('grunt-contrib-uglify');\n grunt.loadNpmTasks('grunt-contrib-coffee');\n grunt.loadNpmTasks('grunt-contrib-jasmine');\n grunt.registerTask('default', ['coffee', 'uglify']);\n grunt.registerTask('build', ['coffee', 'uglify', 'jasmine']);\n return grunt.registerTask('test', ['coffee', 'uglify', 'jasmine']);\n};\n```", "response": "module.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'\n dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'mixen.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "72021f1c4c29a0ca0f815263561bcca7e7a18fe6", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/72021f1c4c29a0ca0f815263561bcca7e7a18fe6/Gruntfile.coffee", "line_start": 1, "line_end": 40} +{"id": "HubSpot/BuckyClient:Gruntfile.coffee:1:completion", "type": "completion", "prompt": "module.exports = (grunt) ->\n grunt.initConfig\n pkg: grunt.file.readJSON(\"package.json\")\n coffee:\n compile:\n files:\n 'bucky.js': 'bucky.coffee'\n 'spec/bucky.spec.js': 'spec/bucky.spec.coffee'\n\n watch:\n coffee:\n files: ['bucky.coffee', 'spec/bucky.spec.coffee']\n tasks: [\"coffee\", \"uglify\"]\n\n uglify:\n options:\n banner: \"/*! <%= pkg.name %> <%= pkg.version %> */\\n\"\n\n dist:\n src: 'bucky.js'", "response": "dest: 'bucky.min.js'\n\n jasmine:\n options:\n specs: ['spec/bucky.spec.js']\n src: [\n 'spec/vendor/jquery-1.10.2/jquery.js',\n 'spec/vendor/underscore-1.5.2/underscore.js',\n 'spec/vendor/backbone-1.0.0/backbone.js',\n 'mixen.js'\n ]\n\n grunt.loadNpmTasks 'grunt-contrib-watch'\n grunt.loadNpmTasks 'grunt-contrib-uglify'\n grunt.loadNpmTasks 'grunt-contrib-coffee'\n grunt.loadNpmTasks 'grunt-contrib-jasmine'\n\n grunt.registerTask 'default', ['coffee', 'uglify']\n grunt.registerTask 'build', ['coffee', 'uglify', 'jasmine']\n grunt.registerTask 'test', ['coffee', 'uglify', 'jasmine']", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "Gruntfile.coffee", "license": "MIT", "commit": "72021f1c4c29a0ca0f815263561bcca7e7a18fe6", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/72021f1c4c29a0ca0f815263561bcca7e7a18fe6/Gruntfile.coffee", "line_start": 1, "line_end": 40} +{"id": "buttercoin/buttercoin:lib/datastore/supermarket.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Market = require('./market')\n\nmodule.exports = class SuperMarket\n constructor: ->\n @markets = Object.create null\n\n get_market: (offered_currency, received_currency) =>\n\n if offered_currency == received_currency\n throw Error(\"Currencies the same\")\n\n if offered_currency < received_currency\n canonical_pair = [offered_currency, received_currency]\n else\n canonical_pair = [received_currency, offered_currency]\n\n canonical_pair_string = canonical_pair.join('|') # XXX: no | in name\n\n market = @markets[canonical_pair_string]\n if not (market instanceof Market)\n @markets[canonical_pair_string] = market = new Market( canonical_pair[0], canonical_pair[1] )\n return market", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/datastore/supermarket.coffee", "license": "MIT", "commit": "1ec26da453ab2accbc8ba8e4948f3f8a549ad979", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/1ec26da453ab2accbc8ba8e4948f3f8a549ad979/lib/datastore/supermarket.coffee", "line_start": 1, "line_end": 22} +{"id": "buttercoin/buttercoin:lib/datastore/supermarket.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nMarket = require('./market')\n\nmodule.exports = class SuperMarket\n constructor: ->\n @markets = Object.create null\n\n get_market: (offered_currency, received_currency) =>\n\n if offered_currency == received_currency\n throw Error(\"Currencies the same\")\n\n if offered_currency < received_currency\n canonical_pair = [offered_currency, received_currency]\n else\n canonical_pair = [received_currency, offered_currency]\n\n canonical_pair_string = canonical_pair.join('|') # XXX: no | in name\n\n market = @markets[canonical_pair_string]\n if not (market instanceof Market)\n @markets[canonical_pair_string] = market = new Market( canonical_pair[0], canonical_pair[1] )\n return market\n```", "response": "var Market, SuperMarket;\n\nMarket = require('./market');\n\nmodule.exports = SuperMarket = class SuperMarket {\n constructor() {\n this.get_market = this.get_market.bind(this);\n this.markets = Object.create(null);\n }\n\n get_market(offered_currency, received_currency) {\n var canonical_pair, canonical_pair_string, market;\n if (offered_currency === received_currency) {\n throw Error(\"Currencies the same\");\n }\n if (offered_currency < received_currency) {\n canonical_pair = [offered_currency, received_currency];\n } else {\n canonical_pair = [received_currency, offered_currency];\n }\n canonical_pair_string = canonical_pair.join('|'); // XXX: no | in name\n market = this.markets[canonical_pair_string];\n if (!(market instanceof Market)) {\n this.markets[canonical_pair_string] = market = new Market(canonical_pair[0], canonical_pair[1]);\n }\n return market;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "lib/datastore/supermarket.coffee", "license": "MIT", "commit": "1ec26da453ab2accbc8ba8e4948f3f8a549ad979", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/1ec26da453ab2accbc8ba8e4948f3f8a549ad979/lib/datastore/supermarket.coffee", "line_start": 1, "line_end": 22} +{"id": "buttercoin/buttercoin:lib/datastore/supermarket.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Market, SuperMarket;\n\nMarket = require('./market');\n\nmodule.exports = SuperMarket = class SuperMarket {\n constructor() {\n this.get_market = this.get_market.bind(this);\n this.markets = Object.create(null);\n }\n\n get_market(offered_currency, received_currency) {\n var canonical_pair, canonical_pair_string, market;\n if (offered_currency === received_currency) {\n throw Error(\"Currencies the same\");\n }\n if (offered_currency < received_currency) {\n canonical_pair = [offered_currency, received_currency];\n } else {\n canonical_pair = [received_currency, offered_currency];\n }\n canonical_pair_string = canonical_pair.join('|'); // XXX: no | in name\n market = this.markets[canonical_pair_string];\n if (!(market instanceof Market)) {\n this.markets[canonical_pair_string] = market = new Market(canonical_pair[0], canonical_pair[1]);\n }\n return market;\n }\n\n};\n```", "response": "Market = require('./market')\n\nmodule.exports = class SuperMarket\n constructor: ->\n @markets = Object.create null\n\n get_market: (offered_currency, received_currency) =>\n\n if offered_currency == received_currency\n throw Error(\"Currencies the same\")\n\n if offered_currency < received_currency\n canonical_pair = [offered_currency, received_currency]\n else\n canonical_pair = [received_currency, offered_currency]\n\n canonical_pair_string = canonical_pair.join('|') # XXX: no | in name\n\n market = @markets[canonical_pair_string]\n if not (market instanceof Market)\n @markets[canonical_pair_string] = market = new Market( canonical_pair[0], canonical_pair[1] )\n return market", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/datastore/supermarket.coffee", "license": "MIT", "commit": "1ec26da453ab2accbc8ba8e4948f3f8a549ad979", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/1ec26da453ab2accbc8ba8e4948f3f8a549ad979/lib/datastore/supermarket.coffee", "line_start": 1, "line_end": 22} +{"id": "buttercoin/buttercoin:lib/datastore/supermarket.coffee:1:completion", "type": "completion", "prompt": "Market = require('./market')\n\nmodule.exports = class SuperMarket\n constructor: ->\n @markets = Object.create null\n\n get_market: (offered_currency, received_currency) =>\n\n if offered_currency == received_currency\n throw Error(\"Currencies the same\")", "response": "if offered_currency < received_currency\n canonical_pair = [offered_currency, received_currency]\n else\n canonical_pair = [received_currency, offered_currency]\n\n canonical_pair_string = canonical_pair.join('|') # XXX: no | in name\n\n market = @markets[canonical_pair_string]\n if not (market instanceof Market)\n @markets[canonical_pair_string] = market = new Market( canonical_pair[0], canonical_pair[1] )\n return market", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/datastore/supermarket.coffee", "license": "MIT", "commit": "1ec26da453ab2accbc8ba8e4948f3f8a549ad979", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/1ec26da453ab2accbc8ba8e4948f3f8a549ad979/lib/datastore/supermarket.coffee", "line_start": 1, "line_end": 22} +{"id": "js2coffee/js2coffee:lib/transforms/empty_statements.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "TransformerBase = require('./base')\n\n###\n# Remove `{type: 'EmptyStatement'}` from the body.\n###\n\nmodule.exports = class extends TransformerBase\n BlockStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node)\n\n SwitchCaseExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'consequent')\n\n SwitchStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'cases')\n\n ProgramExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'body')\n\n removeEmptyStatementsFromBody: (node, body = 'body') ->\n node[body] = node[body].filter (n) ->\n n.type isnt 'EmptyStatement'\n node", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/empty_statements.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/empty_statements.coffee", "line_start": 1, "line_end": 23} +{"id": "js2coffee/js2coffee:lib/transforms/empty_statements.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTransformerBase = require('./base')\n\n###\n# Remove `{type: 'EmptyStatement'}` from the body.\n###\n\nmodule.exports = class extends TransformerBase\n BlockStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node)\n\n SwitchCaseExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'consequent')\n\n SwitchStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'cases')\n\n ProgramExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'body')\n\n removeEmptyStatementsFromBody: (node, body = 'body') ->\n node[body] = node[body].filter (n) ->\n n.type isnt 'EmptyStatement'\n node\n```", "response": "var TransformerBase;\n\nTransformerBase = require('./base');\n\n/*\n * Remove `{type: 'EmptyStatement'}` from the body.\n */\nmodule.exports = class extends TransformerBase {\n BlockStatementExit(node) {\n return this.removeEmptyStatementsFromBody(node);\n }\n\n SwitchCaseExit(node) {\n return this.removeEmptyStatementsFromBody(node, 'consequent');\n }\n\n SwitchStatementExit(node) {\n return this.removeEmptyStatementsFromBody(node, 'cases');\n }\n\n ProgramExit(node) {\n return this.removeEmptyStatementsFromBody(node, 'body');\n }\n\n removeEmptyStatementsFromBody(node, body = 'body') {\n node[body] = node[body].filter(function(n) {\n return n.type !== 'EmptyStatement';\n });\n return node;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/empty_statements.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/empty_statements.coffee", "line_start": 1, "line_end": 23} +{"id": "js2coffee/js2coffee:lib/transforms/empty_statements.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar TransformerBase;\n\nTransformerBase = require('./base');\n\n/*\n * Remove `{type: 'EmptyStatement'}` from the body.\n */\nmodule.exports = class extends TransformerBase {\n BlockStatementExit(node) {\n return this.removeEmptyStatementsFromBody(node);\n }\n\n SwitchCaseExit(node) {\n return this.removeEmptyStatementsFromBody(node, 'consequent');\n }\n\n SwitchStatementExit(node) {\n return this.removeEmptyStatementsFromBody(node, 'cases');\n }\n\n ProgramExit(node) {\n return this.removeEmptyStatementsFromBody(node, 'body');\n }\n\n removeEmptyStatementsFromBody(node, body = 'body') {\n node[body] = node[body].filter(function(n) {\n return n.type !== 'EmptyStatement';\n });\n return node;\n }\n\n};\n```", "response": "TransformerBase = require('./base')\n\n###\n# Remove `{type: 'EmptyStatement'}` from the body.\n###\n\nmodule.exports = class extends TransformerBase\n BlockStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node)\n\n SwitchCaseExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'consequent')\n\n SwitchStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'cases')\n\n ProgramExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'body')\n\n removeEmptyStatementsFromBody: (node, body = 'body') ->\n node[body] = node[body].filter (n) ->\n n.type isnt 'EmptyStatement'\n node", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/empty_statements.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/empty_statements.coffee", "line_start": 1, "line_end": 23} +{"id": "js2coffee/js2coffee:lib/transforms/empty_statements.coffee:1:completion", "type": "completion", "prompt": "TransformerBase = require('./base')\n\n###\n# Remove `{type: 'EmptyStatement'}` from the body.\n###\n\nmodule.exports = class extends TransformerBase\n BlockStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node)\n\n SwitchCaseExit: (node) ->", "response": "@removeEmptyStatementsFromBody(node, 'consequent')\n\n SwitchStatementExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'cases')\n\n ProgramExit: (node) ->\n @removeEmptyStatementsFromBody(node, 'body')\n\n removeEmptyStatementsFromBody: (node, body = 'body') ->\n node[body] = node[body].filter (n) ->\n n.type isnt 'EmptyStatement'\n node", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/empty_statements.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/empty_statements.coffee", "line_start": 1, "line_end": 23} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "NodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n\n\n isEqualNode: (node) ->\n if not super.isEqualNode(node) then return false\n if node.target isnt @target then return false\n\n return true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nNodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n\n\n isEqualNode: (node) ->\n if not super.isEqualNode(node) then return false\n if node.target isnt @target then return false\n\n return true\n```", "response": "var NodeType, XMLCharacterData, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLCharacterData = require('./XMLCharacterData');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLCharacterData {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n isEqualNode(node) {\n if (!super.isEqualNode(node)) {\n return false;\n }\n if (node.target !== this.target) {\n return false;\n }\n return true;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar NodeType, XMLCharacterData, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLCharacterData = require('./XMLCharacterData');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLCharacterData {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n isEqualNode(node) {\n if (!super.isEqualNode(node)) {\n return false;\n }\n if (node.target !== this.target) {\n return false;\n }\n return true;\n }\n\n};\n```", "response": "NodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n\n\n isEqualNode: (node) ->\n if not super.isEqualNode(node) then return false\n if node.target isnt @target then return false\n\n return true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "NodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value", "response": "# Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n\n\n isEqualNode: (node) ->\n if not super.isEqualNode(node) then return false\n if node.target isnt @target then return false\n\n return true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "NodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "731c0e0c4226598187e6577969b815a22663d695", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/731c0e0c4226598187e6577969b815a22663d695/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nNodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n```", "response": "var NodeType, XMLCharacterData, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLCharacterData = require('./XMLCharacterData');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLCharacterData {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "731c0e0c4226598187e6577969b815a22663d695", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/731c0e0c4226598187e6577969b815a22663d695/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar NodeType, XMLCharacterData, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLCharacterData = require('./XMLCharacterData');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLCharacterData {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};\n```", "response": "NodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "731c0e0c4226598187e6577969b815a22663d695", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/731c0e0c4226598187e6577969b815a22663d695/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "NodeType = require './NodeType'\nXMLCharacterData = require './XMLCharacterData'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLCharacterData\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()", "response": "@type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "731c0e0c4226598187e6577969b815a22663d695", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/731c0e0c4226598187e6577969b815a22663d695/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "NodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @::, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nNodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @::, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n```", "response": "var NodeType, XMLNode, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = (function() {\n class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n };\n\n // DOM level 1\n Object.defineProperty(XMLProcessingInstruction.prototype, 'data', {\n get: function() {\n return this.value;\n }\n });\n\n return XMLProcessingInstruction;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar NodeType, XMLNode, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = (function() {\n class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n };\n\n // DOM level 1\n Object.defineProperty(XMLProcessingInstruction.prototype, 'data', {\n get: function() {\n return this.value;\n }\n });\n\n return XMLProcessingInstruction;\n\n}).call(this);\n```", "response": "NodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @::, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "NodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target", "response": "@name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @::, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "NodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nNodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n```", "response": "var NodeType, XMLNode, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n // DOM level 1\n Object.defineProperty(this, 'data', {\n get: function() {\n return this.value;\n }\n });\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar NodeType, XMLNode, XMLProcessingInstruction;\n\nNodeType = require('./NodeType');\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n // DOM level 1\n Object.defineProperty(this, 'data', {\n get: function() {\n return this.value;\n }\n });\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};\n```", "response": "NodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "NodeType = require './NodeType'\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target", "response": "@name = @target\n @value = @stringify.insValue value if value\n\n # DOM level 1\n Object.defineProperty @, 'data', get: () -> @value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 40} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "XMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nXMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n```", "response": "var NodeType, XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\nNodeType = require('./NodeType');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar NodeType, XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\nNodeType = require('./NodeType');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n this.name = this.target;\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};\n```", "response": "XMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "XMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()", "response": "@type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @name = @target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 37} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "XMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 36} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nXMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n```", "response": "var NodeType, XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\nNodeType = require('./NodeType');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 36} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar NodeType, XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\nNodeType = require('./NodeType');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.type = NodeType.ProcessingInstruction;\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};\n```", "response": "XMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 36} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "XMLNode = require './XMLNode'\nNodeType = require './NodeType'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()", "response": "@type = NodeType.ProcessingInstruction\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 36} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "XMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)\n```", "response": "var XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));\n }\n\n};\n```", "response": "XMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "XMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()", "response": "@target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.processingInstruction @, @options.writer.filterOptions(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "XMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).processingInstruction @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nXMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).processingInstruction @\n```", "response": "var XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.set(options).processingInstruction(this);\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLNode, XMLProcessingInstruction;\n\nXMLNode = require('./XMLNode');\n\n// Represents a processing instruction\nmodule.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLNode {\n // Initializes a new instance of `XMLProcessingInstruction`\n\n // `parent` the parent node\n // `target` instruction target\n // `value` instruction value\n constructor(parent, target, value) {\n super(parent);\n if (target == null) {\n throw new Error(\"Missing instruction target. \" + this.debugInfo());\n }\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n // Creates and returns a deep clone of `this`\n clone() {\n return Object.create(this);\n }\n\n // Converts the XML fragment to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString(options) {\n return this.options.writer.set(options).processingInstruction(this);\n }\n\n};\n```", "response": "XMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()\n\n @target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).processingInstruction @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:src/XMLProcessingInstruction.coffee:1:completion", "type": "completion", "prompt": "XMLNode = require './XMLNode'\n\n# Represents a processing instruction\nmodule.exports = class XMLProcessingInstruction extends XMLNode\n\n\n # Initializes a new instance of `XMLProcessingInstruction`\n #\n # `parent` the parent node\n # `target` instruction target\n # `value` instruction value\n constructor: (parent, target, value) ->\n super parent\n\n if not target?\n throw new Error \"Missing instruction target. \" + @debugInfo()", "response": "@target = @stringify.insTarget target\n @value = @stringify.insValue value if value\n\n\n # Creates and returns a deep clone of `this`\n clone: () ->\n Object.create @\n\n\n # Converts the XML fragment to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).processingInstruction @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLProcessingInstruction.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLProcessingInstruction.coffee", "line_start": 1, "line_end": 34} +{"id": "jeremyramin/terminal-plus:lib/fork.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "pty = require 'pty.js'\npath = require 'path'\nfs = require 'fs'\n_ = require 'underscore'\n\nsystemLanguage = do ->\n language = \"en_US.UTF-8\"\n if process.platform is 'darwin'\n try\n command = 'plutil -convert json -o - ~/Library/Preferences/.GlobalPreferences.plist'\n language = \"#{JSON.parse(child.execSync(command).toString()).AppleLocale}.UTF-8\"\n return language\n\nfilteredEnvironment = do ->\n env = _.omit process.env, 'ATOM_HOME', 'ATOM_SHELL_INTERNAL_RUN_AS_NODE', 'GOOGLE_API_KEY', 'NODE_ENV', 'NODE_PATH', 'userAgent', 'taskPath'\n env.LANG ?= systemLanguage\n env.TERM_PROGRAM = 'Terminal-Plus'\n return env\n\nmodule.exports = (pwd, shellPath, args) ->\n callback = @async()\n\n ptyProcess = pty.fork shellPath, args,\n cwd: pwd,\n env: filteredEnvironment,\n name: 'xterm-256color'\n\n title = shell = path.basename shellPath\n\n emitTitle = _.throttle ->\n emit('terminal-plus:title', ptyProcess.process)\n , 500, true\n\n ptyProcess.on 'data', (data) ->\n emit('terminal-plus:data', data)\n emitTitle()\n\n ptyProcess.on 'exit', ->\n emit('terminal-plus:exit')\n callback()\n\n process.on 'message', ({event, cols, rows, text}={}) ->\n switch event\n when 'resize' then ptyProcess.resize(cols, rows)\n when 'input' then ptyProcess.write(text)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jeremyramin/terminal-plus", "path": "lib/fork.coffee", "license": "MIT", "commit": "1e555ee3a49902b203134072ff079ae580fdff10", "stars": 478, "source_url": "https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/fork.coffee", "line_start": 1, "line_end": 45} +{"id": "jeremyramin/terminal-plus:lib/fork.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npty = require 'pty.js'\npath = require 'path'\nfs = require 'fs'\n_ = require 'underscore'\n\nsystemLanguage = do ->\n language = \"en_US.UTF-8\"\n if process.platform is 'darwin'\n try\n command = 'plutil -convert json -o - ~/Library/Preferences/.GlobalPreferences.plist'\n language = \"#{JSON.parse(child.execSync(command).toString()).AppleLocale}.UTF-8\"\n return language\n\nfilteredEnvironment = do ->\n env = _.omit process.env, 'ATOM_HOME', 'ATOM_SHELL_INTERNAL_RUN_AS_NODE', 'GOOGLE_API_KEY', 'NODE_ENV', 'NODE_PATH', 'userAgent', 'taskPath'\n env.LANG ?= systemLanguage\n env.TERM_PROGRAM = 'Terminal-Plus'\n return env\n\nmodule.exports = (pwd, shellPath, args) ->\n callback = @async()\n\n ptyProcess = pty.fork shellPath, args,\n cwd: pwd,\n env: filteredEnvironment,\n name: 'xterm-256color'\n\n title = shell = path.basename shellPath\n\n emitTitle = _.throttle ->\n emit('terminal-plus:title', ptyProcess.process)\n , 500, true\n\n ptyProcess.on 'data', (data) ->\n emit('terminal-plus:data', data)\n emitTitle()\n\n ptyProcess.on 'exit', ->\n emit('terminal-plus:exit')\n callback()\n\n process.on 'message', ({event, cols, rows, text}={}) ->\n switch event\n when 'resize' then ptyProcess.resize(cols, rows)\n when 'input' then ptyProcess.write(text)\n```", "response": "var _, filteredEnvironment, fs, path, pty, systemLanguage;\n\npty = require('pty.js');\n\npath = require('path');\n\nfs = require('fs');\n\n_ = require('underscore');\n\nsystemLanguage = (function() {\n var command, language;\n language = \"en_US.UTF-8\";\n if (process.platform === 'darwin') {\n try {\n command = 'plutil -convert json -o - ~/Library/Preferences/.GlobalPreferences.plist';\n language = `${JSON.parse(child.execSync(command).toString()).AppleLocale}.UTF-8`;\n } catch (error) {}\n }\n return language;\n})();\n\nfilteredEnvironment = (function() {\n var env;\n env = _.omit(process.env, 'ATOM_HOME', 'ATOM_SHELL_INTERNAL_RUN_AS_NODE', 'GOOGLE_API_KEY', 'NODE_ENV', 'NODE_PATH', 'userAgent', 'taskPath');\n if (env.LANG == null) {\n env.LANG = systemLanguage;\n }\n env.TERM_PROGRAM = 'Terminal-Plus';\n return env;\n})();\n\nmodule.exports = function(pwd, shellPath, args) {\n var callback, emitTitle, ptyProcess, shell, title;\n callback = this.async();\n ptyProcess = pty.fork(shellPath, args, {\n cwd: pwd,\n env: filteredEnvironment,\n name: 'xterm-256color'\n });\n title = shell = path.basename(shellPath);\n emitTitle = _.throttle(function() {\n return emit('terminal-plus:title', ptyProcess.process);\n }, 500, true);\n ptyProcess.on('data', function(data) {\n emit('terminal-plus:data', data);\n return emitTitle();\n });\n ptyProcess.on('exit', function() {\n emit('terminal-plus:exit');\n return callback();\n });\n return process.on('message', function({event, cols, rows, text} = {}) {\n switch (event) {\n case 'resize':\n return ptyProcess.resize(cols, rows);\n case 'input':\n return ptyProcess.write(text);\n }\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jeremyramin/terminal-plus", "path": "lib/fork.coffee", "license": "MIT", "commit": "1e555ee3a49902b203134072ff079ae580fdff10", "stars": 478, "source_url": "https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/fork.coffee", "line_start": 1, "line_end": 45} +{"id": "jeremyramin/terminal-plus:lib/fork.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _, filteredEnvironment, fs, path, pty, systemLanguage;\n\npty = require('pty.js');\n\npath = require('path');\n\nfs = require('fs');\n\n_ = require('underscore');\n\nsystemLanguage = (function() {\n var command, language;\n language = \"en_US.UTF-8\";\n if (process.platform === 'darwin') {\n try {\n command = 'plutil -convert json -o - ~/Library/Preferences/.GlobalPreferences.plist';\n language = `${JSON.parse(child.execSync(command).toString()).AppleLocale}.UTF-8`;\n } catch (error) {}\n }\n return language;\n})();\n\nfilteredEnvironment = (function() {\n var env;\n env = _.omit(process.env, 'ATOM_HOME', 'ATOM_SHELL_INTERNAL_RUN_AS_NODE', 'GOOGLE_API_KEY', 'NODE_ENV', 'NODE_PATH', 'userAgent', 'taskPath');\n if (env.LANG == null) {\n env.LANG = systemLanguage;\n }\n env.TERM_PROGRAM = 'Terminal-Plus';\n return env;\n})();\n\nmodule.exports = function(pwd, shellPath, args) {\n var callback, emitTitle, ptyProcess, shell, title;\n callback = this.async();\n ptyProcess = pty.fork(shellPath, args, {\n cwd: pwd,\n env: filteredEnvironment,\n name: 'xterm-256color'\n });\n title = shell = path.basename(shellPath);\n emitTitle = _.throttle(function() {\n return emit('terminal-plus:title', ptyProcess.process);\n }, 500, true);\n ptyProcess.on('data', function(data) {\n emit('terminal-plus:data', data);\n return emitTitle();\n });\n ptyProcess.on('exit', function() {\n emit('terminal-plus:exit');\n return callback();\n });\n return process.on('message', function({event, cols, rows, text} = {}) {\n switch (event) {\n case 'resize':\n return ptyProcess.resize(cols, rows);\n case 'input':\n return ptyProcess.write(text);\n }\n });\n};\n```", "response": "pty = require 'pty.js'\npath = require 'path'\nfs = require 'fs'\n_ = require 'underscore'\n\nsystemLanguage = do ->\n language = \"en_US.UTF-8\"\n if process.platform is 'darwin'\n try\n command = 'plutil -convert json -o - ~/Library/Preferences/.GlobalPreferences.plist'\n language = \"#{JSON.parse(child.execSync(command).toString()).AppleLocale}.UTF-8\"\n return language\n\nfilteredEnvironment = do ->\n env = _.omit process.env, 'ATOM_HOME', 'ATOM_SHELL_INTERNAL_RUN_AS_NODE', 'GOOGLE_API_KEY', 'NODE_ENV', 'NODE_PATH', 'userAgent', 'taskPath'\n env.LANG ?= systemLanguage\n env.TERM_PROGRAM = 'Terminal-Plus'\n return env\n\nmodule.exports = (pwd, shellPath, args) ->\n callback = @async()\n\n ptyProcess = pty.fork shellPath, args,\n cwd: pwd,\n env: filteredEnvironment,\n name: 'xterm-256color'\n\n title = shell = path.basename shellPath\n\n emitTitle = _.throttle ->\n emit('terminal-plus:title', ptyProcess.process)\n , 500, true\n\n ptyProcess.on 'data', (data) ->\n emit('terminal-plus:data', data)\n emitTitle()\n\n ptyProcess.on 'exit', ->\n emit('terminal-plus:exit')\n callback()\n\n process.on 'message', ({event, cols, rows, text}={}) ->\n switch event\n when 'resize' then ptyProcess.resize(cols, rows)\n when 'input' then ptyProcess.write(text)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jeremyramin/terminal-plus", "path": "lib/fork.coffee", "license": "MIT", "commit": "1e555ee3a49902b203134072ff079ae580fdff10", "stars": 478, "source_url": "https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/fork.coffee", "line_start": 1, "line_end": 45} +{"id": "jeremyramin/terminal-plus:lib/fork.coffee:1:completion", "type": "completion", "prompt": "pty = require 'pty.js'\npath = require 'path'\nfs = require 'fs'\n_ = require 'underscore'\n\nsystemLanguage = do ->\n language = \"en_US.UTF-8\"\n if process.platform is 'darwin'\n try\n command = 'plutil -convert json -o - ~/Library/Preferences/.GlobalPreferences.plist'\n language = \"#{JSON.parse(child.execSync(command).toString()).AppleLocale}.UTF-8\"\n return language\n\nfilteredEnvironment = do ->\n env = _.omit process.env, 'ATOM_HOME', 'ATOM_SHELL_INTERNAL_RUN_AS_NODE', 'GOOGLE_API_KEY', 'NODE_ENV', 'NODE_PATH', 'userAgent', 'taskPath'\n env.LANG ?= systemLanguage\n env.TERM_PROGRAM = 'Terminal-Plus'\n return env\n\nmodule.exports = (pwd, shellPath, args) ->\n callback = @async()", "response": "ptyProcess = pty.fork shellPath, args,\n cwd: pwd,\n env: filteredEnvironment,\n name: 'xterm-256color'\n\n title = shell = path.basename shellPath\n\n emitTitle = _.throttle ->\n emit('terminal-plus:title', ptyProcess.process)\n , 500, true\n\n ptyProcess.on 'data', (data) ->\n emit('terminal-plus:data', data)\n emitTitle()\n\n ptyProcess.on 'exit', ->\n emit('terminal-plus:exit')\n callback()\n\n process.on 'message', ({event, cols, rows, text}={}) ->\n switch event\n when 'resize' then ptyProcess.resize(cols, rows)\n when 'input' then ptyProcess.write(text)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jeremyramin/terminal-plus", "path": "lib/fork.coffee", "license": "MIT", "commit": "1e555ee3a49902b203134072ff079ae580fdff10", "stars": 478, "source_url": "https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/lib/fork.coffee", "line_start": 1, "line_end": 45} +{"id": "mojotech/pioneer:src/support/Factory.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = ->\n World = @\n @Factories = {}\n\n class @Factory\n @create: (attributes = {}) ->\n @_execute =>\n World.logger.silence =>\n @_defer(@_getCreator(), @_getDefaults())\n\n @_getCreator: ->\n @creator.call(World)\n\n @_getDefaults: ->\n return @defaults unless _.isFunction(@defaults)\n @defaults()\n\n @_defer: (callback, args...) ->\n deferred = $.defer()\n\n callback.call World, args..., (error, rest...) ->\n if error\n defered.reject error\n else\n deferred.fulfill rest...\n return deferred.promise\n\n @_execute: (job) ->\n $.controlFlow().execute job", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Factory.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Factory.coffee", "line_start": 1, "line_end": 29} +{"id": "mojotech/pioneer:src/support/Factory.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = ->\n World = @\n @Factories = {}\n\n class @Factory\n @create: (attributes = {}) ->\n @_execute =>\n World.logger.silence =>\n @_defer(@_getCreator(), @_getDefaults())\n\n @_getCreator: ->\n @creator.call(World)\n\n @_getDefaults: ->\n return @defaults unless _.isFunction(@defaults)\n @defaults()\n\n @_defer: (callback, args...) ->\n deferred = $.defer()\n\n callback.call World, args..., (error, rest...) ->\n if error\n defered.reject error\n else\n deferred.fulfill rest...\n return deferred.promise\n\n @_execute: (job) ->\n $.controlFlow().execute job\n```", "response": "module.exports = function() {\n var World;\n World = this;\n this.Factories = {};\n return this.Factory = class Factory {\n static create(attributes = {}) {\n return this._execute(() => {\n return World.logger.silence(() => {\n return this._defer(this._getCreator(), this._getDefaults());\n });\n });\n }\n\n static _getCreator() {\n return this.creator.call(World);\n }\n\n static _getDefaults() {\n if (!_.isFunction(this.defaults)) {\n return this.defaults;\n }\n return this.defaults();\n }\n\n static _defer(callback, ...args) {\n var deferred;\n deferred = $.defer();\n callback.call(World, ...args, function(error, ...rest) {\n if (error) {\n return defered.reject(error);\n } else {\n return deferred.fulfill(...rest);\n }\n });\n return deferred.promise;\n }\n\n static _execute(job) {\n return $.controlFlow().execute(job);\n }\n\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mojotech/pioneer", "path": "src/support/Factory.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Factory.coffee", "line_start": 1, "line_end": 29} +{"id": "mojotech/pioneer:src/support/Factory.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function() {\n var World;\n World = this;\n this.Factories = {};\n return this.Factory = class Factory {\n static create(attributes = {}) {\n return this._execute(() => {\n return World.logger.silence(() => {\n return this._defer(this._getCreator(), this._getDefaults());\n });\n });\n }\n\n static _getCreator() {\n return this.creator.call(World);\n }\n\n static _getDefaults() {\n if (!_.isFunction(this.defaults)) {\n return this.defaults;\n }\n return this.defaults();\n }\n\n static _defer(callback, ...args) {\n var deferred;\n deferred = $.defer();\n callback.call(World, ...args, function(error, ...rest) {\n if (error) {\n return defered.reject(error);\n } else {\n return deferred.fulfill(...rest);\n }\n });\n return deferred.promise;\n }\n\n static _execute(job) {\n return $.controlFlow().execute(job);\n }\n\n };\n};\n```", "response": "module.exports = ->\n World = @\n @Factories = {}\n\n class @Factory\n @create: (attributes = {}) ->\n @_execute =>\n World.logger.silence =>\n @_defer(@_getCreator(), @_getDefaults())\n\n @_getCreator: ->\n @creator.call(World)\n\n @_getDefaults: ->\n return @defaults unless _.isFunction(@defaults)\n @defaults()\n\n @_defer: (callback, args...) ->\n deferred = $.defer()\n\n callback.call World, args..., (error, rest...) ->\n if error\n defered.reject error\n else\n deferred.fulfill rest...\n return deferred.promise\n\n @_execute: (job) ->\n $.controlFlow().execute job", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Factory.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Factory.coffee", "line_start": 1, "line_end": 29} +{"id": "mojotech/pioneer:src/support/Factory.coffee:1:completion", "type": "completion", "prompt": "module.exports = ->\n World = @\n @Factories = {}\n\n class @Factory\n @create: (attributes = {}) ->\n @_execute =>\n World.logger.silence =>\n @_defer(@_getCreator(), @_getDefaults())\n\n @_getCreator: ->\n @creator.call(World)\n\n @_getDefaults: ->", "response": "return @defaults unless _.isFunction(@defaults)\n @defaults()\n\n @_defer: (callback, args...) ->\n deferred = $.defer()\n\n callback.call World, args..., (error, rest...) ->\n if error\n defered.reject error\n else\n deferred.fulfill rest...\n return deferred.promise\n\n @_execute: (job) ->\n $.controlFlow().execute job", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Factory.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Factory.coffee", "line_start": 1, "line_end": 29} +{"id": "mauricemach/zappa:benchmarks/express.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "app = require('express').createServer()\n\napp.register '.coffee', require('coffeekup').adapters.express\n\napp.get '/', (req, res) ->\n res.render 'index.jade', foo: 'Express + Jade'\n\napp.get '/coffeekup', (req, res) ->\n res.render 'index.coffee', foo: 'Express + CoffeeKup'\n\napp.listen 3000\n\nconsole.log \"Listening on 3000...\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "benchmarks/express.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/benchmarks/express.coffee", "line_start": 1, "line_end": 13} +{"id": "mauricemach/zappa:benchmarks/express.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\napp = require('express').createServer()\n\napp.register '.coffee', require('coffeekup').adapters.express\n\napp.get '/', (req, res) ->\n res.render 'index.jade', foo: 'Express + Jade'\n\napp.get '/coffeekup', (req, res) ->\n res.render 'index.coffee', foo: 'Express + CoffeeKup'\n\napp.listen 3000\n\nconsole.log \"Listening on 3000...\"\n```", "response": "var app;\n\napp = require('express').createServer();\n\napp.register('.coffee', require('coffeekup').adapters.express);\n\napp.get('/', function(req, res) {\n return res.render('index.jade', {\n foo: 'Express + Jade'\n });\n});\n\napp.get('/coffeekup', function(req, res) {\n return res.render('index.coffee', {\n foo: 'Express + CoffeeKup'\n });\n});\n\napp.listen(3000);\n\nconsole.log(\"Listening on 3000...\");", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mauricemach/zappa", "path": "benchmarks/express.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/benchmarks/express.coffee", "line_start": 1, "line_end": 13} +{"id": "mauricemach/zappa:benchmarks/express.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar app;\n\napp = require('express').createServer();\n\napp.register('.coffee', require('coffeekup').adapters.express);\n\napp.get('/', function(req, res) {\n return res.render('index.jade', {\n foo: 'Express + Jade'\n });\n});\n\napp.get('/coffeekup', function(req, res) {\n return res.render('index.coffee', {\n foo: 'Express + CoffeeKup'\n });\n});\n\napp.listen(3000);\n\nconsole.log(\"Listening on 3000...\");\n```", "response": "app = require('express').createServer()\n\napp.register '.coffee', require('coffeekup').adapters.express\n\napp.get '/', (req, res) ->\n res.render 'index.jade', foo: 'Express + Jade'\n\napp.get '/coffeekup', (req, res) ->\n res.render 'index.coffee', foo: 'Express + CoffeeKup'\n\napp.listen 3000\n\nconsole.log \"Listening on 3000...\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "benchmarks/express.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/benchmarks/express.coffee", "line_start": 1, "line_end": 13} +{"id": "mauricemach/zappa:benchmarks/express.coffee:1:completion", "type": "completion", "prompt": "app = require('express').createServer()\n\napp.register '.coffee', require('coffeekup').adapters.express\n\napp.get '/', (req, res) ->\n res.render 'index.jade', foo: 'Express + Jade'", "response": "app.get '/coffeekup', (req, res) ->\n res.render 'index.coffee', foo: 'Express + CoffeeKup'\n\napp.listen 3000\n\nconsole.log \"Listening on 3000...\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mauricemach/zappa", "path": "benchmarks/express.coffee", "license": "MIT", "commit": "725e0103755c9a92fe84de06cee82db00e51a1f8", "stars": 943, "source_url": "https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/benchmarks/express.coffee", "line_start": 1, "line_end": 13} +{"id": "Glavin001/atom-beautify:src/languages/css.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "default: 0\n description: \"Maximum amount of characters per line (0 = disable)\"\n end_with_newline:\n type: 'boolean'\n default: false\n description: \"End output with newline\"\n indent_comments:\n type: 'boolean'\n default: true\n description: \"Determines whether comments should be indented.\"\n force_indentation:\n type: 'boolean'\n default: false\n description: \"if indentation should be forcefully applied to \\\n markup even if it disruptively adds unintended whitespace \\\n to the documents rendered output\"\n convert_quotes:\n type: 'string'\n default: \"none\"\n description: \"Convert the quote characters delimiting strings \\\n from either double or single quotes to the other.\"\n enum: [\"none\", \"double\", \"single\"]\n align_assignments:\n type: 'boolean'\n default: false\n description: \"If lists of assignments or properties should be \\\n vertically aligned for faster and easier reading.\"\n no_lead_zero:\n type: 'boolean'\n default: false\n description: \"If in CSS values leading 0s immediately preceding \\\n a decimal should be removed or prevented.\"\n configPath:\n title: \"comb custom config file\"\n type: 'string'\n default: \"\"\n description: \"Path to custom CSScomb config file, used in absence of a \\\n `.csscomb.json` or `.csscomb.cson` at the root of your project.\"\n predefinedConfig:\n title: \"comb predefined config\"\n type: 'string'\n default: \"csscomb\"\n description: \"Used if neither a project or custom config file exists.\"\n enum: [\"csscomb\", \"yandex\", \"zen\"]\n}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/languages/css.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/languages/css.coffee", "line_start": 51, "line_end": 95} +{"id": "Glavin001/atom-beautify:src/languages/css.coffee:2:completion", "type": "completion", "prompt": "default: 0\n description: \"Maximum amount of characters per line (0 = disable)\"\n end_with_newline:\n type: 'boolean'\n default: false\n description: \"End output with newline\"\n indent_comments:\n type: 'boolean'\n default: true\n description: \"Determines whether comments should be indented.\"\n force_indentation:\n type: 'boolean'\n default: false\n description: \"if indentation should be forcefully applied to \\\n markup even if it disruptively adds unintended whitespace \\\n to the documents rendered output\"\n convert_quotes:\n type: 'string'\n default: \"none\"\n description: \"Convert the quote characters delimiting strings \\\n from either double or single quotes to the other.\"\n enum: [\"none\", \"double\", \"single\"]", "response": "align_assignments:\n type: 'boolean'\n default: false\n description: \"If lists of assignments or properties should be \\\n vertically aligned for faster and easier reading.\"\n no_lead_zero:\n type: 'boolean'\n default: false\n description: \"If in CSS values leading 0s immediately preceding \\\n a decimal should be removed or prevented.\"\n configPath:\n title: \"comb custom config file\"\n type: 'string'\n default: \"\"\n description: \"Path to custom CSScomb config file, used in absence of a \\\n `.csscomb.json` or `.csscomb.cson` at the root of your project.\"\n predefinedConfig:\n title: \"comb predefined config\"\n type: 'string'\n default: \"csscomb\"\n description: \"Used if neither a project or custom config file exists.\"\n enum: [\"csscomb\", \"yandex\", \"zen\"]\n}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/languages/css.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/languages/css.coffee", "line_start": 51, "line_end": 95} +{"id": "Glavin001/atom-beautify:src/languages/css.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "default: 0\n description: \"Maximum amount of characters per line (0 = disable)\"\n end_with_newline:\n type: 'boolean'\n default: false\n description: \"End output with newline\"\n indent_comments:\n type: 'boolean'\n default: true\n description: \"Determines whether comments should be indented.\"\n force_indentation:\n type: 'boolean'\n default: false\n description: \"if indentation should be forcefully applied to \\\n markup even if it disruptively adds unintended whitespace \\\n to the documents rendered output\"\n convert_quotes:\n type: 'string'\n default: \"none\"\n description: \"Convert the quote characters delimiting strings \\\n from either double or single quotes to the other.\"\n enum: [\"none\", \"double\", \"single\"]\n align_assignments:\n type: 'boolean'\n default: false\n description: \"If lists of assignments or properties should be \\\n vertically aligned for faster and easier reading.\"\n no_lead_zero:\n type: 'boolean'\n default: false\n description: \"If in CSS values leading 0s immediately preceeding \\\n a decimal should be removed or prevented.\"\n configPath:\n title: \"comb custom config file\"\n type: 'string'\n default: \"\"\n description: \"Path to custom CSScomb config file, used in absense of a \\\n `.csscomb.json` or `.csscomb.cson` at the root of your project.\"\n predefinedConfig:\n title: \"comb predefined config\"\n type: 'string'\n default: \"csscomb\"\n description: \"Used if neither a project or custom config file exists.\"\n enum: [\"csscomb\", \"yandex\", \"zen\"]\n}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/languages/css.coffee", "license": "MIT", "commit": "147f97d4c7b8cee3c3f9b80cd9087c0f2e51cb9f", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/147f97d4c7b8cee3c3f9b80cd9087c0f2e51cb9f/src/languages/css.coffee", "line_start": 51, "line_end": 95} +{"id": "Glavin001/atom-beautify:src/languages/css.coffee:2:completion", "type": "completion", "prompt": "default: 0\n description: \"Maximum amount of characters per line (0 = disable)\"\n end_with_newline:\n type: 'boolean'\n default: false\n description: \"End output with newline\"\n indent_comments:\n type: 'boolean'\n default: true\n description: \"Determines whether comments should be indented.\"\n force_indentation:\n type: 'boolean'\n default: false\n description: \"if indentation should be forcefully applied to \\\n markup even if it disruptively adds unintended whitespace \\\n to the documents rendered output\"\n convert_quotes:\n type: 'string'\n default: \"none\"\n description: \"Convert the quote characters delimiting strings \\\n from either double or single quotes to the other.\"\n enum: [\"none\", \"double\", \"single\"]", "response": "align_assignments:\n type: 'boolean'\n default: false\n description: \"If lists of assignments or properties should be \\\n vertically aligned for faster and easier reading.\"\n no_lead_zero:\n type: 'boolean'\n default: false\n description: \"If in CSS values leading 0s immediately preceeding \\\n a decimal should be removed or prevented.\"\n configPath:\n title: \"comb custom config file\"\n type: 'string'\n default: \"\"\n description: \"Path to custom CSScomb config file, used in absense of a \\\n `.csscomb.json` or `.csscomb.cson` at the root of your project.\"\n predefinedConfig:\n title: \"comb predefined config\"\n type: 'string'\n default: \"csscomb\"\n description: \"Used if neither a project or custom config file exists.\"\n enum: [\"csscomb\", \"yandex\", \"zen\"]\n}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/languages/css.coffee", "license": "MIT", "commit": "147f97d4c7b8cee3c3f9b80cd9087c0f2e51cb9f", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/147f97d4c7b8cee3c3f9b80cd9087c0f2e51cb9f/src/languages/css.coffee", "line_start": 51, "line_end": 95} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n removeFlow: (code) ->\n if atom.config.get(@key) is code\n @flow = @flows['default']\n\n delete @flows[code]\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "ac060c2476ba8b323ca932eda97da9bc0c051b34", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/flow-registry.coffee", "line_start": 1, "line_end": 50} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n removeFlow: (code) ->\n if atom.config.get(@key) is code\n @flow = @flows['default']\n\n delete @flows[code]\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"\n```", "response": "var CompositeDisposable;\n\n({CompositeDisposable} = require(\"atom\"));\n\nmodule.exports = {\n subscriptions: null,\n flows: [],\n flow: null,\n key: \"activate-power-mode.flow\",\n enable: function() {\n this.subscriptions = new CompositeDisposable();\n this.observeFlow();\n return this.initList();\n },\n disable: function() {\n var ref, ref1;\n if ((ref = this.subscriptions) != null) {\n ref.dispose();\n }\n if ((ref1 = this.flowList) != null) {\n ref1.dispose();\n }\n return this.flowList = null;\n },\n setDefaultFlow: function(flow) {\n this.flow = flow;\n return this.flows['default'] = flow;\n },\n addFlow: function(code, flow) {\n this.flows[code] = flow;\n if (atom.config.get(this.key) === code) {\n return this.flow = flow;\n }\n },\n removeFlow: function(code) {\n if (atom.config.get(this.key) === code) {\n this.flow = this.flows['default'];\n }\n return delete this.flows[code];\n },\n observeFlow: function() {\n return this.subscriptions.add(atom.config.observe(this.key, (code) => {\n if (this.flows[code] != null) {\n return this.flow = this.flows[code];\n } else {\n return this.flow = this.flows['default'];\n }\n }));\n },\n selectFlow: function(code) {\n return atom.config.set(this.key, code);\n },\n initList: function() {\n if (this.flowList != null) {\n return;\n }\n return this.flowList = require(\"./flow-list\");\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "ac060c2476ba8b323ca932eda97da9bc0c051b34", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/flow-registry.coffee", "line_start": 1, "line_end": 50} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable;\n\n({CompositeDisposable} = require(\"atom\"));\n\nmodule.exports = {\n subscriptions: null,\n flows: [],\n flow: null,\n key: \"activate-power-mode.flow\",\n enable: function() {\n this.subscriptions = new CompositeDisposable();\n this.observeFlow();\n return this.initList();\n },\n disable: function() {\n var ref, ref1;\n if ((ref = this.subscriptions) != null) {\n ref.dispose();\n }\n if ((ref1 = this.flowList) != null) {\n ref1.dispose();\n }\n return this.flowList = null;\n },\n setDefaultFlow: function(flow) {\n this.flow = flow;\n return this.flows['default'] = flow;\n },\n addFlow: function(code, flow) {\n this.flows[code] = flow;\n if (atom.config.get(this.key) === code) {\n return this.flow = flow;\n }\n },\n removeFlow: function(code) {\n if (atom.config.get(this.key) === code) {\n this.flow = this.flows['default'];\n }\n return delete this.flows[code];\n },\n observeFlow: function() {\n return this.subscriptions.add(atom.config.observe(this.key, (code) => {\n if (this.flows[code] != null) {\n return this.flow = this.flows[code];\n } else {\n return this.flow = this.flows['default'];\n }\n }));\n },\n selectFlow: function(code) {\n return atom.config.set(this.key, code);\n },\n initList: function() {\n if (this.flowList != null) {\n return;\n }\n return this.flowList = require(\"./flow-list\");\n }\n};\n```", "response": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n removeFlow: (code) ->\n if atom.config.get(@key) is code\n @flow = @flows['default']\n\n delete @flows[code]\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "ac060c2476ba8b323ca932eda97da9bc0c051b34", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/flow-registry.coffee", "line_start": 1, "line_end": 50} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:completion", "type": "completion", "prompt": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow", "response": "if atom.config.get(@key) is code\n @flow = flow\n\n removeFlow: (code) ->\n if atom.config.get(@key) is code\n @flow = @flows['default']\n\n delete @flows[code]\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "ac060c2476ba8b323ca932eda97da9bc0c051b34", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/flow-registry.coffee", "line_start": 1, "line_end": 50} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@flowList.init this\n\n @subscriptions.add atom.commands.add \"atom-workspace\",\n \"activate-power-mode:select-flow\": =>\n @flowList.toggle()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "ac060c2476ba8b323ca932eda97da9bc0c051b34", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/flow-registry.coffee", "line_start": 51, "line_end": 55} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"\n @flowList.init this\n\n @subscriptions.add atom.commands.add \"atom-workspace\",\n \"activate-power-mode:select-flow\": =>\n @flowList.toggle()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "4e54c380daafd29e2f88f2722b9c3c2e47246f44", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/4e54c380daafd29e2f88f2722b9c3c2e47246f44/lib/flow-registry.coffee", "line_start": 1, "line_end": 49} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"\n @flowList.init this\n\n @subscriptions.add atom.commands.add \"atom-workspace\",\n \"activate-power-mode:select-flow\": =>\n @flowList.toggle()\n```", "response": "var CompositeDisposable;\n\n({CompositeDisposable} = require(\"atom\"));\n\nmodule.exports = {\n subscriptions: null,\n flows: [],\n flow: null,\n key: \"activate-power-mode.flow\",\n enable: function() {\n this.subscriptions = new CompositeDisposable();\n this.observeFlow();\n return this.initList();\n },\n disable: function() {\n var ref, ref1;\n if ((ref = this.subscriptions) != null) {\n ref.dispose();\n }\n if ((ref1 = this.flowList) != null) {\n ref1.dispose();\n }\n return this.flowList = null;\n },\n setDefaultFlow: function(flow) {\n this.flow = flow;\n return this.flows['default'] = flow;\n },\n addFlow: function(code, flow) {\n this.flows[code] = flow;\n if (atom.config.get(this.key) === code) {\n return this.flow = flow;\n }\n },\n observeFlow: function() {\n return this.subscriptions.add(atom.config.observe(this.key, (code) => {\n if (this.flows[code] != null) {\n return this.flow = this.flows[code];\n } else {\n return this.flow = this.flows['default'];\n }\n }));\n },\n selectFlow: function(code) {\n return atom.config.set(this.key, code);\n },\n initList: function() {\n if (this.flowList != null) {\n return;\n }\n this.flowList = require(\"./flow-list\");\n this.flowList.init(this);\n return this.subscriptions.add(atom.commands.add(\"atom-workspace\", {\n \"activate-power-mode:select-flow\": () => {\n return this.flowList.toggle();\n }\n }));\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "4e54c380daafd29e2f88f2722b9c3c2e47246f44", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/4e54c380daafd29e2f88f2722b9c3c2e47246f44/lib/flow-registry.coffee", "line_start": 1, "line_end": 49} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable;\n\n({CompositeDisposable} = require(\"atom\"));\n\nmodule.exports = {\n subscriptions: null,\n flows: [],\n flow: null,\n key: \"activate-power-mode.flow\",\n enable: function() {\n this.subscriptions = new CompositeDisposable();\n this.observeFlow();\n return this.initList();\n },\n disable: function() {\n var ref, ref1;\n if ((ref = this.subscriptions) != null) {\n ref.dispose();\n }\n if ((ref1 = this.flowList) != null) {\n ref1.dispose();\n }\n return this.flowList = null;\n },\n setDefaultFlow: function(flow) {\n this.flow = flow;\n return this.flows['default'] = flow;\n },\n addFlow: function(code, flow) {\n this.flows[code] = flow;\n if (atom.config.get(this.key) === code) {\n return this.flow = flow;\n }\n },\n observeFlow: function() {\n return this.subscriptions.add(atom.config.observe(this.key, (code) => {\n if (this.flows[code] != null) {\n return this.flow = this.flows[code];\n } else {\n return this.flow = this.flows['default'];\n }\n }));\n },\n selectFlow: function(code) {\n return atom.config.set(this.key, code);\n },\n initList: function() {\n if (this.flowList != null) {\n return;\n }\n this.flowList = require(\"./flow-list\");\n this.flowList.init(this);\n return this.subscriptions.add(atom.commands.add(\"atom-workspace\", {\n \"activate-power-mode:select-flow\": () => {\n return this.flowList.toggle();\n }\n }));\n }\n};\n```", "response": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"\n @flowList.init this\n\n @subscriptions.add atom.commands.add \"atom-workspace\",\n \"activate-power-mode:select-flow\": =>\n @flowList.toggle()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "4e54c380daafd29e2f88f2722b9c3c2e47246f44", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/4e54c380daafd29e2f88f2722b9c3c2e47246f44/lib/flow-registry.coffee", "line_start": 1, "line_end": 49} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:completion", "type": "completion", "prompt": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n @initList()\n\n disable: ->\n @subscriptions?.dispose()\n @flowList?.dispose()\n @flowList = null\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow", "response": "if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n\n selectFlow: (code) ->\n atom.config.set(@key, code)\n\n initList: ->\n return if @flowList?\n\n @flowList = require \"./flow-list\"\n @flowList.init this\n\n @subscriptions.add atom.commands.add \"atom-workspace\",\n \"activate-power-mode:select-flow\": =>\n @flowList.toggle()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "4e54c380daafd29e2f88f2722b9c3c2e47246f44", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/4e54c380daafd29e2f88f2722b9c3c2e47246f44/lib/flow-registry.coffee", "line_start": 1, "line_end": 49} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n\n disable: ->\n @subscriptions?.dispose()\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "728fa02fb21976bb52d7e626ac5bde381e9698e2", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/728fa02fb21976bb52d7e626ac5bde381e9698e2/lib/flow-registry.coffee", "line_start": 1, "line_end": 33} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n\n disable: ->\n @subscriptions?.dispose()\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )\n```", "response": "var CompositeDisposable;\n\n({CompositeDisposable} = require(\"atom\"));\n\nmodule.exports = {\n subscriptions: null,\n flows: [],\n flow: null,\n key: \"activate-power-mode.flow\",\n enable: function() {\n this.subscriptions = new CompositeDisposable();\n return this.observeFlow();\n },\n disable: function() {\n var ref;\n return (ref = this.subscriptions) != null ? ref.dispose() : void 0;\n },\n setDefaultFlow: function(flow) {\n this.flow = flow;\n return this.flows['default'] = flow;\n },\n addFlow: function(code, flow) {\n this.flows[code] = flow;\n if (atom.config.get(this.key) === code) {\n return this.flow = flow;\n }\n },\n observeFlow: function() {\n return this.subscriptions.add(atom.config.observe(this.key, (code) => {\n if (this.flows[code] != null) {\n return this.flow = this.flows[code];\n } else {\n return this.flow = this.flows['default'];\n }\n }));\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "728fa02fb21976bb52d7e626ac5bde381e9698e2", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/728fa02fb21976bb52d7e626ac5bde381e9698e2/lib/flow-registry.coffee", "line_start": 1, "line_end": 33} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable;\n\n({CompositeDisposable} = require(\"atom\"));\n\nmodule.exports = {\n subscriptions: null,\n flows: [],\n flow: null,\n key: \"activate-power-mode.flow\",\n enable: function() {\n this.subscriptions = new CompositeDisposable();\n return this.observeFlow();\n },\n disable: function() {\n var ref;\n return (ref = this.subscriptions) != null ? ref.dispose() : void 0;\n },\n setDefaultFlow: function(flow) {\n this.flow = flow;\n return this.flows['default'] = flow;\n },\n addFlow: function(code, flow) {\n this.flows[code] = flow;\n if (atom.config.get(this.key) === code) {\n return this.flow = flow;\n }\n },\n observeFlow: function() {\n return this.subscriptions.add(atom.config.observe(this.key, (code) => {\n if (this.flows[code] != null) {\n return this.flow = this.flows[code];\n } else {\n return this.flow = this.flows['default'];\n }\n }));\n }\n};\n```", "response": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n\n disable: ->\n @subscriptions?.dispose()\n\n setDefaultFlow: (flow) ->\n @flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "728fa02fb21976bb52d7e626ac5bde381e9698e2", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/728fa02fb21976bb52d7e626ac5bde381e9698e2/lib/flow-registry.coffee", "line_start": 1, "line_end": 33} +{"id": "JoelBesada/activate-power-mode:lib/flow-registry.coffee:1:completion", "type": "completion", "prompt": "{CompositeDisposable} = require \"atom\"\n\nmodule.exports =\n subscriptions: null\n flows: []\n flow: null\n key: \"activate-power-mode.flow\"\n\n enable: ->\n @subscriptions = new CompositeDisposable\n @observeFlow()\n\n disable: ->\n @subscriptions?.dispose()\n\n setDefaultFlow: (flow) ->", "response": "@flow = flow\n @flows['default'] = flow\n\n addFlow: (code, flow) ->\n @flows[code] = flow\n\n if atom.config.get(@key) is code\n @flow = flow\n\n observeFlow: ->\n @subscriptions.add atom.config.observe(\n @key, (code) =>\n if @flows[code]?\n @flow = @flows[code]\n else\n @flow = @flows['default']\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/flow-registry.coffee", "license": "MIT", "commit": "728fa02fb21976bb52d7e626ac5bde381e9698e2", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/728fa02fb21976bb52d7e626ac5bde381e9698e2/lib/flow-registry.coffee", "line_start": 1, "line_end": 33} +{"id": "Glavin001/atom-beautify:src/beautifiers/coffee-formatter.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class CoffeeFormatter extends Beautifier\n\n name: \"Coffee Formatter\"\n link: \"https://github.com/Glavin001/Coffee-Formatter\"\n\n options: {\n CoffeeScript: false\n }\n\n beautify: (text, language, options) ->\n\n return new @Promise((resolve, reject) ->\n\n CF = require(\"coffee-formatter\")\n lines = text.split(\"\\n\")\n resultArr = []\n i = 0\n len = lines.length\n\n while i < len\n curr = lines[i]\n p = CF.formatTwoSpaceOperator(curr)\n p = CF.formatOneSpaceOperator(p)\n p = CF.shortenSpaces(p)\n resultArr.push p\n i++\n result = resultArr.join(\"\\n\")\n resolve result\n\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/coffee-formatter.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/coffee-formatter.coffee", "line_start": 1, "line_end": 33} +{"id": "Glavin001/atom-beautify:src/beautifiers/coffee-formatter.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class CoffeeFormatter extends Beautifier\n\n name: \"Coffee Formatter\"\n link: \"https://github.com/Glavin001/Coffee-Formatter\"\n\n options: {\n CoffeeScript: false\n }\n\n beautify: (text, language, options) ->\n\n return new @Promise((resolve, reject) ->\n\n CF = require(\"coffee-formatter\")\n lines = text.split(\"\\n\")\n resultArr = []\n i = 0\n len = lines.length\n\n while i < len\n curr = lines[i]\n p = CF.formatTwoSpaceOperator(curr)\n p = CF.formatOneSpaceOperator(p)\n p = CF.shortenSpaces(p)\n resultArr.push p\n i++\n result = resultArr.join(\"\\n\")\n resolve result\n\n )\n```", "response": "\"use strict\";\nvar Beautifier, CoffeeFormatter;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = CoffeeFormatter = (function() {\n class CoffeeFormatter extends Beautifier {\n beautify(text, language, options) {\n return new this.Promise(function(resolve, reject) {\n var CF, curr, i, len, lines, p, result, resultArr;\n CF = require(\"coffee-formatter\");\n lines = text.split(\"\\n\");\n resultArr = [];\n i = 0;\n len = lines.length;\n while (i < len) {\n curr = lines[i];\n p = CF.formatTwoSpaceOperator(curr);\n p = CF.formatOneSpaceOperator(p);\n p = CF.shortenSpaces(p);\n resultArr.push(p);\n i++;\n }\n result = resultArr.join(\"\\n\");\n return resolve(result);\n });\n }\n\n };\n\n CoffeeFormatter.prototype.name = \"Coffee Formatter\";\n\n CoffeeFormatter.prototype.link = \"https://github.com/Glavin001/Coffee-Formatter\";\n\n CoffeeFormatter.prototype.options = {\n CoffeeScript: false\n };\n\n return CoffeeFormatter;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/coffee-formatter.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/coffee-formatter.coffee", "line_start": 1, "line_end": 33} +{"id": "Glavin001/atom-beautify:src/beautifiers/coffee-formatter.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n\"use strict\";\nvar Beautifier, CoffeeFormatter;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = CoffeeFormatter = (function() {\n class CoffeeFormatter extends Beautifier {\n beautify(text, language, options) {\n return new this.Promise(function(resolve, reject) {\n var CF, curr, i, len, lines, p, result, resultArr;\n CF = require(\"coffee-formatter\");\n lines = text.split(\"\\n\");\n resultArr = [];\n i = 0;\n len = lines.length;\n while (i < len) {\n curr = lines[i];\n p = CF.formatTwoSpaceOperator(curr);\n p = CF.formatOneSpaceOperator(p);\n p = CF.shortenSpaces(p);\n resultArr.push(p);\n i++;\n }\n result = resultArr.join(\"\\n\");\n return resolve(result);\n });\n }\n\n };\n\n CoffeeFormatter.prototype.name = \"Coffee Formatter\";\n\n CoffeeFormatter.prototype.link = \"https://github.com/Glavin001/Coffee-Formatter\";\n\n CoffeeFormatter.prototype.options = {\n CoffeeScript: false\n };\n\n return CoffeeFormatter;\n\n}).call(this);\n```", "response": "\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class CoffeeFormatter extends Beautifier\n\n name: \"Coffee Formatter\"\n link: \"https://github.com/Glavin001/Coffee-Formatter\"\n\n options: {\n CoffeeScript: false\n }\n\n beautify: (text, language, options) ->\n\n return new @Promise((resolve, reject) ->\n\n CF = require(\"coffee-formatter\")\n lines = text.split(\"\\n\")\n resultArr = []\n i = 0\n len = lines.length\n\n while i < len\n curr = lines[i]\n p = CF.formatTwoSpaceOperator(curr)\n p = CF.formatOneSpaceOperator(p)\n p = CF.shortenSpaces(p)\n resultArr.push p\n i++\n result = resultArr.join(\"\\n\")\n resolve result\n\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/coffee-formatter.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/coffee-formatter.coffee", "line_start": 1, "line_end": 33} +{"id": "Glavin001/atom-beautify:src/beautifiers/coffee-formatter.coffee:1:completion", "type": "completion", "prompt": "\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class CoffeeFormatter extends Beautifier\n\n name: \"Coffee Formatter\"\n link: \"https://github.com/Glavin001/Coffee-Formatter\"\n\n options: {\n CoffeeScript: false\n }\n\n beautify: (text, language, options) ->\n\n return new @Promise((resolve, reject) ->", "response": "CF = require(\"coffee-formatter\")\n lines = text.split(\"\\n\")\n resultArr = []\n i = 0\n len = lines.length\n\n while i < len\n curr = lines[i]\n p = CF.formatTwoSpaceOperator(curr)\n p = CF.formatOneSpaceOperator(p)\n p = CF.shortenSpaces(p)\n resultArr.push p\n i++\n result = resultArr.join(\"\\n\")\n resolve result\n\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/coffee-formatter.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/coffee-formatter.coffee", "line_start": 1, "line_end": 33} +{"id": "xhan/qqbot:tests/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "prompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 3, "line_end": 12} +{"id": "xhan/qqbot:tests/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n```", "response": "var prompt;\n\nprompt = function(title, callback) {\n process.stdin.resume();\n process.stdout.write(title);\n process.stdin.once(\"data\", function(data) {\n callback(data.toString().trim());\n return process.stdin.pause();\n });\n // control + d to end\n return process.stdin.on('end', function() {\n process.stdout.write('end');\n return callback();\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 3, "line_end": 12} +{"id": "xhan/qqbot:tests/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar prompt;\n\nprompt = function(title, callback) {\n process.stdin.resume();\n process.stdout.write(title);\n process.stdin.once(\"data\", function(data) {\n callback(data.toString().trim());\n return process.stdin.pause();\n });\n // control + d to end\n return process.stdin.on('end', function() {\n process.stdout.write('end');\n return callback();\n });\n};\n```", "response": "prompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 3, "line_end": 12} +{"id": "xhan/qqbot:tests/simple.coffee:1:completion", "type": "completion", "prompt": "prompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()", "response": "process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 3, "line_end": 12} +{"id": "xhan/qqbot:tests/simple.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 15, "line_end": 20} +{"id": "xhan/qqbot:tests/simple.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n```", "response": "var test_prompt;\n\ntest_prompt = function() {\n log(\"hello\");\n prompt(\"input something\", function(content) {\n return log(content);\n });\n return log(\"end\");\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 15, "line_end": 20} +{"id": "xhan/qqbot:tests/simple.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test_prompt;\n\ntest_prompt = function() {\n log(\"hello\");\n prompt(\"input something\", function(content) {\n return log(content);\n });\n return log(\"end\");\n};\n```", "response": "test_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 15, "line_end": 20} +{"id": "xhan/qqbot:tests/simple.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 23, "line_end": 31} +{"id": "xhan/qqbot:tests/simple.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n```", "response": "var test1;\n\ntest1 = function() {\n var i, k, results, v;\n log('begin');\n k = {\n a: 10,\n b: 20,\n c: 30\n };\n results = [];\n for (i in k) {\n v = k[i];\n results.push(log(i, v));\n }\n return results;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 23, "line_end": 31} +{"id": "xhan/qqbot:tests/simple.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test1;\n\ntest1 = function() {\n var i, k, results, v;\n log('begin');\n k = {\n a: 10,\n b: 20,\n c: 30\n };\n results = [];\n for (i in k) {\n v = k[i];\n results.push(log(i, v));\n }\n return results;\n};\n```", "response": "test1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 23, "line_end": 31} +{"id": "xhan/qqbot:tests/simple.coffee:3:completion", "type": "completion", "prompt": "test1 = ->\n log 'begin'\n k =\n a:10", "response": "b:20\n c:30\n\n for i,v of k\n log i , v", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 23, "line_end": 31} +{"id": "xhan/qqbot:tests/simple.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test2 = ->\n # 官方的解释 大概\n # for in 用在 array\n # for of 用在 obj\n\n # 测试 for of / for in\n # for i,v in [10,2,3]\n # log i,v\n log v for v in [10,2,3]\n\n # log \"kk\"\n log k,v for k,v of {a:10,b:20}\n # log k,v", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 33, "line_end": 45} +{"id": "xhan/qqbot:tests/simple.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest2 = ->\n # 官方的解释 大概\n # for in 用在 array\n # for of 用在 obj\n\n # 测试 for of / for in\n # for i,v in [10,2,3]\n # log i,v\n log v for v in [10,2,3]\n\n # log \"kk\"\n log k,v for k,v of {a:10,b:20}\n # log k,v\n```", "response": "var test2;\n\ntest2 = function() {\n var i, k, len, ref, ref1, results, v;\n ref = [10, 2, 3];\n for (i = 0, len = ref.length; i < len; i++) {\n v = ref[i];\n // 官方的解释 大概\n // for in 用在 array\n // for of 用在 obj\n\n // 测试 for of / for in\n // for i,v in [10,2,3]\n // log i,v\n log(v);\n }\n ref1 = {\n a: 10,\n b: 20\n };\n results = [];\n for (k in ref1) {\n v = ref1[k];\n // log \"kk\"\n results.push(log(k, v));\n }\n return results;\n};\n\n// log k,v", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 33, "line_end": 45} +{"id": "xhan/qqbot:tests/simple.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test2;\n\ntest2 = function() {\n var i, k, len, ref, ref1, results, v;\n ref = [10, 2, 3];\n for (i = 0, len = ref.length; i < len; i++) {\n v = ref[i];\n // 官方的解释 大概\n // for in 用在 array\n // for of 用在 obj\n\n // 测试 for of / for in\n // for i,v in [10,2,3]\n // log i,v\n log(v);\n }\n ref1 = {\n a: 10,\n b: 20\n };\n results = [];\n for (k in ref1) {\n v = ref1[k];\n // log \"kk\"\n results.push(log(k, v));\n }\n return results;\n};\n\n// log k,v\n```", "response": "test2 = ->\n # 官方的解释 大概\n # for in 用在 array\n # for of 用在 obj\n\n # 测试 for of / for in\n # for i,v in [10,2,3]\n # log i,v\n log v for v in [10,2,3]\n\n # log \"kk\"\n log k,v for k,v of {a:10,b:20}\n # log k,v", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 33, "line_end": 45} +{"id": "xhan/qqbot:tests/simple.coffee:4:completion", "type": "completion", "prompt": "test2 = ->\n # 官方的解释 大概\n # for in 用在 array\n # for of 用在 obj\n\n # 测试 for of / for in", "response": "# for i,v in [10,2,3]\n # log i,v\n log v for v in [10,2,3]\n\n # log \"kk\"\n log k,v for k,v of {a:10,b:20}\n # log k,v", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 33, "line_end": 45} +{"id": "xhan/qqbot:tests/simple.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 47, "line_end": 51} +{"id": "xhan/qqbot:tests/simple.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n```", "response": "var test3;\n\ntest3 = function() {\n var QQBot, bot;\n QQBot = require('../src/qqbot');\n bot = new QQBot(100);\n bot.save_buddy_info({\n buddy: 100000\n });\n return log(bot);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 47, "line_end": 51} +{"id": "xhan/qqbot:tests/simple.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test3;\n\ntest3 = function() {\n var QQBot, bot;\n QQBot = require('../src/qqbot');\n bot = new QQBot(100);\n bot.save_buddy_info({\n buddy: 100000\n });\n return log(bot);\n};\n```", "response": "test3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 47, "line_end": 51} +{"id": "xhan/qqbot:tests/simple.coffee:5:completion", "type": "completion", "prompt": "test3 =->\n QQBot = require '../src/qqbot'", "response": "bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 47, "line_end": 51} +{"id": "xhan/qqbot:tests/simple.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 53, "line_end": 75} +{"id": "xhan/qqbot:tests/simple.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name\n```", "response": "var test4;\n\ntest4 = function() {\n var OOO, v;\n OOO = (function() {\n var test, test2;\n\n // 没法在 =-> 方法中调用 @方法\n // 在callback 里调用方法需要用 =>\n class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n log(\"ask\", this.name);\n return test();\n }\n\n ask2() {\n log(\"ask2\");\n return setTimeout(() => {\n return this.ask();\n }, 500);\n }\n\n };\n\n test = function() {\n return log(\"test\");\n };\n\n // test2()\n test2 = function() {\n log(\"test2\");\n return test();\n };\n\n return OOO;\n\n }).call(this);\n v = new OOO('名字');\n v.ask2();\n return log(v.name);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 53, "line_end": 75} +{"id": "xhan/qqbot:tests/simple.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test4;\n\ntest4 = function() {\n var OOO, v;\n OOO = (function() {\n var test, test2;\n\n // 没法在 =-> 方法中调用 @方法\n // 在callback 里调用方法需要用 =>\n class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n log(\"ask\", this.name);\n return test();\n }\n\n ask2() {\n log(\"ask2\");\n return setTimeout(() => {\n return this.ask();\n }, 500);\n }\n\n };\n\n test = function() {\n return log(\"test\");\n };\n\n // test2()\n test2 = function() {\n log(\"test2\");\n return test();\n };\n\n return OOO;\n\n }).call(this);\n v = new OOO('名字');\n v.ask2();\n return log(v.name);\n};\n```", "response": "test4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 53, "line_end": 75} +{"id": "xhan/qqbot:tests/simple.coffee:6:completion", "type": "completion", "prompt": "test4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->", "response": "log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 53, "line_end": 75} +{"id": "xhan/qqbot:tests/simple.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test5 =->\n #测试 npm依赖 能否互相 同层级调用\n # ln -s ../../hubot-qq . 调用了 yaml\n test = require 'hubot-qq'\n log test", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 78, "line_end": 82} +{"id": "xhan/qqbot:tests/simple.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest5 =->\n #测试 npm依赖 能否互相 同层级调用\n # ln -s ../../hubot-qq . 调用了 yaml\n test = require 'hubot-qq'\n log test\n```", "response": "var test5;\n\ntest5 = function() {\n var test;\n //测试 npm依赖 能否互相 同层级调用\n // ln -s ../../hubot-qq . 调用了 yaml\n test = require('hubot-qq');\n return log(test);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 78, "line_end": 82} +{"id": "xhan/qqbot:tests/simple.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test5;\n\ntest5 = function() {\n var test;\n //测试 npm依赖 能否互相 同层级调用\n // ln -s ../../hubot-qq . 调用了 yaml\n test = require('hubot-qq');\n return log(test);\n};\n```", "response": "test5 =->\n #测试 npm依赖 能否互相 同层级调用\n # ln -s ../../hubot-qq . 调用了 yaml\n test = require 'hubot-qq'\n log test", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 78, "line_end": 82} +{"id": "xhan/qqbot:tests/simple.coffee:7:completion", "type": "completion", "prompt": "test5 =->\n #测试 npm依赖 能否互相 同层级调用", "response": "# ln -s ../../hubot-qq . 调用了 yaml\n test = require 'hubot-qq'\n log test", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 78, "line_end": 82} +{"id": "xhan/qqbot:tests/simple.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test6 =->\n #测试 export.xx 在包内如何获取\n exports.xx =-> log \"xxxxx\"\n exports.xx()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 85, "line_end": 88} +{"id": "xhan/qqbot:tests/simple.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest6 =->\n #测试 export.xx 在包内如何获取\n exports.xx =-> log \"xxxxx\"\n exports.xx()\n```", "response": "var test6;\n\ntest6 = function() {\n //测试 export.xx 在包内如何获取\n exports.xx = function() {\n return log(\"xxxxx\");\n };\n return exports.xx();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 85, "line_end": 88} +{"id": "xhan/qqbot:tests/simple.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test6;\n\ntest6 = function() {\n //测试 export.xx 在包内如何获取\n exports.xx = function() {\n return log(\"xxxxx\");\n };\n return exports.xx();\n};\n```", "response": "test6 =->\n #测试 export.xx 在包内如何获取\n exports.xx =-> log \"xxxxx\"\n exports.xx()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 85, "line_end": 88} +{"id": "xhan/qqbot:tests/simple.coffee:8:completion", "type": "completion", "prompt": "test6 =->\n #测试 export.xx 在包内如何获取", "response": "exports.xx =-> log \"xxxxx\"\n exports.xx()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 85, "line_end": 88} +{"id": "xhan/qqbot:tests/simple.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"\n ,300\n# test7()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:9:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"\n ,300\n# test7()\n\n# setTimeout ->\n# log 'test'\n# ,500\n```", "response": "var test7;\n\ntest7 = function() {\n // 回调中缩进 似乎可以和父保持一直\n log(\"hello\");\n setTimeout(function() {});\n return log(\"next\", 300);\n};\n\n// test7()\n\n// setTimeout ->\n// log 'test'\n// ,500", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:9:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test7;\n\ntest7 = function() {\n // 回调中缩进 似乎可以和父保持一直\n log(\"hello\");\n setTimeout(function() {});\n return log(\"next\", 300);\n};\n\n// test7()\n\n// setTimeout ->\n// log 'test'\n// ,500\n```", "response": "test7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"\n ,300\n# test7()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:9:completion", "type": "completion", "prompt": "test7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"", "response": ",300\n# test7()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:10:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test8 =->\n # 似乎无法在自己执行中传入stdin\n # process.stdin.resume()\n process.stdin.on \"data\", (data) ->\n data = data.toString().trim()\n console.log 'received: ', data\n process.stdin.on 'end', ->\n console.log 'end'\n\n Readable = require('stream').Readable\n rs = new Readable\n rs.push('beep ')\n rs.push('boop\\n')\n rs.push(null)\n\n # rs.pipe(process.stdin)\n process.stdin.resume()\n\n\ntest8()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 103, "line_end": 122} +{"id": "xhan/qqbot:tests/simple.coffee:10:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest8 =->\n # 似乎无法在自己执行中传入stdin\n # process.stdin.resume()\n process.stdin.on \"data\", (data) ->\n data = data.toString().trim()\n console.log 'received: ', data\n process.stdin.on 'end', ->\n console.log 'end'\n\n Readable = require('stream').Readable\n rs = new Readable\n rs.push('beep ')\n rs.push('boop\\n')\n rs.push(null)\n\n # rs.pipe(process.stdin)\n process.stdin.resume()\n\n\ntest8()\n```", "response": "var test8;\n\ntest8 = function() {\n var Readable, rs;\n // 似乎无法在自己执行中传入stdin\n // process.stdin.resume()\n process.stdin.on(\"data\", function(data) {\n data = data.toString().trim();\n return console.log('received: ', data);\n });\n process.stdin.on('end', function() {\n return console.log('end');\n });\n Readable = require('stream').Readable;\n rs = new Readable();\n rs.push('beep ');\n rs.push('boop\\n');\n rs.push(null);\n // rs.pipe(process.stdin)\n return process.stdin.resume();\n};\n\ntest8();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 103, "line_end": 122} +{"id": "xhan/qqbot:tests/simple.coffee:10:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test8;\n\ntest8 = function() {\n var Readable, rs;\n // 似乎无法在自己执行中传入stdin\n // process.stdin.resume()\n process.stdin.on(\"data\", function(data) {\n data = data.toString().trim();\n return console.log('received: ', data);\n });\n process.stdin.on('end', function() {\n return console.log('end');\n });\n Readable = require('stream').Readable;\n rs = new Readable();\n rs.push('beep ');\n rs.push('boop\\n');\n rs.push(null);\n // rs.pipe(process.stdin)\n return process.stdin.resume();\n};\n\ntest8();\n```", "response": "test8 =->\n # 似乎无法在自己执行中传入stdin\n # process.stdin.resume()\n process.stdin.on \"data\", (data) ->\n data = data.toString().trim()\n console.log 'received: ', data\n process.stdin.on 'end', ->\n console.log 'end'\n\n Readable = require('stream').Readable\n rs = new Readable\n rs.push('beep ')\n rs.push('boop\\n')\n rs.push(null)\n\n # rs.pipe(process.stdin)\n process.stdin.resume()\n\n\ntest8()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 103, "line_end": 122} +{"id": "xhan/qqbot:tests/simple.coffee:10:completion", "type": "completion", "prompt": "test8 =->\n # 似乎无法在自己执行中传入stdin\n # process.stdin.resume()\n process.stdin.on \"data\", (data) ->\n data = data.toString().trim()\n console.log 'received: ', data\n process.stdin.on 'end', ->\n console.log 'end'\n\n Readable = require('stream').Readable", "response": "rs = new Readable\n rs.push('beep ')\n rs.push('boop\\n')\n rs.push(null)\n\n # rs.pipe(process.stdin)\n process.stdin.resume()\n\n\ntest8()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/tests/simple.coffee", "line_start": 103, "line_end": 122} +{"id": "xhan/qqbot:tests/simple.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"\n ,300\ntest7()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f4f6a58937736a63ea7c06b80c6dbab957d9c408", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f4f6a58937736a63ea7c06b80c6dbab957d9c408/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:9:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"\n ,300\ntest7()\n\n# setTimeout ->\n# log 'test'\n# ,500\n```", "response": "var test7;\n\ntest7 = function() {\n // 回调中缩进 似乎可以和父保持一直\n log(\"hello\");\n setTimeout(function() {});\n return log(\"next\", 300);\n};\n\ntest7();\n\n// setTimeout ->\n// log 'test'\n// ,500", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f4f6a58937736a63ea7c06b80c6dbab957d9c408", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f4f6a58937736a63ea7c06b80c6dbab957d9c408/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:9:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test7;\n\ntest7 = function() {\n // 回调中缩进 似乎可以和父保持一直\n log(\"hello\");\n setTimeout(function() {});\n return log(\"next\", 300);\n};\n\ntest7();\n\n// setTimeout ->\n// log 'test'\n// ,500\n```", "response": "test7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"\n ,300\ntest7()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f4f6a58937736a63ea7c06b80c6dbab957d9c408", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f4f6a58937736a63ea7c06b80c6dbab957d9c408/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:9:completion", "type": "completion", "prompt": "test7 =->\n # 回调中缩进 似乎可以和父保持一直\n log \"hello\"\n setTimeout ->\n log \"next\"", "response": ",300\ntest7()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "f4f6a58937736a63ea7c06b80c6dbab957d9c408", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/f4f6a58937736a63ea7c06b80c6dbab957d9c408/tests/simple.coffee", "line_start": 90, "line_end": 100} +{"id": "xhan/qqbot:tests/simple.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name\n\n\n\ntest2()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c/tests/simple.coffee", "line_start": 53, "line_end": 83} +{"id": "xhan/qqbot:tests/simple.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name\n\n\n\ntest2()\n\n# setTimeout ->\n# log 'test'\n# ,500\n```", "response": "var test4;\n\ntest4 = function() {\n var OOO, v;\n OOO = (function() {\n var test, test2;\n\n // 没法在 =-> 方法中调用 @方法\n // 在callback 里调用方法需要用 =>\n class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n log(\"ask\", this.name);\n return test();\n }\n\n ask2() {\n log(\"ask2\");\n return setTimeout(() => {\n return this.ask();\n }, 500);\n }\n\n };\n\n test = function() {\n return log(\"test\");\n };\n\n // test2()\n test2 = function() {\n log(\"test2\");\n return test();\n };\n\n return OOO;\n\n }).call(this);\n v = new OOO('名字');\n v.ask2();\n return log(v.name);\n};\n\ntest2();\n\n// setTimeout ->\n// log 'test'\n// ,500", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c/tests/simple.coffee", "line_start": 53, "line_end": 83} +{"id": "xhan/qqbot:tests/simple.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test4;\n\ntest4 = function() {\n var OOO, v;\n OOO = (function() {\n var test, test2;\n\n // 没法在 =-> 方法中调用 @方法\n // 在callback 里调用方法需要用 =>\n class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n log(\"ask\", this.name);\n return test();\n }\n\n ask2() {\n log(\"ask2\");\n return setTimeout(() => {\n return this.ask();\n }, 500);\n }\n\n };\n\n test = function() {\n return log(\"test\");\n };\n\n // test2()\n test2 = function() {\n log(\"test2\");\n return test();\n };\n\n return OOO;\n\n }).call(this);\n v = new OOO('名字');\n v.ask2();\n return log(v.name);\n};\n\ntest2();\n\n// setTimeout ->\n// log 'test'\n// ,500\n```", "response": "test4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name\n\n\n\ntest2()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c/tests/simple.coffee", "line_start": 53, "line_end": 83} +{"id": "xhan/qqbot:tests/simple.coffee:6:completion", "type": "completion", "prompt": "test4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500", "response": "# test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name\n\n\n\ntest2()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c/tests/simple.coffee", "line_start": 53, "line_end": 83} +{"id": "xhan/qqbot:tests/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "d26a03521d806f856002b41ec62665f10a91a47b", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/d26a03521d806f856002b41ec62665f10a91a47b/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n```", "response": "//!/usr/bin/env coffee\nvar log, prompt, test1, test2, test3, test4, test_prompt;\n\nlog = console.log;\n\nprompt = function(title, callback) {\n process.stdin.resume();\n process.stdout.write(title);\n process.stdin.once(\"data\", function(data) {\n callback(data.toString().trim());\n return process.stdin.pause();\n });\n // control + d to end\n return process.stdin.on('end', function() {\n process.stdout.write('end');\n return callback();\n });\n};\n\ntest_prompt = function() {\n log(\"hello\");\n prompt(\"input something\", function(content) {\n return log(content);\n });\n return log(\"end\");\n};\n\ntest1 = function() {\n var i, k, results, v;\n log('begin');\n k = {\n a: 10,\n b: 20,\n c: 30\n };\n results = [];\n for (i in k) {\n v = k[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest2 = function() {\n var i, ref, results, v;\n ref = [10, 2, 3];\n results = [];\n for (i in ref) {\n v = ref[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest3 = function() {\n var QQBot, bot;\n QQBot = require('../src/qqbot');\n bot = new QQBot(100);\n bot.save_buddy_info({\n buddy: 100000\n });\n return log(bot);\n};\n\ntest4 = function() {\n var OOO;\n // 没法在 =-> 方法中调用 @方法\n // 在callback 里调用方法需要用 =>\n return OOO = class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n return log(\"ask\", this.name);\n }\n\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "d26a03521d806f856002b41ec62665f10a91a47b", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/d26a03521d806f856002b41ec62665f10a91a47b/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n//!/usr/bin/env coffee\nvar log, prompt, test1, test2, test3, test4, test_prompt;\n\nlog = console.log;\n\nprompt = function(title, callback) {\n process.stdin.resume();\n process.stdout.write(title);\n process.stdin.once(\"data\", function(data) {\n callback(data.toString().trim());\n return process.stdin.pause();\n });\n // control + d to end\n return process.stdin.on('end', function() {\n process.stdout.write('end');\n return callback();\n });\n};\n\ntest_prompt = function() {\n log(\"hello\");\n prompt(\"input something\", function(content) {\n return log(content);\n });\n return log(\"end\");\n};\n\ntest1 = function() {\n var i, k, results, v;\n log('begin');\n k = {\n a: 10,\n b: 20,\n c: 30\n };\n results = [];\n for (i in k) {\n v = k[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest2 = function() {\n var i, ref, results, v;\n ref = [10, 2, 3];\n results = [];\n for (i in ref) {\n v = ref[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest3 = function() {\n var QQBot, bot;\n QQBot = require('../src/qqbot');\n bot = new QQBot(100);\n bot.save_buddy_info({\n buddy: 100000\n });\n return log(bot);\n};\n\ntest4 = function() {\n var OOO;\n // 没法在 =-> 方法中调用 @方法\n // 在callback 里调用方法需要用 =>\n return OOO = class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n return log(\"ask\", this.name);\n }\n\n };\n};\n```", "response": "#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "d26a03521d806f856002b41ec62665f10a91a47b", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/d26a03521d806f856002b41ec62665f10a91a47b/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:1:completion", "type": "completion", "prompt": "#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =", "response": "a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n # 在callback 里调用方法需要用 =>\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "d26a03521d806f856002b41ec62665f10a91a47b", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/d26a03521d806f856002b41ec62665f10a91a47b/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('名字')\n v.ask2()\n log v.name\n\n\n\ntest4()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "d26a03521d806f856002b41ec62665f10a91a47b", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/d26a03521d806f856002b41ec62665f10a91a47b/tests/simple.coffee", "line_start": 51, "line_end": 74} +{"id": "xhan/qqbot:tests/simple.coffee:2:completion", "type": "completion", "prompt": "test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()", "response": "v = new OOO('名字')\n v.ask2()\n log v.name\n\n\n\ntest4()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "d26a03521d806f856002b41ec62665f10a91a47b", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/d26a03521d806f856002b41ec62665f10a91a47b/tests/simple.coffee", "line_start": 51, "line_end": 74} +{"id": "xhan/qqbot:tests/simple.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('vvv')\n v.ask2()\n\n\n\n\ntest4()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "3ad0a5929913fb01d664df2be7f116a7776de125", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3ad0a5929913fb01d664df2be7f116a7776de125/tests/simple.coffee", "line_start": 51, "line_end": 74} +{"id": "xhan/qqbot:tests/simple.coffee:2:completion", "type": "completion", "prompt": "test()\n test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n setTimeout =>\n @ask()\n ,500\n # test2()\n test2 = ->\n log \"test2\"\n test()", "response": "v = new OOO('vvv')\n v.ask2()\n\n\n\n\ntest4()\n\n# setTimeout ->\n# log 'test'\n# ,500", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "3ad0a5929913fb01d664df2be7f116a7776de125", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3ad0a5929913fb01d664df2be7f116a7776de125/tests/simple.coffee", "line_start": 51, "line_end": 74} +{"id": "xhan/qqbot:tests/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()\n```", "response": "//!/usr/bin/env coffee\nvar log, prompt, test1, test2, test3, test4, test_prompt;\n\nlog = console.log;\n\nprompt = function(title, callback) {\n process.stdin.resume();\n process.stdout.write(title);\n process.stdin.once(\"data\", function(data) {\n callback(data.toString().trim());\n return process.stdin.pause();\n });\n // control + d to end\n return process.stdin.on('end', function() {\n process.stdout.write('end');\n return callback();\n });\n};\n\ntest_prompt = function() {\n log(\"hello\");\n prompt(\"input something\", function(content) {\n return log(content);\n });\n return log(\"end\");\n};\n\ntest1 = function() {\n var i, k, results, v;\n log('begin');\n k = {\n a: 10,\n b: 20,\n c: 30\n };\n results = [];\n for (i in k) {\n v = k[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest2 = function() {\n var i, ref, results, v;\n ref = [10, 2, 3];\n results = [];\n for (i in ref) {\n v = ref[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest3 = function() {\n var QQBot, bot;\n QQBot = require('../src/qqbot');\n bot = new QQBot(100);\n bot.save_buddy_info({\n buddy: 100000\n });\n return log(bot);\n};\n\ntest4 = function() {\n var OOO;\n // 没法在 =-> 方法中调用 @方法\n return OOO = class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n log(\"ask\", this.name);\n return test();\n }\n\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n//!/usr/bin/env coffee\nvar log, prompt, test1, test2, test3, test4, test_prompt;\n\nlog = console.log;\n\nprompt = function(title, callback) {\n process.stdin.resume();\n process.stdout.write(title);\n process.stdin.once(\"data\", function(data) {\n callback(data.toString().trim());\n return process.stdin.pause();\n });\n // control + d to end\n return process.stdin.on('end', function() {\n process.stdout.write('end');\n return callback();\n });\n};\n\ntest_prompt = function() {\n log(\"hello\");\n prompt(\"input something\", function(content) {\n return log(content);\n });\n return log(\"end\");\n};\n\ntest1 = function() {\n var i, k, results, v;\n log('begin');\n k = {\n a: 10,\n b: 20,\n c: 30\n };\n results = [];\n for (i in k) {\n v = k[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest2 = function() {\n var i, ref, results, v;\n ref = [10, 2, 3];\n results = [];\n for (i in ref) {\n v = ref[i];\n results.push(log(i, v));\n }\n return results;\n};\n\ntest3 = function() {\n var QQBot, bot;\n QQBot = require('../src/qqbot');\n bot = new QQBot(100);\n bot.save_buddy_info({\n buddy: 100000\n });\n return log(bot);\n};\n\ntest4 = function() {\n var OOO;\n // 没法在 =-> 方法中调用 @方法\n return OOO = class OOO {\n constructor(name) {\n this.name = name;\n }\n\n ask() {\n log(\"ask\", this.name);\n return test();\n }\n\n };\n};\n```", "response": "#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =\n a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:1:completion", "type": "completion", "prompt": "#!/usr/bin/env coffee\nlog = console.log\nprompt = (title, callback) ->\n process.stdin.resume()\n process.stdout.write(title)\n process.stdin.once \"data\", (data) ->\n callback data.toString().trim()\n process.stdin.pause()\n # control + d to end\n process.stdin.on 'end', ->\n process.stdout.write('end')\n callback()\n\n\ntest_prompt = ->\n log \"hello\"\n prompt \"input something\", (content)->\n log content\n\n log \"end\"\n\n\ntest1 = ->\n log 'begin'\n k =", "response": "a:10\n b:20\n c:30\n\n for i,v of k\n log i , v\n\ntest2 = ->\n for i,v of [10,2,3]\n log i,v\n\n\ntest3 =->\n QQBot = require '../src/qqbot'\n bot = new QQBot(100)\n bot.save_buddy_info({buddy:100000})\n log bot\n\ntest4 =->\n # 没法在 =-> 方法中调用 @方法\n class OOO\n constructor:(@name)->\n ask:->\n log \"ask\",@name\n test()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "xhan/qqbot:tests/simple.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n @ask()\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('vvv')\n v.ask2()\n\ntest4()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 51, "line_end": 64} +{"id": "xhan/qqbot:tests/simple.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n @ask()\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('vvv')\n v.ask2()\n\ntest4()\n```", "response": "var test, test2, v;\n\ntest = function() {\n return log(\"test\");\n};\n\n({\n ask2: function() {\n log(\"ask2\");\n return this.ask();\n }\n});\n\n// test2()\ntest2 = function() {\n log(\"test2\");\n return test();\n};\n\nv = new OOO('vvv');\n\nv.ask2();\n\ntest4();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 51, "line_end": 64} +{"id": "xhan/qqbot:tests/simple.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar test, test2, v;\n\ntest = function() {\n return log(\"test\");\n};\n\n({\n ask2: function() {\n log(\"ask2\");\n return this.ask();\n }\n});\n\n// test2()\ntest2 = function() {\n log(\"test2\");\n return test();\n};\n\nv = new OOO('vvv');\n\nv.ask2();\n\ntest4();\n```", "response": "test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n @ask()\n # test2()\n test2 = ->\n log \"test2\"\n test()\n\n v = new OOO('vvv')\n v.ask2()\n\ntest4()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 51, "line_end": 64} +{"id": "xhan/qqbot:tests/simple.coffee:2:completion", "type": "completion", "prompt": "test = ->\n log \"test\"\n ask2:->\n log \"ask2\"\n @ask()\n # test2()\n test2 = ->", "response": "log \"test2\"\n test()\n\n v = new OOO('vvv')\n v.ask2()\n\ntest4()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/simple.coffee", "license": "MIT", "commit": "a799dfa406872914f0b3a4cbb8ec73602b1b3840", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/a799dfa406872914f0b3a4cbb8ec73602b1b3840/tests/simple.coffee", "line_start": 51, "line_end": 64} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "assembleFileMessage = (fileData, userData) ->\n _toId: userData._toId\n _roomId: userData._roomId\n _teamId: userData._teamId\n _storyId: userData._storyId\n _creatorId: userData._creatorId\n creator: userData.creator\n body: ''\n attachments: [\n category: 'file'\n data:\n fileId: fileData.fileId\n fileKey: fileData.fileKey\n fileName: fileData.fileName\n fileType: fileData.fileType\n fileSize: fileData.fileSize\n fileCategory: fileData.fileCategory\n imageWidth: fileData.imageWidth\n imageHeight: fileData.imageHeight\n downloadUrl: fileData.downloadUrl\n thumbnailUrl: fileData.thumbnailUrl\n ]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 11, "line_end": 32} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nassembleFileMessage = (fileData, userData) ->\n _toId: userData._toId\n _roomId: userData._roomId\n _teamId: userData._teamId\n _storyId: userData._storyId\n _creatorId: userData._creatorId\n creator: userData.creator\n body: ''\n attachments: [\n category: 'file'\n data:\n fileId: fileData.fileId\n fileKey: fileData.fileKey\n fileName: fileData.fileName\n fileType: fileData.fileType\n fileSize: fileData.fileSize\n fileCategory: fileData.fileCategory\n imageWidth: fileData.imageWidth\n imageHeight: fileData.imageHeight\n downloadUrl: fileData.downloadUrl\n thumbnailUrl: fileData.thumbnailUrl\n ]\n```", "response": "var assembleFileMessage;\n\nassembleFileMessage = function(fileData, userData) {\n return {\n _toId: userData._toId,\n _roomId: userData._roomId,\n _teamId: userData._teamId,\n _storyId: userData._storyId,\n _creatorId: userData._creatorId,\n creator: userData.creator,\n body: '',\n attachments: [\n {\n category: 'file',\n data: {\n fileId: fileData.fileId,\n fileKey: fileData.fileKey,\n fileName: fileData.fileName,\n fileType: fileData.fileType,\n fileSize: fileData.fileSize,\n fileCategory: fileData.fileCategory,\n imageWidth: fileData.imageWidth,\n imageHeight: fileData.imageHeight,\n downloadUrl: fileData.downloadUrl,\n thumbnailUrl: fileData.thumbnailUrl\n }\n }\n ]\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 11, "line_end": 32} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar assembleFileMessage;\n\nassembleFileMessage = function(fileData, userData) {\n return {\n _toId: userData._toId,\n _roomId: userData._roomId,\n _teamId: userData._teamId,\n _storyId: userData._storyId,\n _creatorId: userData._creatorId,\n creator: userData.creator,\n body: '',\n attachments: [\n {\n category: 'file',\n data: {\n fileId: fileData.fileId,\n fileKey: fileData.fileKey,\n fileName: fileData.fileName,\n fileType: fileData.fileType,\n fileSize: fileData.fileSize,\n fileCategory: fileData.fileCategory,\n imageWidth: fileData.imageWidth,\n imageHeight: fileData.imageHeight,\n downloadUrl: fileData.downloadUrl,\n thumbnailUrl: fileData.thumbnailUrl\n }\n }\n ]\n };\n};\n```", "response": "assembleFileMessage = (fileData, userData) ->\n _toId: userData._toId\n _roomId: userData._roomId\n _teamId: userData._teamId\n _storyId: userData._storyId\n _creatorId: userData._creatorId\n creator: userData.creator\n body: ''\n attachments: [\n category: 'file'\n data:\n fileId: fileData.fileId\n fileKey: fileData.fileKey\n fileName: fileData.fileName\n fileType: fileData.fileType\n fileSize: fileData.fileSize\n fileCategory: fileData.fileCategory\n imageWidth: fileData.imageWidth\n imageHeight: fileData.imageHeight\n downloadUrl: fileData.downloadUrl\n thumbnailUrl: fileData.thumbnailUrl\n ]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 11, "line_end": 32} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:1:completion", "type": "completion", "prompt": "assembleFileMessage = (fileData, userData) ->\n _toId: userData._toId\n _roomId: userData._roomId\n _teamId: userData._teamId\n _storyId: userData._storyId\n _creatorId: userData._creatorId\n creator: userData.creator\n body: ''\n attachments: [\n category: 'file'\n data:", "response": "fileId: fileData.fileId\n fileKey: fileData.fileKey\n fileName: fileData.fileName\n fileType: fileData.fileType\n fileSize: fileData.fileSize\n fileCategory: fileData.fileCategory\n imageWidth: fileData.imageWidth\n imageHeight: fileData.imageHeight\n downloadUrl: fileData.downloadUrl\n thumbnailUrl: fileData.thumbnailUrl\n ]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 11, "line_end": 32} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.fileCreate = (fileInfo, userData) ->\n fakeMessage = mockMessage(assembleFileMessage(fileInfo, userData))\n dispatcher.handleViewAction\n type: 'file/create'\n data: fakeMessage", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 34, "line_end": 38} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.fileCreate = (fileInfo, userData) ->\n fakeMessage = mockMessage(assembleFileMessage(fileInfo, userData))\n dispatcher.handleViewAction\n type: 'file/create'\n data: fakeMessage\n```", "response": "exports.fileCreate = function(fileInfo, userData) {\n var fakeMessage;\n fakeMessage = mockMessage(assembleFileMessage(fileInfo, userData));\n return dispatcher.handleViewAction({\n type: 'file/create',\n data: fakeMessage\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 34, "line_end": 38} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.fileCreate = function(fileInfo, userData) {\n var fakeMessage;\n fakeMessage = mockMessage(assembleFileMessage(fileInfo, userData));\n return dispatcher.handleViewAction({\n type: 'file/create',\n data: fakeMessage\n });\n};\n```", "response": "exports.fileCreate = (fileInfo, userData) ->\n fakeMessage = mockMessage(assembleFileMessage(fileInfo, userData))\n dispatcher.handleViewAction\n type: 'file/create'\n data: fakeMessage", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 34, "line_end": 38} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:2:completion", "type": "completion", "prompt": "exports.fileCreate = (fileInfo, userData) ->\n fakeMessage = mockMessage(assembleFileMessage(fileInfo, userData))", "response": "dispatcher.handleViewAction\n type: 'file/create'\n data: fakeMessage", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 34, "line_end": 38} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.fileProgress = (progress, fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/progress'\n data:\n fileId: fileInfo.fileId\n userData: userData\n progress: progress", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 40, "line_end": 46} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.fileProgress = (progress, fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/progress'\n data:\n fileId: fileInfo.fileId\n userData: userData\n progress: progress\n```", "response": "exports.fileProgress = function(progress, fileInfo, userData) {\n return dispatcher.handleViewAction({\n type: 'file/progress',\n data: {\n fileId: fileInfo.fileId,\n userData: userData,\n progress: progress\n }\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 40, "line_end": 46} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.fileProgress = function(progress, fileInfo, userData) {\n return dispatcher.handleViewAction({\n type: 'file/progress',\n data: {\n fileId: fileInfo.fileId,\n userData: userData,\n progress: progress\n }\n });\n};\n```", "response": "exports.fileProgress = (progress, fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/progress'\n data:\n fileId: fileInfo.fileId\n userData: userData\n progress: progress", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 40, "line_end": 46} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:3:completion", "type": "completion", "prompt": "exports.fileProgress = (progress, fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/progress'", "response": "data:\n fileId: fileInfo.fileId\n userData: userData\n progress: progress", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 40, "line_end": 46} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.fileSuccess = (fileData, fileInfo, userData) ->\n fileId = fileInfo.fileId\n store = recorder.getStore()\n dispatcher.handleViewAction\n type: 'file/success'\n data:\n fileData: fileData\n fileId: fileId\n userData: userData\n\n _channelId = lookup.getChannelId Immutable.fromJS userData\n fakeMessage = store.getIn(['messages', userData._teamId, _channelId]).find (message) ->\n fileId is message.getIn(['attachments', 0, 'data', 'fileId'])\n\n messageData = assembleFileMessage(fileData, userData)\n\n api.messages.create.post(data: messageData)\n .then (resp) ->\n # render local image, avoid re-download and re-render the uploaded image\n oldThumbnail = fakeMessage.getIn(['attachments', '0', 'data', 'thumbnailUrl'])\n if oldThumbnail\n resp.attachments[0].data.thumbnailUrl = oldThumbnail\n\n # don't move the local image\n resp.createdAt = fakeMessage.get('createdAt')\n resp.updatedAt = fakeMessage.get('updatedAt')\n resp.fakeId = fakeMessage.get('_id')\n\n dispatcher.handleViewAction\n type: 'message/correct'\n data: resp", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 48, "line_end": 78} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.fileSuccess = (fileData, fileInfo, userData) ->\n fileId = fileInfo.fileId\n store = recorder.getStore()\n dispatcher.handleViewAction\n type: 'file/success'\n data:\n fileData: fileData\n fileId: fileId\n userData: userData\n\n _channelId = lookup.getChannelId Immutable.fromJS userData\n fakeMessage = store.getIn(['messages', userData._teamId, _channelId]).find (message) ->\n fileId is message.getIn(['attachments', 0, 'data', 'fileId'])\n\n messageData = assembleFileMessage(fileData, userData)\n\n api.messages.create.post(data: messageData)\n .then (resp) ->\n # render local image, avoid re-download and re-render the uploaded image\n oldThumbnail = fakeMessage.getIn(['attachments', '0', 'data', 'thumbnailUrl'])\n if oldThumbnail\n resp.attachments[0].data.thumbnailUrl = oldThumbnail\n\n # don't move the local image\n resp.createdAt = fakeMessage.get('createdAt')\n resp.updatedAt = fakeMessage.get('updatedAt')\n resp.fakeId = fakeMessage.get('_id')\n\n dispatcher.handleViewAction\n type: 'message/correct'\n data: resp\n```", "response": "exports.fileSuccess = function(fileData, fileInfo, userData) {\n var _channelId, fakeMessage, fileId, messageData, store;\n fileId = fileInfo.fileId;\n store = recorder.getStore();\n dispatcher.handleViewAction({\n type: 'file/success',\n data: {\n fileData: fileData,\n fileId: fileId,\n userData: userData\n }\n });\n _channelId = lookup.getChannelId(Immutable.fromJS(userData));\n fakeMessage = store.getIn(['messages', userData._teamId, _channelId]).find(function(message) {\n return fileId === message.getIn(['attachments', 0, 'data', 'fileId']);\n });\n messageData = assembleFileMessage(fileData, userData);\n return api.messages.create.post({\n data: messageData\n }).then(function(resp) {\n var oldThumbnail;\n // render local image, avoid re-download and re-render the uploaded image\n oldThumbnail = fakeMessage.getIn(['attachments', '0', 'data', 'thumbnailUrl']);\n if (oldThumbnail) {\n resp.attachments[0].data.thumbnailUrl = oldThumbnail;\n }\n // don't move the local image\n resp.createdAt = fakeMessage.get('createdAt');\n resp.updatedAt = fakeMessage.get('updatedAt');\n resp.fakeId = fakeMessage.get('_id');\n return dispatcher.handleViewAction({\n type: 'message/correct',\n data: resp\n });\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 48, "line_end": 78} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.fileSuccess = function(fileData, fileInfo, userData) {\n var _channelId, fakeMessage, fileId, messageData, store;\n fileId = fileInfo.fileId;\n store = recorder.getStore();\n dispatcher.handleViewAction({\n type: 'file/success',\n data: {\n fileData: fileData,\n fileId: fileId,\n userData: userData\n }\n });\n _channelId = lookup.getChannelId(Immutable.fromJS(userData));\n fakeMessage = store.getIn(['messages', userData._teamId, _channelId]).find(function(message) {\n return fileId === message.getIn(['attachments', 0, 'data', 'fileId']);\n });\n messageData = assembleFileMessage(fileData, userData);\n return api.messages.create.post({\n data: messageData\n }).then(function(resp) {\n var oldThumbnail;\n // render local image, avoid re-download and re-render the uploaded image\n oldThumbnail = fakeMessage.getIn(['attachments', '0', 'data', 'thumbnailUrl']);\n if (oldThumbnail) {\n resp.attachments[0].data.thumbnailUrl = oldThumbnail;\n }\n // don't move the local image\n resp.createdAt = fakeMessage.get('createdAt');\n resp.updatedAt = fakeMessage.get('updatedAt');\n resp.fakeId = fakeMessage.get('_id');\n return dispatcher.handleViewAction({\n type: 'message/correct',\n data: resp\n });\n });\n};\n```", "response": "exports.fileSuccess = (fileData, fileInfo, userData) ->\n fileId = fileInfo.fileId\n store = recorder.getStore()\n dispatcher.handleViewAction\n type: 'file/success'\n data:\n fileData: fileData\n fileId: fileId\n userData: userData\n\n _channelId = lookup.getChannelId Immutable.fromJS userData\n fakeMessage = store.getIn(['messages', userData._teamId, _channelId]).find (message) ->\n fileId is message.getIn(['attachments', 0, 'data', 'fileId'])\n\n messageData = assembleFileMessage(fileData, userData)\n\n api.messages.create.post(data: messageData)\n .then (resp) ->\n # render local image, avoid re-download and re-render the uploaded image\n oldThumbnail = fakeMessage.getIn(['attachments', '0', 'data', 'thumbnailUrl'])\n if oldThumbnail\n resp.attachments[0].data.thumbnailUrl = oldThumbnail\n\n # don't move the local image\n resp.createdAt = fakeMessage.get('createdAt')\n resp.updatedAt = fakeMessage.get('updatedAt')\n resp.fakeId = fakeMessage.get('_id')\n\n dispatcher.handleViewAction\n type: 'message/correct'\n data: resp", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 48, "line_end": 78} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:4:completion", "type": "completion", "prompt": "exports.fileSuccess = (fileData, fileInfo, userData) ->\n fileId = fileInfo.fileId\n store = recorder.getStore()\n dispatcher.handleViewAction\n type: 'file/success'\n data:\n fileData: fileData\n fileId: fileId\n userData: userData\n\n _channelId = lookup.getChannelId Immutable.fromJS userData\n fakeMessage = store.getIn(['messages', userData._teamId, _channelId]).find (message) ->\n fileId is message.getIn(['attachments', 0, 'data', 'fileId'])\n\n messageData = assembleFileMessage(fileData, userData)", "response": "api.messages.create.post(data: messageData)\n .then (resp) ->\n # render local image, avoid re-download and re-render the uploaded image\n oldThumbnail = fakeMessage.getIn(['attachments', '0', 'data', 'thumbnailUrl'])\n if oldThumbnail\n resp.attachments[0].data.thumbnailUrl = oldThumbnail\n\n # don't move the local image\n resp.createdAt = fakeMessage.get('createdAt')\n resp.updatedAt = fakeMessage.get('updatedAt')\n resp.fakeId = fakeMessage.get('_id')\n\n dispatcher.handleViewAction\n type: 'message/correct'\n data: resp", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 48, "line_end": 78} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.fileError = (fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/error'\n data:\n fileId: fileInfo.fileId\n userData: userData", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 80, "line_end": 85} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.fileError = (fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/error'\n data:\n fileId: fileInfo.fileId\n userData: userData\n```", "response": "exports.fileError = function(fileInfo, userData) {\n return dispatcher.handleViewAction({\n type: 'file/error',\n data: {\n fileId: fileInfo.fileId,\n userData: userData\n }\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 80, "line_end": 85} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.fileError = function(fileInfo, userData) {\n return dispatcher.handleViewAction({\n type: 'file/error',\n data: {\n fileId: fileInfo.fileId,\n userData: userData\n }\n });\n};\n```", "response": "exports.fileError = (fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/error'\n data:\n fileId: fileInfo.fileId\n userData: userData", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 80, "line_end": 85} +{"id": "jianliaoim/talk-os:talk-web/client/actions/file.coffee:5:completion", "type": "completion", "prompt": "exports.fileError = (fileInfo, userData) ->\n dispatcher.handleViewAction\n type: 'file/error'", "response": "data:\n fileId: fileInfo.fileId\n userData: userData", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/file.coffee", "line_start": 80, "line_end": 85} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'captcha-icons'\n\n propTypes:\n onSelect: React.PropTypes.func.isRequired\n lang: React.PropTypes.string.isRequired\n isDone: React.PropTypes.bool.isRequired\n\n getInitialState: ->\n info: null\n isForbidden: false\n error: null\n\n componentDidMount: ->\n @loadSetupInfo()\n\n loadSetupInfo: ->\n ajax.captchaSetup\n data:\n num: 5\n lang: @props.lang\n success: (resp) =>\n @setState info: resp\n error: (err) =>\n # error = JSON.parse err.response\n\n onRefresh: ->\n @setState info: null, error: null\n @props.onSelect null\n @loadSetupInfo()\n\n onCheck: (index) ->\n ajax.captchaValid\n data:\n uid: @state.info.uid\n value: @state.info.values[index]\n error: (err) =>\n if err.status is 429\n @setState isForbidden: true\n @setState error: err.response\n success: (resp) =>\n if resp.valid\n @props.onSelect @state.info.uid\n else\n @setState error: locales.get('invalidedCaptchaTryAgain', @props.lang)\n @loadSetupInfo()\n\n renderChooser: ->\n guideText = locales.get('pleaseSelectX', @props.lang)\n .replace '%s', @state.info.imageName", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 13, "line_end": 62} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'captcha-icons'\n\n propTypes:\n onSelect: React.PropTypes.func.isRequired\n lang: React.PropTypes.string.isRequired\n isDone: React.PropTypes.bool.isRequired\n\n getInitialState: ->\n info: null\n isForbidden: false\n error: null\n\n componentDidMount: ->\n @loadSetupInfo()\n\n loadSetupInfo: ->\n ajax.captchaSetup\n data:\n num: 5\n lang: @props.lang\n success: (resp) =>\n @setState info: resp\n error: (err) =>\n # error = JSON.parse err.response\n\n onRefresh: ->\n @setState info: null, error: null\n @props.onSelect null\n @loadSetupInfo()\n\n onCheck: (index) ->\n ajax.captchaValid\n data:\n uid: @state.info.uid\n value: @state.info.values[index]\n error: (err) =>\n if err.status is 429\n @setState isForbidden: true\n @setState error: err.response\n success: (resp) =>\n if resp.valid\n @props.onSelect @state.info.uid\n else\n @setState error: locales.get('invalidedCaptchaTryAgain', @props.lang)\n @loadSetupInfo()\n\n renderChooser: ->\n guideText = locales.get('pleaseSelectX', @props.lang)\n .replace '%s', @state.info.imageName\n```", "response": "module.exports = React.createClass({\n displayName: 'captcha-icons',\n propTypes: {\n onSelect: React.PropTypes.func.isRequired,\n lang: React.PropTypes.string.isRequired,\n isDone: React.PropTypes.bool.isRequired\n },\n getInitialState: function() {\n return {\n info: null,\n isForbidden: false,\n error: null\n };\n },\n componentDidMount: function() {\n return this.loadSetupInfo();\n },\n loadSetupInfo: function() {\n return ajax.captchaSetup({\n data: {\n num: 5,\n lang: this.props.lang\n },\n success: (resp) => {\n return this.setState({\n info: resp\n });\n },\n error: (err) => {}\n });\n },\n // error = JSON.parse err.response\n onRefresh: function() {\n this.setState({\n info: null,\n error: null\n });\n this.props.onSelect(null);\n return this.loadSetupInfo();\n },\n onCheck: function(index) {\n return ajax.captchaValid({\n data: {\n uid: this.state.info.uid,\n value: this.state.info.values[index]\n },\n error: (err) => {\n if (err.status === 429) {\n this.setState({\n isForbidden: true\n });\n }\n return this.setState({\n error: err.response\n });\n },\n success: (resp) => {\n if (resp.valid) {\n return this.props.onSelect(this.state.info.uid);\n } else {\n this.setState({\n error: locales.get('invalidedCaptchaTryAgain', this.props.lang)\n });\n return this.loadSetupInfo();\n }\n }\n });\n },\n renderChooser: function() {\n var guideText;\n return guideText = locales.get('pleaseSelectX', this.props.lang).replace('%s', this.state.info.imageName);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 13, "line_end": 62} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'captcha-icons',\n propTypes: {\n onSelect: React.PropTypes.func.isRequired,\n lang: React.PropTypes.string.isRequired,\n isDone: React.PropTypes.bool.isRequired\n },\n getInitialState: function() {\n return {\n info: null,\n isForbidden: false,\n error: null\n };\n },\n componentDidMount: function() {\n return this.loadSetupInfo();\n },\n loadSetupInfo: function() {\n return ajax.captchaSetup({\n data: {\n num: 5,\n lang: this.props.lang\n },\n success: (resp) => {\n return this.setState({\n info: resp\n });\n },\n error: (err) => {}\n });\n },\n // error = JSON.parse err.response\n onRefresh: function() {\n this.setState({\n info: null,\n error: null\n });\n this.props.onSelect(null);\n return this.loadSetupInfo();\n },\n onCheck: function(index) {\n return ajax.captchaValid({\n data: {\n uid: this.state.info.uid,\n value: this.state.info.values[index]\n },\n error: (err) => {\n if (err.status === 429) {\n this.setState({\n isForbidden: true\n });\n }\n return this.setState({\n error: err.response\n });\n },\n success: (resp) => {\n if (resp.valid) {\n return this.props.onSelect(this.state.info.uid);\n } else {\n this.setState({\n error: locales.get('invalidedCaptchaTryAgain', this.props.lang)\n });\n return this.loadSetupInfo();\n }\n }\n });\n },\n renderChooser: function() {\n var guideText;\n return guideText = locales.get('pleaseSelectX', this.props.lang).replace('%s', this.state.info.imageName);\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'captcha-icons'\n\n propTypes:\n onSelect: React.PropTypes.func.isRequired\n lang: React.PropTypes.string.isRequired\n isDone: React.PropTypes.bool.isRequired\n\n getInitialState: ->\n info: null\n isForbidden: false\n error: null\n\n componentDidMount: ->\n @loadSetupInfo()\n\n loadSetupInfo: ->\n ajax.captchaSetup\n data:\n num: 5\n lang: @props.lang\n success: (resp) =>\n @setState info: resp\n error: (err) =>\n # error = JSON.parse err.response\n\n onRefresh: ->\n @setState info: null, error: null\n @props.onSelect null\n @loadSetupInfo()\n\n onCheck: (index) ->\n ajax.captchaValid\n data:\n uid: @state.info.uid\n value: @state.info.values[index]\n error: (err) =>\n if err.status is 429\n @setState isForbidden: true\n @setState error: err.response\n success: (resp) =>\n if resp.valid\n @props.onSelect @state.info.uid\n else\n @setState error: locales.get('invalidedCaptchaTryAgain', @props.lang)\n @loadSetupInfo()\n\n renderChooser: ->\n guideText = locales.get('pleaseSelectX', @props.lang)\n .replace '%s', @state.info.imageName", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 13, "line_end": 62} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'captcha-icons'\n\n propTypes:\n onSelect: React.PropTypes.func.isRequired\n lang: React.PropTypes.string.isRequired\n isDone: React.PropTypes.bool.isRequired\n\n getInitialState: ->\n info: null\n isForbidden: false\n error: null\n\n componentDidMount: ->\n @loadSetupInfo()\n\n loadSetupInfo: ->\n ajax.captchaSetup\n data:\n num: 5\n lang: @props.lang\n success: (resp) =>\n @setState info: resp\n error: (err) =>\n # error = JSON.parse err.response", "response": "onRefresh: ->\n @setState info: null, error: null\n @props.onSelect null\n @loadSetupInfo()\n\n onCheck: (index) ->\n ajax.captchaValid\n data:\n uid: @state.info.uid\n value: @state.info.values[index]\n error: (err) =>\n if err.status is 429\n @setState isForbidden: true\n @setState error: err.response\n success: (resp) =>\n if resp.valid\n @props.onSelect @state.info.uid\n else\n @setState error: locales.get('invalidedCaptchaTryAgain', @props.lang)\n @loadSetupInfo()\n\n renderChooser: ->\n guideText = locales.get('pleaseSelectX', @props.lang)\n .replace '%s', @state.info.imageName", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 13, "line_end": 62} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "div className: 'captcha-icons is-default',\n div className: 'as-head',\n span className: 'text-guide', guideText\n span className: 'icon icon-refresh', onClick: @onRefresh\n Space height: 10\n div className: 'as-body',\n @state.info.values.map (imageId, index) =>\n imageUrl = ajax.captchaImage @state.info.uid, @props.lang, index\n onCheck = => @onCheck index\n img key: index, className: 'captcha-icon', src: imageUrl, onClick: onCheck\n if @state.error?\n div className: 'as-response',\n Space height: 10\n span className: 'hint-error', @state.error\n\n renderLoading: ->\n div className: 'captcha-icons is-loading',\n locales.get('loading', @props.lang)\n\n renderDone: ->\n div className: 'captcha-icons is-successful',\n span className: 'icon icon-circle-check'\n Space width: 5\n span className: 'text-guide', locales.get('captchaSucceed', @props.lang)\n\n renderForbidden: ->\n div className: 'captcha-icon is-forbidden',\n span className: 'hint-error', locales.get('captchaTooManyTime', @props.lang)\n\n render: ->\n if @props.isDone\n @renderDone()\n else if @state.isForbidden\n @renderForbidden()\n else if @state.info?\n @renderChooser()\n else\n @renderLoading()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 63, "line_end": 101} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndiv className: 'captcha-icons is-default',\n div className: 'as-head',\n span className: 'text-guide', guideText\n span className: 'icon icon-refresh', onClick: @onRefresh\n Space height: 10\n div className: 'as-body',\n @state.info.values.map (imageId, index) =>\n imageUrl = ajax.captchaImage @state.info.uid, @props.lang, index\n onCheck = => @onCheck index\n img key: index, className: 'captcha-icon', src: imageUrl, onClick: onCheck\n if @state.error?\n div className: 'as-response',\n Space height: 10\n span className: 'hint-error', @state.error\n\n renderLoading: ->\n div className: 'captcha-icons is-loading',\n locales.get('loading', @props.lang)\n\n renderDone: ->\n div className: 'captcha-icons is-successful',\n span className: 'icon icon-circle-check'\n Space width: 5\n span className: 'text-guide', locales.get('captchaSucceed', @props.lang)\n\n renderForbidden: ->\n div className: 'captcha-icon is-forbidden',\n span className: 'hint-error', locales.get('captchaTooManyTime', @props.lang)\n\n render: ->\n if @props.isDone\n @renderDone()\n else if @state.isForbidden\n @renderForbidden()\n else if @state.info?\n @renderChooser()\n else\n @renderLoading()\n```", "response": "div({\n className: 'captcha-icons is-default'\n}, div({\n className: 'as-head'\n}, span({\n className: 'text-guide'\n}, guideText), span({\n className: 'icon icon-refresh',\n onClick: this.onRefresh\n})), Space({\n height: 10\n}), div({\n className: 'as-body'\n}, this.state.info.values.map((imageId, index) => {\n var imageUrl, onCheck;\n imageUrl = ajax.captchaImage(this.state.info.uid, this.props.lang, index);\n onCheck = () => {\n return this.onCheck(index);\n };\n return img({\n key: index,\n className: 'captcha-icon',\n src: imageUrl,\n onClick: onCheck\n });\n})), this.state.error != null ? div({\n className: 'as-response'\n}, Space({\n height: 10\n}), span({\n className: 'hint-error'\n}, this.state.error)) : void 0);\n\n({\n renderLoading: function() {\n return div({\n className: 'captcha-icons is-loading'\n }, locales.get('loading', this.props.lang));\n },\n renderDone: function() {\n return div({\n className: 'captcha-icons is-successful'\n }, span({\n className: 'icon icon-circle-check'\n }), Space({\n width: 5\n }), span({\n className: 'text-guide'\n }, locales.get('captchaSucceed', this.props.lang)));\n },\n renderForbidden: function() {\n return div({\n className: 'captcha-icon is-forbidden'\n }, span({\n className: 'hint-error'\n }, locales.get('captchaTooManyTime', this.props.lang)));\n },\n render: function() {\n if (this.props.isDone) {\n return this.renderDone();\n } else if (this.state.isForbidden) {\n return this.renderForbidden();\n } else if (this.state.info != null) {\n return this.renderChooser();\n } else {\n return this.renderLoading();\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 63, "line_end": 101} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndiv({\n className: 'captcha-icons is-default'\n}, div({\n className: 'as-head'\n}, span({\n className: 'text-guide'\n}, guideText), span({\n className: 'icon icon-refresh',\n onClick: this.onRefresh\n})), Space({\n height: 10\n}), div({\n className: 'as-body'\n}, this.state.info.values.map((imageId, index) => {\n var imageUrl, onCheck;\n imageUrl = ajax.captchaImage(this.state.info.uid, this.props.lang, index);\n onCheck = () => {\n return this.onCheck(index);\n };\n return img({\n key: index,\n className: 'captcha-icon',\n src: imageUrl,\n onClick: onCheck\n });\n})), this.state.error != null ? div({\n className: 'as-response'\n}, Space({\n height: 10\n}), span({\n className: 'hint-error'\n}, this.state.error)) : void 0);\n\n({\n renderLoading: function() {\n return div({\n className: 'captcha-icons is-loading'\n }, locales.get('loading', this.props.lang));\n },\n renderDone: function() {\n return div({\n className: 'captcha-icons is-successful'\n }, span({\n className: 'icon icon-circle-check'\n }), Space({\n width: 5\n }), span({\n className: 'text-guide'\n }, locales.get('captchaSucceed', this.props.lang)));\n },\n renderForbidden: function() {\n return div({\n className: 'captcha-icon is-forbidden'\n }, span({\n className: 'hint-error'\n }, locales.get('captchaTooManyTime', this.props.lang)));\n },\n render: function() {\n if (this.props.isDone) {\n return this.renderDone();\n } else if (this.state.isForbidden) {\n return this.renderForbidden();\n } else if (this.state.info != null) {\n return this.renderChooser();\n } else {\n return this.renderLoading();\n }\n }\n});\n```", "response": "div className: 'captcha-icons is-default',\n div className: 'as-head',\n span className: 'text-guide', guideText\n span className: 'icon icon-refresh', onClick: @onRefresh\n Space height: 10\n div className: 'as-body',\n @state.info.values.map (imageId, index) =>\n imageUrl = ajax.captchaImage @state.info.uid, @props.lang, index\n onCheck = => @onCheck index\n img key: index, className: 'captcha-icon', src: imageUrl, onClick: onCheck\n if @state.error?\n div className: 'as-response',\n Space height: 10\n span className: 'hint-error', @state.error\n\n renderLoading: ->\n div className: 'captcha-icons is-loading',\n locales.get('loading', @props.lang)\n\n renderDone: ->\n div className: 'captcha-icons is-successful',\n span className: 'icon icon-circle-check'\n Space width: 5\n span className: 'text-guide', locales.get('captchaSucceed', @props.lang)\n\n renderForbidden: ->\n div className: 'captcha-icon is-forbidden',\n span className: 'hint-error', locales.get('captchaTooManyTime', @props.lang)\n\n render: ->\n if @props.isDone\n @renderDone()\n else if @state.isForbidden\n @renderForbidden()\n else if @state.info?\n @renderChooser()\n else\n @renderLoading()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 63, "line_end": 101} +{"id": "jianliaoim/talk-os:talk-account/client/app/captcha-icons.coffee:2:completion", "type": "completion", "prompt": "div className: 'captcha-icons is-default',\n div className: 'as-head',\n span className: 'text-guide', guideText\n span className: 'icon icon-refresh', onClick: @onRefresh\n Space height: 10\n div className: 'as-body',\n @state.info.values.map (imageId, index) =>\n imageUrl = ajax.captchaImage @state.info.uid, @props.lang, index\n onCheck = => @onCheck index\n img key: index, className: 'captcha-icon', src: imageUrl, onClick: onCheck\n if @state.error?\n div className: 'as-response',\n Space height: 10\n span className: 'hint-error', @state.error\n\n renderLoading: ->\n div className: 'captcha-icons is-loading',\n locales.get('loading', @props.lang)", "response": "renderDone: ->\n div className: 'captcha-icons is-successful',\n span className: 'icon icon-circle-check'\n Space width: 5\n span className: 'text-guide', locales.get('captchaSucceed', @props.lang)\n\n renderForbidden: ->\n div className: 'captcha-icon is-forbidden',\n span className: 'hint-error', locales.get('captchaTooManyTime', @props.lang)\n\n render: ->\n if @props.isDone\n @renderDone()\n else if @state.isForbidden\n @renderForbidden()\n else if @state.info?\n @renderChooser()\n else\n @renderLoading()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/app/captcha-icons.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/captcha-icons.coffee", "line_start": 63, "line_end": 101} +{"id": "jianliaoim/talk-os:talk-web/client/app/contact-item.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'contact-item'\n\n propTypes:\n _teamId: T.string\n contact: T.instanceOf(Immutable.Map)\n isInvite: T.bool\n showAction: T.bool\n onClick: T.func\n invitations: T.instanceOf(Immutable.List)\n\n getDefaultProps: ->\n showAction: true\n isInvite: false\n invitations: Immutable.List()\n\n isMe: ->\n _userId = query.userId(recorder.getState())\n @props.contact.get('_id') is _userId\n\n onClick: ->\n @props.onClick?()\n\n renderRobotIcon: ->\n return null if not detect.isRobot(@props.contact)\n Icon name: 'bot', size: 18\n\n renderQuitHint: ->\n if @props.contact.get('isQuit')\n span className: 'muted info flex-static', \"#{l('contact-quitted')}\"\n\n renderContact: ->\n cxItem = cx 'contact-item', 'flex-horiz', 'flex-vcenter', 'line', 'is-clickable': @props.onClick?\n role = if @props.isInvite then 'not-actived' else @props.contact.get('role')\n\n div className: cxItem, key: @props.contact.get('_id'), onClick: @onClick,\n div className: 'content flex-horiz flex-fill flex-vcenter line text-overflow',\n @renderAvatar()\n @renderBody()\n @renderQuitHint()\n if @props.showAction\n if @props.contact.get('isGuest')\n span className: 'role muted flex-static', lang.getText('quote-guest')\n else\n span className: 'role muted flex-static', lang.getText(role)\n @props.children\n\n renderAvatar: ->\n props =\n size: 'small'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/contact-item.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/contact-item.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/contact-item.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'contact-item'\n\n propTypes:\n _teamId: T.string\n contact: T.instanceOf(Immutable.Map)\n isInvite: T.bool\n showAction: T.bool\n onClick: T.func\n invitations: T.instanceOf(Immutable.List)\n\n getDefaultProps: ->\n showAction: true\n isInvite: false\n invitations: Immutable.List()\n\n isMe: ->\n _userId = query.userId(recorder.getState())\n @props.contact.get('_id') is _userId\n\n onClick: ->\n @props.onClick?()\n\n renderRobotIcon: ->\n return null if not detect.isRobot(@props.contact)\n Icon name: 'bot', size: 18\n\n renderQuitHint: ->\n if @props.contact.get('isQuit')\n span className: 'muted info flex-static', \"#{l('contact-quitted')}\"\n\n renderContact: ->\n cxItem = cx 'contact-item', 'flex-horiz', 'flex-vcenter', 'line', 'is-clickable': @props.onClick?\n role = if @props.isInvite then 'not-actived' else @props.contact.get('role')\n\n div className: cxItem, key: @props.contact.get('_id'), onClick: @onClick,\n div className: 'content flex-horiz flex-fill flex-vcenter line text-overflow',\n @renderAvatar()\n @renderBody()\n @renderQuitHint()\n if @props.showAction\n if @props.contact.get('isGuest')\n span className: 'role muted flex-static', lang.getText('quote-guest')\n else\n span className: 'role muted flex-static', lang.getText(role)\n @props.children\n\n renderAvatar: ->\n props =\n size: 'small'\n```", "response": "module.exports = React.createClass({\n displayName: 'contact-item',\n propTypes: {\n _teamId: T.string,\n contact: T.instanceOf(Immutable.Map),\n isInvite: T.bool,\n showAction: T.bool,\n onClick: T.func,\n invitations: T.instanceOf(Immutable.List)\n },\n getDefaultProps: function() {\n return {\n showAction: true,\n isInvite: false,\n invitations: Immutable.List()\n };\n },\n isMe: function() {\n var _userId;\n _userId = query.userId(recorder.getState());\n return this.props.contact.get('_id') === _userId;\n },\n onClick: function() {\n var base;\n return typeof (base = this.props).onClick === \"function\" ? base.onClick() : void 0;\n },\n renderRobotIcon: function() {\n if (!detect.isRobot(this.props.contact)) {\n return null;\n }\n return Icon({\n name: 'bot',\n size: 18\n });\n },\n renderQuitHint: function() {\n if (this.props.contact.get('isQuit')) {\n return span({\n className: 'muted info flex-static'\n }, `${l('contact-quitted')}`);\n }\n },\n renderContact: function() {\n var cxItem, role;\n cxItem = cx('contact-item', 'flex-horiz', 'flex-vcenter', 'line', {\n 'is-clickable': this.props.onClick != null\n });\n role = this.props.isInvite ? 'not-actived' : this.props.contact.get('role');\n return div({\n className: cxItem,\n key: this.props.contact.get('_id'),\n onClick: this.onClick\n }, div({\n className: 'content flex-horiz flex-fill flex-vcenter line text-overflow'\n }, this.renderAvatar(), this.renderBody(), this.renderQuitHint()), this.props.showAction ? this.props.contact.get('isGuest') ? span({\n className: 'role muted flex-static'\n }, lang.getText('quote-guest')) : span({\n className: 'role muted flex-static'\n }, lang.getText(role)) : void 0, this.props.children);\n },\n renderAvatar: function() {\n var props;\n return props = {\n size: 'small'\n };\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/contact-item.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/contact-item.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/contact-item.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'contact-item',\n propTypes: {\n _teamId: T.string,\n contact: T.instanceOf(Immutable.Map),\n isInvite: T.bool,\n showAction: T.bool,\n onClick: T.func,\n invitations: T.instanceOf(Immutable.List)\n },\n getDefaultProps: function() {\n return {\n showAction: true,\n isInvite: false,\n invitations: Immutable.List()\n };\n },\n isMe: function() {\n var _userId;\n _userId = query.userId(recorder.getState());\n return this.props.contact.get('_id') === _userId;\n },\n onClick: function() {\n var base;\n return typeof (base = this.props).onClick === \"function\" ? base.onClick() : void 0;\n },\n renderRobotIcon: function() {\n if (!detect.isRobot(this.props.contact)) {\n return null;\n }\n return Icon({\n name: 'bot',\n size: 18\n });\n },\n renderQuitHint: function() {\n if (this.props.contact.get('isQuit')) {\n return span({\n className: 'muted info flex-static'\n }, `${l('contact-quitted')}`);\n }\n },\n renderContact: function() {\n var cxItem, role;\n cxItem = cx('contact-item', 'flex-horiz', 'flex-vcenter', 'line', {\n 'is-clickable': this.props.onClick != null\n });\n role = this.props.isInvite ? 'not-actived' : this.props.contact.get('role');\n return div({\n className: cxItem,\n key: this.props.contact.get('_id'),\n onClick: this.onClick\n }, div({\n className: 'content flex-horiz flex-fill flex-vcenter line text-overflow'\n }, this.renderAvatar(), this.renderBody(), this.renderQuitHint()), this.props.showAction ? this.props.contact.get('isGuest') ? span({\n className: 'role muted flex-static'\n }, lang.getText('quote-guest')) : span({\n className: 'role muted flex-static'\n }, lang.getText(role)) : void 0, this.props.children);\n },\n renderAvatar: function() {\n var props;\n return props = {\n size: 'small'\n };\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'contact-item'\n\n propTypes:\n _teamId: T.string\n contact: T.instanceOf(Immutable.Map)\n isInvite: T.bool\n showAction: T.bool\n onClick: T.func\n invitations: T.instanceOf(Immutable.List)\n\n getDefaultProps: ->\n showAction: true\n isInvite: false\n invitations: Immutable.List()\n\n isMe: ->\n _userId = query.userId(recorder.getState())\n @props.contact.get('_id') is _userId\n\n onClick: ->\n @props.onClick?()\n\n renderRobotIcon: ->\n return null if not detect.isRobot(@props.contact)\n Icon name: 'bot', size: 18\n\n renderQuitHint: ->\n if @props.contact.get('isQuit')\n span className: 'muted info flex-static', \"#{l('contact-quitted')}\"\n\n renderContact: ->\n cxItem = cx 'contact-item', 'flex-horiz', 'flex-vcenter', 'line', 'is-clickable': @props.onClick?\n role = if @props.isInvite then 'not-actived' else @props.contact.get('role')\n\n div className: cxItem, key: @props.contact.get('_id'), onClick: @onClick,\n div className: 'content flex-horiz flex-fill flex-vcenter line text-overflow',\n @renderAvatar()\n @renderBody()\n @renderQuitHint()\n if @props.showAction\n if @props.contact.get('isGuest')\n span className: 'role muted flex-static', lang.getText('quote-guest')\n else\n span className: 'role muted flex-static', lang.getText(role)\n @props.children\n\n renderAvatar: ->\n props =\n size: 'small'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/contact-item.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/contact-item.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/contact-item.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'contact-item'\n\n propTypes:\n _teamId: T.string\n contact: T.instanceOf(Immutable.Map)\n isInvite: T.bool\n showAction: T.bool\n onClick: T.func\n invitations: T.instanceOf(Immutable.List)\n\n getDefaultProps: ->\n showAction: true\n isInvite: false\n invitations: Immutable.List()\n\n isMe: ->\n _userId = query.userId(recorder.getState())\n @props.contact.get('_id') is _userId\n\n onClick: ->\n @props.onClick?()\n\n renderRobotIcon: ->\n return null if not detect.isRobot(@props.contact)", "response": "Icon name: 'bot', size: 18\n\n renderQuitHint: ->\n if @props.contact.get('isQuit')\n span className: 'muted info flex-static', \"#{l('contact-quitted')}\"\n\n renderContact: ->\n cxItem = cx 'contact-item', 'flex-horiz', 'flex-vcenter', 'line', 'is-clickable': @props.onClick?\n role = if @props.isInvite then 'not-actived' else @props.contact.get('role')\n\n div className: cxItem, key: @props.contact.get('_id'), onClick: @onClick,\n div className: 'content flex-horiz flex-fill flex-vcenter line text-overflow',\n @renderAvatar()\n @renderBody()\n @renderQuitHint()\n if @props.showAction\n if @props.contact.get('isGuest')\n span className: 'role muted flex-static', lang.getText('quote-guest')\n else\n span className: 'role muted flex-static', lang.getText(role)\n @props.children\n\n renderAvatar: ->\n props =\n size: 'small'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/contact-item.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/contact-item.coffee", "line_start": 26, "line_end": 75} +{"id": "jianliaoim/talk-os:talk-web/client/app/contact-item.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "shape: 'round'\n className: 'flex-static'\n if @props.contact.get('avatarUrl')\n props.src = @props.contact.get('avatarUrl')\n else\n props.className = 'no-avatar'\n\n Avatar(props)\n\n renderBody: ->\n div className: 'body flex-horiz line flex-fill',\n UserAlias\n _teamId: @props._teamId\n _userId: @props.contact.get('_id')\n defaultName: @props.contact.get('name')\n if @isMe()\n span className: 'muted info flex-static', \"(#{l('me')})\"\n @renderRobotIcon()\n\n render: ->\n @renderContact()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/contact-item.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/contact-item.coffee", "line_start": 76, "line_end": 96} +{"id": "jianliaoim/talk-os:talk-web/client/app/contact-item.coffee:2:completion", "type": "completion", "prompt": "shape: 'round'\n className: 'flex-static'\n if @props.contact.get('avatarUrl')\n props.src = @props.contact.get('avatarUrl')\n else\n props.className = 'no-avatar'\n\n Avatar(props)\n\n renderBody: ->", "response": "div className: 'body flex-horiz line flex-fill',\n UserAlias\n _teamId: @props._teamId\n _userId: @props.contact.get('_id')\n defaultName: @props.contact.get('name')\n if @isMe()\n span className: 'muted info flex-static', \"(#{l('me')})\"\n @renderRobotIcon()\n\n render: ->\n @renderContact()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/contact-item.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/contact-item.coffee", "line_start": 76, "line_end": 96} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\n#\n# JSON Widget\n#\ncyclotronApp.controller 'JsonWidget', ($scope, aceService, configService, dashboardService, dataService) ->\n\n $scope.jsonData = null;\n\n $scope.aceLoaded = (editor) ->\n editor.setOptions {\n #maxLines: Infinity\n highlightActiveLine: false\n }\n editor.setReadOnly true\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode: false\n showGutter: true\n showPrintMargin: false\n\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 1, "line_end": 39} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\n#\n# JSON Widget\n#\ncyclotronApp.controller 'JsonWidget', ($scope, aceService, configService, dashboardService, dataService) ->\n\n $scope.jsonData = null;\n\n $scope.aceLoaded = (editor) ->\n editor.setOptions {\n #maxLines: Infinity\n highlightActiveLine: false\n }\n editor.setReadOnly true\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode: false\n showGutter: true\n showPrintMargin: false\n\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded\n```", "response": "/*\n * Copyright (c) 2013-2018 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\n\n// JSON Widget\n\ncyclotronApp.controller('JsonWidget', function($scope, aceService, configService, dashboardService, dataService) {\n $scope.jsonData = null;\n $scope.aceLoaded = function(editor) {\n editor.setOptions({\n //maxLines: Infinity\n highlightActiveLine: false\n });\n return editor.setReadOnly(true);\n };\n // Settings for the JSON Editor\n return $scope.aceOptions = {\n useWrapMode: false,\n showGutter: true,\n showPrintMargin: false,\n mode: 'json',\n theme: 'chrome',\n onLoad: $scope.aceLoaded\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 1, "line_end": 39} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2018 the original author or authors.\n *\n * Licensed under the MIT License (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\n\n// JSON Widget\n\ncyclotronApp.controller('JsonWidget', function($scope, aceService, configService, dashboardService, dataService) {\n $scope.jsonData = null;\n $scope.aceLoaded = function(editor) {\n editor.setOptions({\n //maxLines: Infinity\n highlightActiveLine: false\n });\n return editor.setReadOnly(true);\n };\n // Settings for the JSON Editor\n return $scope.aceOptions = {\n useWrapMode: false,\n showGutter: true,\n showPrintMargin: false,\n mode: 'json',\n theme: 'chrome',\n onLoad: $scope.aceLoaded\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\n#\n# JSON Widget\n#\ncyclotronApp.controller 'JsonWidget', ($scope, aceService, configService, dashboardService, dataService) ->\n\n $scope.jsonData = null;\n\n $scope.aceLoaded = (editor) ->\n editor.setOptions {\n #maxLines: Infinity\n highlightActiveLine: false\n }\n editor.setReadOnly true\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode: false\n showGutter: true\n showPrintMargin: false\n\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 1, "line_end": 39} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\n#\n# JSON Widget\n#", "response": "cyclotronApp.controller 'JsonWidget', ($scope, aceService, configService, dashboardService, dataService) ->\n\n $scope.jsonData = null;\n\n $scope.aceLoaded = (editor) ->\n editor.setOptions {\n #maxLines: Infinity\n highlightActiveLine: false\n }\n editor.setReadOnly true\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode: false\n showGutter: true\n showPrintMargin: false\n\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 1, "line_end": 39} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "themeSettings = configService.dashboard.properties.theme.options[$scope.widget.theme]\n if $scope.widget.theme? and themeSettings?.aceTheme\n $scope.aceOptions.theme = themeSettings.aceTheme\n\n $scope.reload = ->\n $scope.dataSource.execute(true)\n\n # Load Data Source\n dsDefinition = dashboardService.getDataSource $scope.dashboard, $scope.widget\n $scope.dataSource = dataService.get dsDefinition\n\n # Initialize\n if $scope.dataSource?\n $scope.dataVersion = 0\n $scope.widgetContext.loading = true\n\n # Data Source (re)loaded\n $scope.$on 'dataSource:' + dsDefinition.name + ':data', (event, eventData) ->\n return unless eventData.version > $scope.dataVersion\n $scope.dataVersion = eventData.version\n\n $scope.widgetContext.dataSourceError = false\n $scope.widgetContext.dataSourceErrorMessage = null\n\n data = eventData.data[dsDefinition.resultSet].data\n data = $scope.filterAndSortWidgetData(data)\n\n # Check for no data\n if $scope.widgetContext.nodata == true\n $scope.jsonData = null\n else\n $scope.jsonData = dashboardService.toString data\n console.log($scope.jsonData)\n\n $scope.widgetContext.loading = false\n\n # Data Source error\n $scope.$on 'dataSource:' + dsDefinition.name + ':error', (event, data) ->\n $scope.widgetContext.dataSourceError = true\n $scope.widgetContext.dataSourceErrorMessage = data.error\n $scope.widgetContext.nodata = null\n $scope.widgetContext.loading = false\n $scope.jsonData = null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 41, "line_end": 83} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:2:completion", "type": "completion", "prompt": "themeSettings = configService.dashboard.properties.theme.options[$scope.widget.theme]\n if $scope.widget.theme? and themeSettings?.aceTheme\n $scope.aceOptions.theme = themeSettings.aceTheme\n\n $scope.reload = ->\n $scope.dataSource.execute(true)\n\n # Load Data Source\n dsDefinition = dashboardService.getDataSource $scope.dashboard, $scope.widget\n $scope.dataSource = dataService.get dsDefinition\n\n # Initialize\n if $scope.dataSource?\n $scope.dataVersion = 0\n $scope.widgetContext.loading = true\n\n # Data Source (re)loaded\n $scope.$on 'dataSource:' + dsDefinition.name + ':data', (event, eventData) ->\n return unless eventData.version > $scope.dataVersion\n $scope.dataVersion = eventData.version", "response": "$scope.widgetContext.dataSourceError = false\n $scope.widgetContext.dataSourceErrorMessage = null\n\n data = eventData.data[dsDefinition.resultSet].data\n data = $scope.filterAndSortWidgetData(data)\n\n # Check for no data\n if $scope.widgetContext.nodata == true\n $scope.jsonData = null\n else\n $scope.jsonData = dashboardService.toString data\n console.log($scope.jsonData)\n\n $scope.widgetContext.loading = false\n\n # Data Source error\n $scope.$on 'dataSource:' + dsDefinition.name + ':error', (event, data) ->\n $scope.widgetContext.dataSourceError = true\n $scope.widgetContext.dataSourceErrorMessage = data.error\n $scope.widgetContext.nodata = null\n $scope.widgetContext.loading = false\n $scope.jsonData = null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 41, "line_end": 83} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Data Source loading\n $scope.$on 'dataSource:' + dsDefinition.name + ':loading', ->\n $scope.widgetContext.loading = true\n\n # Initialize the Data Source\n $scope.dataSource.init dsDefinition", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 85, "line_end": 90} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Data Source loading\n $scope.$on 'dataSource:' + dsDefinition.name + ':loading', ->\n $scope.widgetContext.loading = true\n\n # Initialize the Data Source\n $scope.dataSource.init dsDefinition\n```", "response": "// Data Source loading\n$scope.$on('dataSource:' + dsDefinition.name + ':loading', function() {\n return $scope.widgetContext.loading = true;\n});\n\n// Initialize the Data Source\n$scope.dataSource.init(dsDefinition);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 85, "line_end": 90} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Data Source loading\n$scope.$on('dataSource:' + dsDefinition.name + ':loading', function() {\n return $scope.widgetContext.loading = true;\n});\n\n// Initialize the Data Source\n$scope.dataSource.init(dsDefinition);\n```", "response": "# Data Source loading\n $scope.$on 'dataSource:' + dsDefinition.name + ':loading', ->\n $scope.widgetContext.loading = true\n\n # Initialize the Data Source\n $scope.dataSource.init dsDefinition", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 85, "line_end": 90} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/json/jsonWidget.coffee:3:completion", "type": "completion", "prompt": "# Data Source loading\n $scope.$on 'dataSource:' + dsDefinition.name + ':loading', ->\n $scope.widgetContext.loading = true", "response": "# Initialize the Data Source\n $scope.dataSource.init dsDefinition", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/json/jsonWidget.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/json/jsonWidget.coffee", "line_start": 85, "line_end": 90} +{"id": "soulwire/Coffee-Physics:source/behaviour/EdgeWrap.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### Edge Wrap Behaviour ###\n\nclass EdgeWrap extends Behaviour\n\n\tconstructor: (@min = new Vector(), @max = new Vector()) ->\n\n\t\tsuper\n\n\tapply: (p, dt, index) ->\n\n\t\t#super p, dt, index\n\n\t\tif p.pos.x + p.radius < @min.x\n\n\t\t\tp.pos.x = @max.x + p.radius\n\t\t\tp.old.pos.x = p.pos.x\n\n\t\telse if p.pos.x - p.radius > @max.x\n\n\t\t\tp.pos.x = @min.x - p.radius\n\t\t\tp.old.pos.x = p.pos.x\n\n\t\tif p.pos.y + p.radius < @min.y\n\n\t\t\tp.pos.y = @max.y + p.radius\n\t\t\tp.old.pos.y = p.pos.y\n\n\t\telse if p.pos.y - p.radius > @max.y\n\n\t\t\tp.pos.y = @min.y - p.radius\n\t\t\tp.old.pos.y = p.pos.y", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/behaviour/EdgeWrap.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/EdgeWrap.coffee", "line_start": 1, "line_end": 31} +{"id": "soulwire/Coffee-Physics:source/behaviour/EdgeWrap.coffee:1:completion", "type": "completion", "prompt": "### Edge Wrap Behaviour ###\n\nclass EdgeWrap extends Behaviour\n\n\tconstructor: (@min = new Vector(), @max = new Vector()) ->\n\n\t\tsuper\n\n\tapply: (p, dt, index) ->\n\n\t\t#super p, dt, index\n\n\t\tif p.pos.x + p.radius < @min.x\n\n\t\t\tp.pos.x = @max.x + p.radius", "response": "p.old.pos.x = p.pos.x\n\n\t\telse if p.pos.x - p.radius > @max.x\n\n\t\t\tp.pos.x = @min.x - p.radius\n\t\t\tp.old.pos.x = p.pos.x\n\n\t\tif p.pos.y + p.radius < @min.y\n\n\t\t\tp.pos.y = @max.y + p.radius\n\t\t\tp.old.pos.y = p.pos.y\n\n\t\telse if p.pos.y - p.radius > @max.y\n\n\t\t\tp.pos.y = @min.y - p.radius\n\t\t\tp.old.pos.y = p.pos.y", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/behaviour/EdgeWrap.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/behaviour/EdgeWrap.coffee", "line_start": 1, "line_end": 31} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test = require(\"tape\")\n\nDataflow = require(\"../src/Dataflow/Dataflow\")\n\n\ntest \"Values are computed correctly\", (t) ->\n a = Dataflow.cell -> 4\n b = Dataflow.cell -> a() * 2\n t.equal(b(), 8)\n t.end()\n\ntest \"Cacheing works\", (t) ->\n aCount = 0\n bCount = 0\n cCount = 0\n a = Dataflow.cell ->\n aCount++\n return 4\n b = Dataflow.cell ->\n bCount++\n return a() * 2\n c = Dataflow.cell ->\n cCount++\n return b() + a()\n Dataflow.run ->\n t.equal(a(), 4)\n t.equal(b(), 8)\n t.equal(c(), 12)\n t.equal(aCount, 1)\n t.equal(bCount, 1)\n t.equal(cCount, 1)\n t.end()\n\ntest \"Spreads work\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.end()\n\ntest \"Spreads cross product\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 8], a)\n b = Dataflow.cell -> new Dataflow.Spread([10, 20], b)\n c = Dataflow.cell -> a() * b()\n for item, index in c().items\n t.deepEqual(item.items, [index * 10, index * 20])\n t.end()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest = require(\"tape\")\n\nDataflow = require(\"../src/Dataflow/Dataflow\")\n\n\ntest \"Values are computed correctly\", (t) ->\n a = Dataflow.cell -> 4\n b = Dataflow.cell -> a() * 2\n t.equal(b(), 8)\n t.end()\n\ntest \"Cacheing works\", (t) ->\n aCount = 0\n bCount = 0\n cCount = 0\n a = Dataflow.cell ->\n aCount++\n return 4\n b = Dataflow.cell ->\n bCount++\n return a() * 2\n c = Dataflow.cell ->\n cCount++\n return b() + a()\n Dataflow.run ->\n t.equal(a(), 4)\n t.equal(b(), 8)\n t.equal(c(), 12)\n t.equal(aCount, 1)\n t.equal(bCount, 1)\n t.equal(cCount, 1)\n t.end()\n\ntest \"Spreads work\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.end()\n\ntest \"Spreads cross product\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 8], a)\n b = Dataflow.cell -> new Dataflow.Spread([10, 20], b)\n c = Dataflow.cell -> a() * b()\n for item, index in c().items\n t.deepEqual(item.items, [index * 10, index * 20])\n t.end()\n```", "response": "var Dataflow, test;\n\ntest = require(\"tape\");\n\nDataflow = require(\"../src/Dataflow/Dataflow\");\n\ntest(\"Values are computed correctly\", function(t) {\n var a, b;\n a = Dataflow.cell(function() {\n return 4;\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n t.equal(b(), 8);\n return t.end();\n});\n\ntest(\"Cacheing works\", function(t) {\n var a, aCount, b, bCount, c, cCount;\n aCount = 0;\n bCount = 0;\n cCount = 0;\n a = Dataflow.cell(function() {\n aCount++;\n return 4;\n });\n b = Dataflow.cell(function() {\n bCount++;\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n cCount++;\n return b() + a();\n });\n Dataflow.run(function() {\n t.equal(a(), 4);\n t.equal(b(), 8);\n t.equal(c(), 12);\n t.equal(aCount, 1);\n t.equal(bCount, 1);\n return t.equal(cCount, 1);\n });\n return t.end();\n});\n\ntest(\"Spreads work\", function(t) {\n var a, b, c;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a);\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n return a() + b();\n });\n t.deepEqual(a().items, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]);\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27]);\n return t.end();\n});\n\ntest(\"Spreads cross product\", function(t) {\n var a, b, c, i, index, item, len, ref;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1, 2, 3, 4, 5, 6, 7], a);\n });\n b = Dataflow.cell(function() {\n return new Dataflow.Spread([10, 20], b);\n });\n c = Dataflow.cell(function() {\n return a() * b();\n });\n ref = c().items;\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n item = ref[index];\n t.deepEqual(item.items, [index * 10, index * 20]);\n }\n return t.end();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dataflow, test;\n\ntest = require(\"tape\");\n\nDataflow = require(\"../src/Dataflow/Dataflow\");\n\ntest(\"Values are computed correctly\", function(t) {\n var a, b;\n a = Dataflow.cell(function() {\n return 4;\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n t.equal(b(), 8);\n return t.end();\n});\n\ntest(\"Cacheing works\", function(t) {\n var a, aCount, b, bCount, c, cCount;\n aCount = 0;\n bCount = 0;\n cCount = 0;\n a = Dataflow.cell(function() {\n aCount++;\n return 4;\n });\n b = Dataflow.cell(function() {\n bCount++;\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n cCount++;\n return b() + a();\n });\n Dataflow.run(function() {\n t.equal(a(), 4);\n t.equal(b(), 8);\n t.equal(c(), 12);\n t.equal(aCount, 1);\n t.equal(bCount, 1);\n return t.equal(cCount, 1);\n });\n return t.end();\n});\n\ntest(\"Spreads work\", function(t) {\n var a, b, c;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a);\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n return a() + b();\n });\n t.deepEqual(a().items, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]);\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27]);\n return t.end();\n});\n\ntest(\"Spreads cross product\", function(t) {\n var a, b, c, i, index, item, len, ref;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1, 2, 3, 4, 5, 6, 7], a);\n });\n b = Dataflow.cell(function() {\n return new Dataflow.Spread([10, 20], b);\n });\n c = Dataflow.cell(function() {\n return a() * b();\n });\n ref = c().items;\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n item = ref[index];\n t.deepEqual(item.items, [index * 10, index * 20]);\n }\n return t.end();\n});\n```", "response": "test = require(\"tape\")\n\nDataflow = require(\"../src/Dataflow/Dataflow\")\n\n\ntest \"Values are computed correctly\", (t) ->\n a = Dataflow.cell -> 4\n b = Dataflow.cell -> a() * 2\n t.equal(b(), 8)\n t.end()\n\ntest \"Cacheing works\", (t) ->\n aCount = 0\n bCount = 0\n cCount = 0\n a = Dataflow.cell ->\n aCount++\n return 4\n b = Dataflow.cell ->\n bCount++\n return a() * 2\n c = Dataflow.cell ->\n cCount++\n return b() + a()\n Dataflow.run ->\n t.equal(a(), 4)\n t.equal(b(), 8)\n t.equal(c(), 12)\n t.equal(aCount, 1)\n t.equal(bCount, 1)\n t.equal(cCount, 1)\n t.end()\n\ntest \"Spreads work\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.end()\n\ntest \"Spreads cross product\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 8], a)\n b = Dataflow.cell -> new Dataflow.Spread([10, 20], b)\n c = Dataflow.cell -> a() * b()\n for item, index in c().items\n t.deepEqual(item.items, [index * 10, index * 20])\n t.end()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:1:completion", "type": "completion", "prompt": "test = require(\"tape\")\n\nDataflow = require(\"../src/Dataflow/Dataflow\")\n\n\ntest \"Values are computed correctly\", (t) ->\n a = Dataflow.cell -> 4\n b = Dataflow.cell -> a() * 2\n t.equal(b(), 8)\n t.end()\n\ntest \"Cacheing works\", (t) ->\n aCount = 0\n bCount = 0\n cCount = 0\n a = Dataflow.cell ->\n aCount++\n return 4\n b = Dataflow.cell ->\n bCount++\n return a() * 2\n c = Dataflow.cell ->\n cCount++\n return b() + a()", "response": "Dataflow.run ->\n t.equal(a(), 4)\n t.equal(b(), 8)\n t.equal(c(), 12)\n t.equal(aCount, 1)\n t.equal(bCount, 1)\n t.equal(cCount, 1)\n t.end()\n\ntest \"Spreads work\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.end()\n\ntest \"Spreads cross product\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 8], a)\n b = Dataflow.cell -> new Dataflow.Spread([10, 20], b)\n c = Dataflow.cell -> a() * b()\n for item, index in c().items\n t.deepEqual(item.items, [index * 10, index * 20])\n t.end()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 1, "line_end": 50} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "test \"Spreads rejoin\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() * 3\n d = Dataflow.cell -> c() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.deepEqual(d().items, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45])\n\n t.end()\n\ntest \"All spreads should try to resolve as deep as possible\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0, 1], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> {a: a(), b: b.asSpread()}\n t.deepEqual(c().items, [{a: 0, b: 0}, {a: 1, b: 2}])\n d = Dataflow.cell -> {b: b.asSpread()}\n t.deepEqual(d().b.items, [0, 2])\n t.end()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 51, "line_end": 70} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntest \"Spreads rejoin\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() * 3\n d = Dataflow.cell -> c() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.deepEqual(d().items, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45])\n\n t.end()\n\ntest \"All spreads should try to resolve as deep as possible\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0, 1], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> {a: a(), b: b.asSpread()}\n t.deepEqual(c().items, [{a: 0, b: 0}, {a: 1, b: 2}])\n d = Dataflow.cell -> {b: b.asSpread()}\n t.deepEqual(d().b.items, [0, 2])\n t.end()\n```", "response": "test(\"Spreads rejoin\", function(t) {\n var a, b, c, d;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a);\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n return a() * 3;\n });\n d = Dataflow.cell(function() {\n return c() + b();\n });\n t.deepEqual(a().items, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]);\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27]);\n t.deepEqual(d().items, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);\n return t.end();\n});\n\ntest(\"All spreads should try to resolve as deep as possible\", function(t) {\n var a, b, c, d;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1], a);\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n return {\n a: a(),\n b: b.asSpread()\n };\n });\n t.deepEqual(c().items, [\n {\n a: 0,\n b: 0\n },\n {\n a: 1,\n b: 2\n }\n ]);\n d = Dataflow.cell(function() {\n return {\n b: b.asSpread()\n };\n });\n t.deepEqual(d().b.items, [0, 2]);\n return t.end();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 51, "line_end": 70} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ntest(\"Spreads rejoin\", function(t) {\n var a, b, c, d;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a);\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n return a() * 3;\n });\n d = Dataflow.cell(function() {\n return c() + b();\n });\n t.deepEqual(a().items, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]);\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27]);\n t.deepEqual(d().items, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);\n return t.end();\n});\n\ntest(\"All spreads should try to resolve as deep as possible\", function(t) {\n var a, b, c, d;\n a = Dataflow.cell(function() {\n return new Dataflow.Spread([0, 1], a);\n });\n b = Dataflow.cell(function() {\n return a() * 2;\n });\n c = Dataflow.cell(function() {\n return {\n a: a(),\n b: b.asSpread()\n };\n });\n t.deepEqual(c().items, [\n {\n a: 0,\n b: 0\n },\n {\n a: 1,\n b: 2\n }\n ]);\n d = Dataflow.cell(function() {\n return {\n b: b.asSpread()\n };\n });\n t.deepEqual(d().b.items, [0, 2]);\n return t.end();\n});\n```", "response": "test \"Spreads rejoin\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() * 3\n d = Dataflow.cell -> c() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.deepEqual(d().items, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45])\n\n t.end()\n\ntest \"All spreads should try to resolve as deep as possible\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0, 1], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> {a: a(), b: b.asSpread()}\n t.deepEqual(c().items, [{a: 0, b: 0}, {a: 1, b: 2}])\n d = Dataflow.cell -> {b: b.asSpread()}\n t.deepEqual(d().b.items, [0, 2])\n t.end()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 51, "line_end": 70} +{"id": "cdglabs/apparatus:test/Dataflow.test.coffee:2:completion", "type": "completion", "prompt": "test \"Spreads rejoin\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0 ... 10], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> a() * 3\n d = Dataflow.cell -> c() + b()\n t.deepEqual(a().items, [0 ... 10])\n t.deepEqual(b().items, [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])\n t.deepEqual(c().items, [0, 3, 6, 9, 12, 15, 18, 21, 24, 27])\n t.deepEqual(d().items, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45])", "response": "t.end()\n\ntest \"All spreads should try to resolve as deep as possible\", (t) ->\n a = Dataflow.cell -> new Dataflow.Spread([0, 1], a)\n b = Dataflow.cell -> a() * 2\n c = Dataflow.cell -> {a: a(), b: b.asSpread()}\n t.deepEqual(c().items, [{a: 0, b: 0}, {a: 1, b: 2}])\n d = Dataflow.cell -> {b: b.asSpread()}\n t.deepEqual(d().b.items, [0, 2])\n t.end()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "test/Dataflow.test.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/test/Dataflow.test.coffee", "line_start": 51, "line_end": 70} +{"id": "cdglabs/apparatus:src/Dataflow/DynamicScope.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require \"underscore\"\n\nmodule.exports = class DynamicScope\n constructor: (@context={}) ->\n\n with: (newContext, fn) ->\n previousContext = @context\n @_updateContext(previousContext, newContext)\n\n try\n result = fn()\n finally\n @context = previousContext\n return result\n\n _updateContext: (previousContext, newContext) ->\n @context = newContext\n for own key, value of previousContext\n @context[key] = value unless @context.hasOwnProperty(key)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Dataflow/DynamicScope.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Dataflow/DynamicScope.coffee", "line_start": 1, "line_end": 19} +{"id": "cdglabs/apparatus:src/Dataflow/DynamicScope.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require \"underscore\"\n\nmodule.exports = class DynamicScope\n constructor: (@context={}) ->\n\n with: (newContext, fn) ->\n previousContext = @context\n @_updateContext(previousContext, newContext)\n\n try\n result = fn()\n finally\n @context = previousContext\n return result\n\n _updateContext: (previousContext, newContext) ->\n @context = newContext\n for own key, value of previousContext\n @context[key] = value unless @context.hasOwnProperty(key)\n```", "response": "var DynamicScope, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nmodule.exports = DynamicScope = class DynamicScope {\n constructor(context = {}) {\n this.context = context;\n }\n\n with(newContext, fn) {\n var previousContext, result;\n previousContext = this.context;\n this._updateContext(previousContext, newContext);\n try {\n result = fn();\n } finally {\n this.context = previousContext;\n }\n return result;\n }\n\n _updateContext(previousContext, newContext) {\n var key, results, value;\n this.context = newContext;\n results = [];\n for (key in previousContext) {\n if (!hasProp.call(previousContext, key)) continue;\n value = previousContext[key];\n if (!this.context.hasOwnProperty(key)) {\n results.push(this.context[key] = value);\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Dataflow/DynamicScope.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Dataflow/DynamicScope.coffee", "line_start": 1, "line_end": 19} +{"id": "cdglabs/apparatus:src/Dataflow/DynamicScope.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar DynamicScope, _,\n hasProp = {}.hasOwnProperty;\n\n_ = require(\"underscore\");\n\nmodule.exports = DynamicScope = class DynamicScope {\n constructor(context = {}) {\n this.context = context;\n }\n\n with(newContext, fn) {\n var previousContext, result;\n previousContext = this.context;\n this._updateContext(previousContext, newContext);\n try {\n result = fn();\n } finally {\n this.context = previousContext;\n }\n return result;\n }\n\n _updateContext(previousContext, newContext) {\n var key, results, value;\n this.context = newContext;\n results = [];\n for (key in previousContext) {\n if (!hasProp.call(previousContext, key)) continue;\n value = previousContext[key];\n if (!this.context.hasOwnProperty(key)) {\n results.push(this.context[key] = value);\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n\n};\n```", "response": "_ = require \"underscore\"\n\nmodule.exports = class DynamicScope\n constructor: (@context={}) ->\n\n with: (newContext, fn) ->\n previousContext = @context\n @_updateContext(previousContext, newContext)\n\n try\n result = fn()\n finally\n @context = previousContext\n return result\n\n _updateContext: (previousContext, newContext) ->\n @context = newContext\n for own key, value of previousContext\n @context[key] = value unless @context.hasOwnProperty(key)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Dataflow/DynamicScope.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Dataflow/DynamicScope.coffee", "line_start": 1, "line_end": 19} +{"id": "cdglabs/apparatus:src/Dataflow/DynamicScope.coffee:1:completion", "type": "completion", "prompt": "_ = require \"underscore\"\n\nmodule.exports = class DynamicScope\n constructor: (@context={}) ->\n\n with: (newContext, fn) ->\n previousContext = @context\n @_updateContext(previousContext, newContext)", "response": "try\n result = fn()\n finally\n @context = previousContext\n return result\n\n _updateContext: (previousContext, newContext) ->\n @context = newContext\n for own key, value of previousContext\n @context[key] = value unless @context.hasOwnProperty(key)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Dataflow/DynamicScope.coffee", "license": "MIT", "commit": "107e0c2db5a0adf0f1c3b49f16f7625cff4e523b", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Dataflow/DynamicScope.coffee", "line_start": 1, "line_end": 19} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"VHDL Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n VHDL: {\n emacs_script_path: true\n }\n }\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n emacs.run(args, {ignoreReturnCode: false})", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"VHDL Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n VHDL: {\n emacs_script_path: true\n }\n }\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n emacs.run(args, {ignoreReturnCode: false})\n```", "response": "/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, VhdlBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = VhdlBeautifier = (function() {\n class VhdlBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_script_path, tempFile;\n this.debug('vhdl-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\");\n }\n this.debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'vhdl-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n return emacs.run(args, {\n ignoreReturnCode: false\n });\n }\n\n };\n\n VhdlBeautifier.prototype.name = \"VHDL Beautifier\";\n\n VhdlBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n VhdlBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n VhdlBeautifier.prototype.options = {\n VHDL: {\n emacs_script_path: true\n }\n };\n\n return VhdlBeautifier;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, VhdlBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = VhdlBeautifier = (function() {\n class VhdlBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_script_path, tempFile;\n this.debug('vhdl-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\");\n }\n this.debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'vhdl-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n return emacs.run(args, {\n ignoreReturnCode: false\n });\n }\n\n };\n\n VhdlBeautifier.prototype.name = \"VHDL Beautifier\";\n\n VhdlBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n VhdlBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n VhdlBeautifier.prototype.options = {\n VHDL: {\n emacs_script_path: true\n }\n };\n\n return VhdlBeautifier;\n\n}).call(this);\n```", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"VHDL Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n VHDL: {\n emacs_script_path: true\n }\n }\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n emacs.run(args, {ignoreReturnCode: false})", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:completion", "type": "completion", "prompt": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"VHDL Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n VHDL: {", "response": "emacs_script_path: true\n }\n }\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n emacs.run(args, {ignoreReturnCode: false})", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": ".then(=>\n @readFile(tempFile)\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 51, "line_end": 53} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"Vhdl Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Vhdl: true\n }\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "ece4d528544451fbfe7ce8b967c7654ee4f4aa72", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ece4d528544451fbfe7ce8b967c7654ee4f4aa72/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"Vhdl Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Vhdl: true\n }\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")\n```", "response": "/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, VhdlBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = VhdlBeautifier = (function() {\n class VhdlBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_path, emacs_script_path, tempFile;\n this.debug('vhdl-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\");\n }\n this.debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'vhdl-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\");\n }\n }\n\n };\n\n VhdlBeautifier.prototype.name = \"Vhdl Beautifier\";\n\n VhdlBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n VhdlBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n VhdlBeautifier.prototype.options = {\n Vhdl: true\n };\n\n return VhdlBeautifier;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "ece4d528544451fbfe7ce8b967c7654ee4f4aa72", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ece4d528544451fbfe7ce8b967c7654ee4f4aa72/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires https://www.gnu.org/software/emacs/\n*/\n\"use strict\";\nvar Beautifier, VhdlBeautifier, path;\n\nBeautifier = require('../beautifier');\n\npath = require(\"path\");\n\nmodule.exports = VhdlBeautifier = (function() {\n class VhdlBeautifier extends Beautifier {\n beautify(text, language, options) {\n var args, emacs, emacs_path, emacs_script_path, tempFile;\n this.debug('vhdl-beautifier', options);\n emacs = this.exe(\"emacs\");\n emacs_path = options.emacs_path;\n emacs_script_path = options.emacs_script_path;\n if (!emacs_script_path) {\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\");\n }\n this.debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path);\n args = ['--batch', '-l', emacs_script_path, '-f', 'vhdl-batch-indent-region', tempFile = this.tempFile(\"temp\", text)];\n if (emacs_path) {\n return this.deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\");\n }\n }\n\n };\n\n VhdlBeautifier.prototype.name = \"Vhdl Beautifier\";\n\n VhdlBeautifier.prototype.link = \"https://www.gnu.org/software/emacs/\";\n\n VhdlBeautifier.prototype.executables = [\n {\n name: \"Emacs\",\n cmd: \"emacs\",\n homepage: \"https://www.gnu.org/software/emacs/\",\n installation: \"https://www.gnu.org/software/emacs/\",\n version: {\n parse: function(text) {\n return text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1];\n }\n }\n }\n ];\n\n VhdlBeautifier.prototype.options = {\n Vhdl: true\n };\n\n return VhdlBeautifier;\n\n}).call(this);\n```", "response": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"Vhdl Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Vhdl: true\n }\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "ece4d528544451fbfe7ce8b967c7654ee4f4aa72", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ece4d528544451fbfe7ce8b967c7654ee4f4aa72/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "Glavin001/atom-beautify:src/beautifiers/vhdl-beautifier/index.coffee:1:completion", "type": "completion", "prompt": "###\nRequires https://www.gnu.org/software/emacs/\n###\n\n\"use strict\"\nBeautifier = require('../beautifier')\npath = require(\"path\")\n\nmodule.exports = class VhdlBeautifier extends Beautifier\n name: \"Vhdl Beautifier\"\n link: \"https://www.gnu.org/software/emacs/\"\n executables: [\n {\n name: \"Emacs\"\n cmd: \"emacs\"\n homepage: \"https://www.gnu.org/software/emacs/\"\n installation: \"https://www.gnu.org/software/emacs/\"\n version: {\n parse: (text) -> text.match(/Emacs (\\d+\\.\\d+\\.\\d+)/)[1]\n }\n }\n ]\n\n options: {\n Vhdl: true", "response": "}\n\n beautify: (text, language, options) ->\n @debug('vhdl-beautifier', options)\n emacs = @exe(\"emacs\")\n\n emacs_path = options.emacs_path\n emacs_script_path = options.emacs_script_path\n\n if not emacs_script_path\n emacs_script_path = path.resolve(__dirname, \"emacs-vhdl-formating-script.lisp\")\n\n @debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path)\n\n args = [\n '--batch'\n '-l'\n emacs_script_path\n '-f'\n 'vhdl-batch-indent-region'\n tempFile = @tempFile(\"temp\", text)\n ]\n\n if emacs_path\n @deprecateOptionForExecutable(\"Emacs\", \"emacs_path\", \"Path\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/vhdl-beautifier/index.coffee", "license": "MIT", "commit": "ece4d528544451fbfe7ce8b967c7654ee4f4aa72", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ece4d528544451fbfe7ce8b967c7654ee4f4aa72/src/beautifiers/vhdl-beautifier/index.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:test/guards/dtdentity.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'DTDEntity Guards:', ->\n test 'constructor', ->\n testCases = [\n () -> xml('test').dtd().ent()\n () -> xml('test').dtd().ent('name')\n () -> xml('test').dtd().ent('name', { invalid: \"obj\" })\n () -> xml('test').dtd().ent('name', { pubID: \"obj\" })\n () -> xml('test').dtd().pent('name', { sysID: \"obj\", nData: \"val\" })\n ]\n\n results = [\n \"Missing DTD entity name. parent: \"\n \"Missing DTD entity value. node: , parent: \"\n \"Public and/or system identifiers are required for an external entity. node: , parent: \"\n \"System identifier is required for a public external entity. node: , parent: \"\n \"Notation declaration is not allowed in a parameter entity. node: , parent: \"\n ]\n\n err(\n testCases[i]\n Error\n results[i]\n ) for i in [0..testCases.length-1]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/dtdentity.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/dtdentity.coffee", "line_start": 1, "line_end": 23} +{"id": "oozcitak/xmlbuilder-js:test/guards/dtdentity.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'DTDEntity Guards:', ->\n test 'constructor', ->\n testCases = [\n () -> xml('test').dtd().ent()\n () -> xml('test').dtd().ent('name')\n () -> xml('test').dtd().ent('name', { invalid: \"obj\" })\n () -> xml('test').dtd().ent('name', { pubID: \"obj\" })\n () -> xml('test').dtd().pent('name', { sysID: \"obj\", nData: \"val\" })\n ]\n\n results = [\n \"Missing DTD entity name. parent: \"\n \"Missing DTD entity value. node: , parent: \"\n \"Public and/or system identifiers are required for an external entity. node: , parent: \"\n \"System identifier is required for a public external entity. node: , parent: \"\n \"Notation declaration is not allowed in a parameter entity. node: , parent: \"\n ]\n\n err(\n testCases[i]\n Error\n results[i]\n ) for i in [0..testCases.length-1]\n```", "response": "suite('DTDEntity Guards:', function() {\n return test('constructor', function() {\n var i, j, ref, results, results1, testCases;\n testCases = [\n function() {\n return xml('test').dtd().ent();\n },\n function() {\n return xml('test').dtd().ent('name');\n },\n function() {\n return xml('test').dtd().ent('name',\n {\n invalid: \"obj\"\n });\n },\n function() {\n return xml('test').dtd().ent('name',\n {\n pubID: \"obj\"\n });\n },\n function() {\n return xml('test').dtd().pent('name',\n {\n sysID: \"obj\",\n nData: \"val\"\n });\n }\n ];\n results = [\"Missing DTD entity name. parent: \", \"Missing DTD entity value. node: , parent: \", \"Public and/or system identifiers are required for an external entity. node: , parent: \", \"System identifier is required for a public external entity. node: , parent: \", \"Notation declaration is not allowed in a parameter entity. node: , parent: \"];\n results1 = [];\n for (i = j = 0, ref = testCases.length - 1; (0 <= ref ? j <= ref : j >= ref); i = 0 <= ref ? ++j : --j) {\n results1.push(err(testCases[i], Error, results[i]));\n }\n return results1;\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/dtdentity.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/dtdentity.coffee", "line_start": 1, "line_end": 23} +{"id": "oozcitak/xmlbuilder-js:test/guards/dtdentity.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('DTDEntity Guards:', function() {\n return test('constructor', function() {\n var i, j, ref, results, results1, testCases;\n testCases = [\n function() {\n return xml('test').dtd().ent();\n },\n function() {\n return xml('test').dtd().ent('name');\n },\n function() {\n return xml('test').dtd().ent('name',\n {\n invalid: \"obj\"\n });\n },\n function() {\n return xml('test').dtd().ent('name',\n {\n pubID: \"obj\"\n });\n },\n function() {\n return xml('test').dtd().pent('name',\n {\n sysID: \"obj\",\n nData: \"val\"\n });\n }\n ];\n results = [\"Missing DTD entity name. parent: \", \"Missing DTD entity value. node: , parent: \", \"Public and/or system identifiers are required for an external entity. node: , parent: \", \"System identifier is required for a public external entity. node: , parent: \", \"Notation declaration is not allowed in a parameter entity. node: , parent: \"];\n results1 = [];\n for (i = j = 0, ref = testCases.length - 1; (0 <= ref ? j <= ref : j >= ref); i = 0 <= ref ? ++j : --j) {\n results1.push(err(testCases[i], Error, results[i]));\n }\n return results1;\n });\n});\n```", "response": "suite 'DTDEntity Guards:', ->\n test 'constructor', ->\n testCases = [\n () -> xml('test').dtd().ent()\n () -> xml('test').dtd().ent('name')\n () -> xml('test').dtd().ent('name', { invalid: \"obj\" })\n () -> xml('test').dtd().ent('name', { pubID: \"obj\" })\n () -> xml('test').dtd().pent('name', { sysID: \"obj\", nData: \"val\" })\n ]\n\n results = [\n \"Missing DTD entity name. parent: \"\n \"Missing DTD entity value. node: , parent: \"\n \"Public and/or system identifiers are required for an external entity. node: , parent: \"\n \"System identifier is required for a public external entity. node: , parent: \"\n \"Notation declaration is not allowed in a parameter entity. node: , parent: \"\n ]\n\n err(\n testCases[i]\n Error\n results[i]\n ) for i in [0..testCases.length-1]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/dtdentity.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/dtdentity.coffee", "line_start": 1, "line_end": 23} +{"id": "oozcitak/xmlbuilder-js:test/guards/dtdentity.coffee:1:completion", "type": "completion", "prompt": "suite 'DTDEntity Guards:', ->\n test 'constructor', ->\n testCases = [\n () -> xml('test').dtd().ent()\n () -> xml('test').dtd().ent('name')\n () -> xml('test').dtd().ent('name', { invalid: \"obj\" })\n () -> xml('test').dtd().ent('name', { pubID: \"obj\" })\n () -> xml('test').dtd().pent('name', { sysID: \"obj\", nData: \"val\" })\n ]\n\n results = [", "response": "\"Missing DTD entity name. parent: \"\n \"Missing DTD entity value. node: , parent: \"\n \"Public and/or system identifiers are required for an external entity. node: , parent: \"\n \"System identifier is required for a public external entity. node: , parent: \"\n \"Notation declaration is not allowed in a parameter entity. node: , parent: \"\n ]\n\n err(\n testCases[i]\n Error\n results[i]\n ) for i in [0..testCases.length-1]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/dtdentity.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/dtdentity.coffee", "line_start": 1, "line_end": 23} +{"id": "jnordberg/wintersmith:src/plugins/coffeescript.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "path = require 'path'\nasync = require 'async'\nfs = require 'fs'\n{compile} = require 'coffee-script'\n{ContentPlugin} = require './../content'\n{stripExtension} = require './../common'\n\nclass CoffeeScriptPlugin extends ContentPlugin\n ### plugin that compiles coffee files to javascript ###\n\n constructor: (@_filename, @_source) ->\n\n getFilename: ->\n stripExtension(@_filename) + '.js'\n\n render: (locals, contents, templates, callback) ->\n try\n callback null, new Buffer compile @_source\n catch error\n callback error\n\nCoffeeScriptPlugin.fromFile = (filename, base, callback) ->\n async.waterfall [\n (callback) ->\n fs.readFile path.join(base, filename), callback\n (buffer, callback) ->\n callback null, new CoffeeScriptPlugin filename, buffer.toString()\n ], callback\n\nmodule.exports = CoffeeScriptPlugin", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/plugins/coffeescript.coffee", "license": "MIT", "commit": "4124dcacb31c836752d7d48cf8b922aa4b7f9cfb", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/4124dcacb31c836752d7d48cf8b922aa4b7f9cfb/src/plugins/coffeescript.coffee", "line_start": 1, "line_end": 30} +{"id": "jnordberg/wintersmith:src/plugins/coffeescript.coffee:1:completion", "type": "completion", "prompt": "path = require 'path'\nasync = require 'async'\nfs = require 'fs'\n{compile} = require 'coffee-script'\n{ContentPlugin} = require './../content'\n{stripExtension} = require './../common'\n\nclass CoffeeScriptPlugin extends ContentPlugin\n ### plugin that compiles coffee files to javascript ###\n\n constructor: (@_filename, @_source) ->\n\n getFilename: ->\n stripExtension(@_filename) + '.js'", "response": "render: (locals, contents, templates, callback) ->\n try\n callback null, new Buffer compile @_source\n catch error\n callback error\n\nCoffeeScriptPlugin.fromFile = (filename, base, callback) ->\n async.waterfall [\n (callback) ->\n fs.readFile path.join(base, filename), callback\n (buffer, callback) ->\n callback null, new CoffeeScriptPlugin filename, buffer.toString()\n ], callback\n\nmodule.exports = CoffeeScriptPlugin", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/plugins/coffeescript.coffee", "license": "MIT", "commit": "4124dcacb31c836752d7d48cf8b922aa4b7f9cfb", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/4124dcacb31c836752d7d48cf8b922aa4b7f9cfb/src/plugins/coffeescript.coffee", "line_start": 1, "line_end": 30} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @::, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @::, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @::, 'publicId', get: () -> @pubID\n Object.defineProperty @::, 'systemId', get: () -> @sysID\n Object.defineProperty @::, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @::, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @::, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @::, 'publicId', get: () -> @pubID\n Object.defineProperty @::, 'systemId', get: () -> @sysID\n Object.defineProperty @::, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #\n```", "response": "var XMLDocType;\n\nmodule.exports = XMLDocType = (function() {\n class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n };\n\n // DOM level 1\n Object.defineProperty(XMLDocType.prototype, 'entities', {\n get: function() {\n var child, i, len, nodes, ref;\n nodes = {};\n ref = this.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if ((child.type === NodeType.EntityDeclaration) && !child.pe) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n\n Object.defineProperty(XMLDocType.prototype, 'notations', {\n get: function() {\n var child, i, len, nodes, ref;\n nodes = {};\n ref = this.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.NotationDeclaration) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n\n // DOM level 2\n Object.defineProperty(XMLDocType.prototype, 'publicId', {\n get: function() {\n return this.pubID;\n }\n });\n\n Object.defineProperty(XMLDocType.prototype, 'systemId', {\n get: function() {\n return this.sysID;\n }\n });\n\n Object.defineProperty(XMLDocType.prototype, 'internalSubset', {\n get: function() {\n throw new Error(\"This DOM method is not implemented.\" + this.debugInfo());\n }\n });\n\n return XMLDocType;\n\n}).call(this);\n\n// Creates an element type declaration", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLDocType;\n\nmodule.exports = XMLDocType = (function() {\n class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n };\n\n // DOM level 1\n Object.defineProperty(XMLDocType.prototype, 'entities', {\n get: function() {\n var child, i, len, nodes, ref;\n nodes = {};\n ref = this.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if ((child.type === NodeType.EntityDeclaration) && !child.pe) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n\n Object.defineProperty(XMLDocType.prototype, 'notations', {\n get: function() {\n var child, i, len, nodes, ref;\n nodes = {};\n ref = this.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.NotationDeclaration) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n\n // DOM level 2\n Object.defineProperty(XMLDocType.prototype, 'publicId', {\n get: function() {\n return this.pubID;\n }\n });\n\n Object.defineProperty(XMLDocType.prototype, 'systemId', {\n get: function() {\n return this.sysID;\n }\n });\n\n Object.defineProperty(XMLDocType.prototype, 'internalSubset', {\n get: function() {\n throw new Error(\"This DOM method is not implemented.\" + this.debugInfo());\n }\n });\n\n return XMLDocType;\n\n}).call(this);\n\n// Creates an element type declaration\n```", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @::, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @::, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @::, 'publicId', get: () -> @pubID\n Object.defineProperty @::, 'systemId', get: () -> @sysID\n Object.defineProperty @::, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:completion", "type": "completion", "prompt": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID", "response": "if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @::, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @::, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @::, 'publicId', get: () -> @pubID\n Object.defineProperty @::, 'systemId', get: () -> @sysID\n Object.defineProperty @::, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n```", "response": "// `name` element name\n// `value` element content (defaults to #PCDATA)\n({\n element: function(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n },\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n },\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n }\n});\n\n// Creates a NOTATION declaration", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// `name` element name\n// `value` element content (defaults to #PCDATA)\n({\n element: function(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n },\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n },\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n }\n});\n\n// Creates a NOTATION declaration\n```", "response": "# `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:completion", "type": "completion", "prompt": "# `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #", "response": "# `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject\n\n\n isEqualNode: (node) ->\n if not super.isEqualNode(node) then return false\n if node.name isnt @name then return false\n if node.publicId isnt @publicId then return false\n if node.systemId isnt @systemId then return false\n return true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 112, "line_end": 147} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:completion", "type": "completion", "prompt": "# `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)", "response": "# Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject\n\n\n isEqualNode: (node) ->\n if not super.isEqualNode(node) then return false\n if node.name isnt @name then return false\n if node.publicId isnt @publicId then return false\n if node.systemId isnt @systemId then return false\n return true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLDocType.coffee", "line_start": 112, "line_end": 147} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLDocType.coffee", "line_start": 112, "line_end": 139} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject\n```", "response": "// `name` the name of the notation\n// `value` an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n({\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n },\n // Aliases\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLDocType.coffee", "line_start": 112, "line_end": 139} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// `name` the name of the notation\n// `value` an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n({\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n },\n // Aliases\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n});\n```", "response": "# `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLDocType.coffee", "line_start": 112, "line_end": 139} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:completion", "type": "completion", "prompt": "# `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print", "response": "# `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "68552eda87d08b71507e70e032d7619b46096fe3", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/68552eda87d08b71507e70e032d7619b46096fe3/src/XMLDocType.coffee", "line_start": 112, "line_end": 139} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @, 'publicId', get: () -> @pubID\n Object.defineProperty @, 'systemId', get: () -> @sysID\n Object.defineProperty @, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f6ad2df8c2551b47423405066312422d972aa32f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f6ad2df8c2551b47423405066312422d972aa32f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @, 'publicId', get: () -> @pubID\n Object.defineProperty @, 'systemId', get: () -> @sysID\n Object.defineProperty @, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #\n```", "response": "var XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n // DOM level 1\n Object.defineProperty(this, 'entities', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if ((child.type === NodeType.EntityDeclaration) && !child.pe) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n Object.defineProperty(this, 'notations', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if (child.type === NodeType.NotationDeclaration) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n // DOM level 2\n Object.defineProperty(this, 'publicId', {\n get: function() {\n return this.pubID;\n }\n });\n Object.defineProperty(this, 'systemId', {\n get: function() {\n return this.sysID;\n }\n });\n Object.defineProperty(this, 'internalSubset', {\n get: function() {\n throw new Error(\"This DOM method is not implemented.\" + this.debugInfo());\n }\n });\n }\n\n};\n\n// Creates an element type declaration", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f6ad2df8c2551b47423405066312422d972aa32f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f6ad2df8c2551b47423405066312422d972aa32f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n // DOM level 1\n Object.defineProperty(this, 'entities', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if ((child.type === NodeType.EntityDeclaration) && !child.pe) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n Object.defineProperty(this, 'notations', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if (child.type === NodeType.NotationDeclaration) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n // DOM level 2\n Object.defineProperty(this, 'publicId', {\n get: function() {\n return this.pubID;\n }\n });\n Object.defineProperty(this, 'systemId', {\n get: function() {\n return this.sysID;\n }\n });\n Object.defineProperty(this, 'internalSubset', {\n get: function() {\n throw new Error(\"This DOM method is not implemented.\" + this.debugInfo());\n }\n });\n }\n\n};\n\n// Creates an element type declaration\n```", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @, 'publicId', get: () -> @pubID\n Object.defineProperty @, 'systemId', get: () -> @sysID\n Object.defineProperty @, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f6ad2df8c2551b47423405066312422d972aa32f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f6ad2df8c2551b47423405066312422d972aa32f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:completion", "type": "completion", "prompt": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID", "response": "if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n # DOM level 2\n Object.defineProperty @, 'publicId', get: () -> @pubID\n Object.defineProperty @, 'systemId', get: () -> @sysID\n Object.defineProperty @, 'internalSubset', get: () -> throw new Error \"This DOM method is not implemented.\" + @debugInfo()\n\n\n # Creates an element type declaration\n #", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f6ad2df8c2551b47423405066312422d972aa32f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f6ad2df8c2551b47423405066312422d972aa32f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n```", "response": "var XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n // DOM level 1\n Object.defineProperty(this, 'entities', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if ((child.type === NodeType.EntityDeclaration) && !child.pe) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n Object.defineProperty(this, 'notations', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if (child.type === NodeType.NotationDeclaration) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n return this.children.push(child);\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n // DOM level 1\n Object.defineProperty(this, 'entities', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if ((child.type === NodeType.EntityDeclaration) && !child.pe) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n Object.defineProperty(this, 'notations', {\n get: function() {\n var j, len1, nodes, ref1;\n nodes = {};\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n if (child.type === NodeType.NotationDeclaration) {\n nodes[child.name] = child;\n }\n }\n return new XMLNamedNodeMap(nodes);\n }\n });\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n return this.children.push(child);\n }\n\n};\n```", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:completion", "type": "completion", "prompt": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID", "response": "if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n # DOM level 1\n Object.defineProperty @, 'entities', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when (child.type is NodeType.EntityDeclaration) and not child.pe\n new XMLNamedNodeMap nodes\n Object.defineProperty @, 'notations', get: () ->\n nodes = {}\n nodes[child.name] = child for child in @children when child.type is NodeType.NotationDeclaration\n new XMLNamedNodeMap nodes\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 12, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreturn @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n```", "response": "return this({\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n },\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {}\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nreturn this({\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n },\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {}\n});\n```", "response": "return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:completion", "type": "completion", "prompt": "return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration", "response": "entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 62, "line_end": 111} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 112, "line_end": 134} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:completion", "type": "completion", "prompt": "child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print", "response": "toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDocType.coffee", "line_start": 112, "line_end": 134} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n```", "response": "var XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n};\n\n// Creates an attribute declaration\n\n// `elementName` the name of the element containing this attribute\n// `attributeName` attribute name\n// `attributeType` type of the attribute (defaults to CDATA)\n// `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n// #DEFAULT) (defaults to #IMPLIED)", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n var child, i, len, ref;\n super(parent);\n this.type = NodeType.DocType;\n // set DTD name to the name of the root node\n if (parent.children) {\n ref = parent.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (child.type === NodeType.Element) {\n this.name = child.name;\n break;\n }\n }\n }\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n};\n\n// Creates an attribute declaration\n\n// `elementName` the name of the element containing this attribute\n// `attributeName` attribute name\n// `attributeType` type of the attribute (defaults to CDATA)\n// `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n// #DEFAULT) (defaults to #IMPLIED)\n```", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:completion", "type": "completion", "prompt": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @type = NodeType.DocType\n # set DTD name to the name of the root node\n if parent.children\n for child in parent.children\n if child.type is NodeType.Element\n @name = child.name\n break\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID", "response": "if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n```", "response": "// `defaultValue` default value of the attribute\n// (only used for #FIXED or #DEFAULT)\n({\n attList: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n },\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n }\n});\n\n// Converts to string\n\n// `options.pretty` pretty prints the result\n// `options.indent` indentation for pretty print\n// `options.offset` how many indentations to add to every line for pretty print", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// `defaultValue` default value of the attribute\n// (only used for #FIXED or #DEFAULT)\n({\n attList: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n },\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n }\n});\n\n// Converts to string\n\n// `options.pretty` pretty prints the result\n// `options.indent` indentation for pretty print\n// `options.offset` how many indentations to add to every line for pretty print\n```", "response": "# `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:completion", "type": "completion", "prompt": "# `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details", "response": "# `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 111, "line_end": 123} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject\n```", "response": "// `options.newline` newline sequence for pretty print\n({\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n },\n // Aliases\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 111, "line_end": 123} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// `options.newline` newline sequence for pretty print\n({\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n },\n // Aliases\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n});\n```", "response": "# `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 111, "line_end": 123} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:completion", "type": "completion", "prompt": "# `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases", "response": "ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDocType.coffee", "line_start": 111, "line_end": 123} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n @type = NodeType.DocType\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n @type = NodeType.DocType\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n```", "response": "var XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n super(parent);\n this.name = \"!DOCTYPE\";\n this.type = NodeType.DocType;\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n return this.children.push(child);\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n super(parent);\n this.name = \"!DOCTYPE\";\n this.type = NodeType.DocType;\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n return this.children.push(child);\n }\n\n};\n```", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n @type = NodeType.DocType\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:completion", "type": "completion", "prompt": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n @type = NodeType.DocType\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?", "response": "@sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 11, "line_end": 60} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreturn @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n```", "response": "return this({\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nreturn this({\n // Creates a general entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n // `value.nData` notation declaration\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n }\n});\n```", "response": "return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:completion", "type": "completion", "prompt": "return @\n\n\n # Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value", "response": "@children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 61, "line_end": 110} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 111, "line_end": 118} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject\n```", "response": "// Aliases\n({\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 111, "line_end": 118} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Aliases\n({\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n});\n```", "response": "# Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 111, "line_end": 118} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:completion", "type": "completion", "prompt": "# Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue", "response": "ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "d8de14769590b262e56b467df05db50855a0ad24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8de14769590b262e56b467df05db50855a0ad24/src/XMLDocType.coffee", "line_start": 111, "line_end": 118} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n```", "response": "var XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n super(parent);\n this.name = \"!DOCTYPE\";\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n super(parent);\n this.name = \"!DOCTYPE\";\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n }\n\n};\n```", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:completion", "type": "completion", "prompt": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @name = \"!DOCTYPE\"\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?", "response": "# Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases\n```", "response": "// Creates a general entity declaration\n\n// `name` the name of the entity\n// `value` internal entity value or an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n// `value.nData` notation declaration\n({\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n }\n});\n\n// Aliases", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Creates a general entity declaration\n\n// `name` the name of the entity\n// `value` internal entity value or an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n// `value.nData` notation declaration\n({\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.docType(this, this.options.writer.filterOptions(options));\n }\n});\n\n// Aliases\n```", "response": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:completion", "type": "completion", "prompt": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @", "response": "# Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.docType @, @options.writer.filterOptions(options)\n\n\n # Aliases", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 110, "line_end": 116} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject\n```", "response": "({\n ele: function(name, value) {\n return this.element(name, value({\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n }));\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 110, "line_end": 116} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n ele: function(name, value) {\n return this.element(name, value({\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n },\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n }));\n }\n});\n```", "response": "ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 110, "line_end": 116} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:completion", "type": "completion", "prompt": "ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n @attList elementName, attributeName, attributeType, defaultValueType, defaultValue", "response": "ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "b6c2503daa774b02579fb8c98c31877ea24861a1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b6c2503daa774b02579fb8c98c31877ea24861a1/src/XMLDocType.coffee", "line_start": 110, "line_end": 116} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases\n```", "response": "// Creates a general entity declaration\n\n// `name` the name of the entity\n// `value` internal entity value or an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n// `value.nData` notation declaration\n({\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.set(options).docType(this);\n }\n});\n\n// Aliases", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Creates a general entity declaration\n\n// `name` the name of the entity\n// `value` internal entity value or an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n// `value.nData` notation declaration\n({\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.set(options).docType(this);\n }\n});\n\n// Aliases\n```", "response": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:completion", "type": "completion", "prompt": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @", "response": "# Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "f066a3151d269e738ea37d87e5bf2470ef948b24", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/f066a3151d269e738ea37d87e5bf2470ef948b24/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @\n```", "response": "var XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n super(parent);\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar XMLDocType;\n\nmodule.exports = XMLDocType = class XMLDocType extends XMLNode {\n // Initializes a new instance of `XMLDocType`\n\n // `parent` the document object\n\n // `pubID` public identifier of the external subset\n // `sysID` system identifier of the external subset\n constructor(parent, pubID, sysID) {\n super(parent);\n this.documentObject = parent;\n // arguments may also be passed as an object\n if (isObject(pubID)) {\n ({pubID, sysID} = pubID);\n }\n if (sysID == null) {\n [sysID, pubID] = [pubID, sysID];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n // Creates an element type declaration\n\n // `name` element name\n // `value` element content (defaults to #PCDATA)\n element(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n }\n\n // Creates an attribute declaration\n\n // `elementName` the name of the element containing this attribute\n // `attributeName` attribute name\n // `attributeType` type of the attribute (defaults to CDATA)\n // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n // #DEFAULT) (defaults to #IMPLIED)\n // `defaultValue` default value of the attribute\n // (only used for #FIXED or #DEFAULT)\n attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n }\n\n};\n```", "response": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?\n\n\n # Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:1:completion", "type": "completion", "prompt": "module.exports = class XMLDocType extends XMLNode\n\n\n # Initializes a new instance of `XMLDocType`\n #\n # `parent` the document object\n #\n # `pubID` public identifier of the external subset\n # `sysID` system identifier of the external subset\n constructor: (parent, pubID, sysID) ->\n super parent\n\n @documentObject = parent\n\n # arguments may also be passed as an object\n if isObject pubID\n { pubID, sysID } = pubID\n\n if not sysID?\n [sysID, pubID] = [pubID, sysID]\n\n @pubID = @stringify.dtdPubID pubID if pubID?\n @sysID = @stringify.dtdSysID sysID if sysID?", "response": "# Creates an element type declaration\n #\n # `name` element name\n # `value` element content (defaults to #PCDATA)\n element: (name, value) ->\n child = new XMLDTDElement @, name, value\n @children.push child\n return @\n\n\n # Creates an attribute declaration\n #\n # `elementName` the name of the element containing this attribute\n # `attributeName` attribute name\n # `attributeType` type of the attribute (defaults to CDATA)\n # `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or\n # #DEFAULT) (defaults to #IMPLIED)\n # `defaultValue` default value of the attribute\n # (only used for #FIXED or #DEFAULT)\n attList: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n child = new XMLDTDAttList @, elementName, attributeName, attributeType, defaultValueType, defaultValue\n @children.push child\n return @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 10, "line_end": 59} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->\n```", "response": "// Creates a general entity declaration\n\n// `name` the name of the entity\n// `value` internal entity value or an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n// `value.nData` notation declaration\n({\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.set(options).docType(this);\n },\n // Aliases\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {}\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Creates a general entity declaration\n\n// `name` the name of the entity\n// `value` internal entity value or an object with external entity details\n// `value.pubID` public identifier\n// `value.sysID` system identifier\n// `value.nData` notation declaration\n({\n entity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a parameter entity declaration\n\n // `name` the name of the entity\n // `value` internal entity value or an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n pEntity: function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n },\n // Creates a NOTATION declaration\n\n // `name` the name of the notation\n // `value` an object with external entity details\n // `value.pubID` public identifier\n // `value.sysID` system identifier\n notation: function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n },\n // Converts to string\n\n // `options.pretty` pretty prints the result\n // `options.indent` indentation for pretty print\n // `options.offset` how many indentations to add to every line for pretty print\n // `options.newline` newline sequence for pretty print\n toString: function(options) {\n return this.options.writer.set(options).docType(this);\n },\n // Aliases\n ele: function(name, value) {\n return this.element(name, value);\n },\n att: function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {}\n});\n```", "response": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @\n\n\n # Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:2:completion", "type": "completion", "prompt": "# Creates a general entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n # `value.nData` notation declaration\n entity: (name, value) ->\n child = new XMLDTDEntity @, false, name, value\n @children.push child\n return @\n\n\n # Creates a parameter entity declaration\n #\n # `name` the name of the entity\n # `value` internal entity value or an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n pEntity: (name, value) ->\n child = new XMLDTDEntity @, true, name, value\n @children.push child\n return @", "response": "# Creates a NOTATION declaration\n #\n # `name` the name of the notation\n # `value` an object with external entity details\n # `value.pubID` public identifier\n # `value.sysID` system identifier\n notation: (name, value) ->\n child = new XMLDTDNotation @, name, value\n @children.push child\n return @\n\n\n # Converts to string\n #\n # `options.pretty` pretty prints the result\n # `options.indent` indentation for pretty print\n # `options.offset` how many indentations to add to every line for pretty print\n # `options.newline` newline sequence for pretty print\n toString: (options) ->\n @options.writer.set(options).docType @\n\n\n # Aliases\n ele: (name, value) -> @element name, value\n att: (elementName, attributeName, attributeType, defaultValueType, defaultValue) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 60, "line_end": 109} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 110, "line_end": 114} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject\n```", "response": "this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue({\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n}));", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 110, "line_end": 114} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue({\n ent: function(name, value) {\n return this.entity(name, value);\n },\n pent: function(name, value) {\n return this.pEntity(name, value);\n },\n not: function(name, value) {\n return this.notation(name, value);\n },\n up: function() {\n return this.root() || this.documentObject;\n }\n}));\n```", "response": "@attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value\n pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 110, "line_end": 114} +{"id": "oozcitak/xmlbuilder-js:src/XMLDocType.coffee:3:completion", "type": "completion", "prompt": "@attList elementName, attributeName, attributeType, defaultValueType, defaultValue\n ent: (name, value) -> @entity name, value", "response": "pent: (name, value) -> @pEntity name, value\n not: (name, value) -> @notation name, value\n up: () -> @root() or @documentObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDocType.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/XMLDocType.coffee", "line_start": 110, "line_end": 114} +{"id": "jashkenas/coffeescript:test/importing.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Importing\n# ---------\n\nunless window? or testingBrowser?\n test \"coffeescript modules can be imported and executed\", ->\n\n magicKey = __filename\n magicValue = 0xFFFF\n\n if global[magicKey]?\n if exports?\n local = magicValue\n exports.method = -> local\n else\n global[magicKey] = {}\n if require?.extensions?\n ok require(__filename).method() is magicValue\n delete global[magicKey]\n\n test \"javascript modules can be imported\", ->\n magicVal = 1\n for module in 'import.js import2 .import2 import.extension.js import.unknownextension .coffee .coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"coffeescript modules can be imported\", ->\n magicVal = 2\n for module in '.import.coffee import.coffee import.extension.coffee'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"literate coffeescript modules can be imported\", ->\n magicVal = 3\n # Leading space intentional to check for index.coffee.md\n for module in ' .import.coffee.md import.coffee.md import.litcoffee import.extension.coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "test/importing.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/importing.coffee", "line_start": 1, "line_end": 34} +{"id": "jashkenas/coffeescript:test/importing.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Importing\n# ---------\n\nunless window? or testingBrowser?\n test \"coffeescript modules can be imported and executed\", ->\n\n magicKey = __filename\n magicValue = 0xFFFF\n\n if global[magicKey]?\n if exports?\n local = magicValue\n exports.method = -> local\n else\n global[magicKey] = {}\n if require?.extensions?\n ok require(__filename).method() is magicValue\n delete global[magicKey]\n\n test \"javascript modules can be imported\", ->\n magicVal = 1\n for module in 'import.js import2 .import2 import.extension.js import.unknownextension .coffee .coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"coffeescript modules can be imported\", ->\n magicVal = 2\n for module in '.import.coffee import.coffee import.extension.coffee'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"literate coffeescript modules can be imported\", ->\n magicVal = 3\n # Leading space intentional to check for index.coffee.md\n for module in ' .import.coffee.md import.coffee.md import.litcoffee import.extension.coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n```", "response": "// Importing\n// ---------\nif (!((typeof window !== \"undefined\" && window !== null) || (typeof testingBrowser !== \"undefined\" && testingBrowser !== null))) {\n test(\"coffeescript modules can be imported and executed\", function() {\n var local, magicKey, magicValue;\n magicKey = __filename;\n magicValue = 0xFFFF;\n if (global[magicKey] != null) {\n if (typeof exports !== \"undefined\" && exports !== null) {\n local = magicValue;\n return exports.method = function() {\n return local;\n };\n }\n } else {\n global[magicKey] = {};\n if ((typeof require !== \"undefined\" && require !== null ? require.extensions : void 0) != null) {\n ok(require(__filename).method() === magicValue);\n }\n return delete global[magicKey];\n }\n });\n test(\"javascript modules can be imported\", function() {\n var base, i, len, magicVal, module, ref, results;\n magicVal = 1;\n ref = 'import.js import2 .import2 import.extension.js import.unknownextension .coffee .coffee.md'.split(' ');\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n module = ref[i];\n results.push(ok((typeof (base = require(`./importing/${module}`)).value === \"function\" ? base.value() : void 0) === magicVal, module));\n }\n return results;\n });\n test(\"coffeescript modules can be imported\", function() {\n var base, i, len, magicVal, module, ref, results;\n magicVal = 2;\n ref = '.import.coffee import.coffee import.extension.coffee'.split(' ');\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n module = ref[i];\n results.push(ok((typeof (base = require(`./importing/${module}`)).value === \"function\" ? base.value() : void 0) === magicVal, module));\n }\n return results;\n });\n test(\"literate coffeescript modules can be imported\", function() {\n var base, i, len, magicVal, module, ref, results;\n magicVal = 3;\n ref = ' .import.coffee.md import.coffee.md import.litcoffee import.extension.coffee.md'.split(' ');\n // Leading space intentional to check for index.coffee.md\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n module = ref[i];\n results.push(ok((typeof (base = require(`./importing/${module}`)).value === \"function\" ? base.value() : void 0) === magicVal, module));\n }\n return results;\n });\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "test/importing.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/importing.coffee", "line_start": 1, "line_end": 34} +{"id": "jashkenas/coffeescript:test/importing.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Importing\n// ---------\nif (!((typeof window !== \"undefined\" && window !== null) || (typeof testingBrowser !== \"undefined\" && testingBrowser !== null))) {\n test(\"coffeescript modules can be imported and executed\", function() {\n var local, magicKey, magicValue;\n magicKey = __filename;\n magicValue = 0xFFFF;\n if (global[magicKey] != null) {\n if (typeof exports !== \"undefined\" && exports !== null) {\n local = magicValue;\n return exports.method = function() {\n return local;\n };\n }\n } else {\n global[magicKey] = {};\n if ((typeof require !== \"undefined\" && require !== null ? require.extensions : void 0) != null) {\n ok(require(__filename).method() === magicValue);\n }\n return delete global[magicKey];\n }\n });\n test(\"javascript modules can be imported\", function() {\n var base, i, len, magicVal, module, ref, results;\n magicVal = 1;\n ref = 'import.js import2 .import2 import.extension.js import.unknownextension .coffee .coffee.md'.split(' ');\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n module = ref[i];\n results.push(ok((typeof (base = require(`./importing/${module}`)).value === \"function\" ? base.value() : void 0) === magicVal, module));\n }\n return results;\n });\n test(\"coffeescript modules can be imported\", function() {\n var base, i, len, magicVal, module, ref, results;\n magicVal = 2;\n ref = '.import.coffee import.coffee import.extension.coffee'.split(' ');\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n module = ref[i];\n results.push(ok((typeof (base = require(`./importing/${module}`)).value === \"function\" ? base.value() : void 0) === magicVal, module));\n }\n return results;\n });\n test(\"literate coffeescript modules can be imported\", function() {\n var base, i, len, magicVal, module, ref, results;\n magicVal = 3;\n ref = ' .import.coffee.md import.coffee.md import.litcoffee import.extension.coffee.md'.split(' ');\n // Leading space intentional to check for index.coffee.md\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n module = ref[i];\n results.push(ok((typeof (base = require(`./importing/${module}`)).value === \"function\" ? base.value() : void 0) === magicVal, module));\n }\n return results;\n });\n}\n```", "response": "# Importing\n# ---------\n\nunless window? or testingBrowser?\n test \"coffeescript modules can be imported and executed\", ->\n\n magicKey = __filename\n magicValue = 0xFFFF\n\n if global[magicKey]?\n if exports?\n local = magicValue\n exports.method = -> local\n else\n global[magicKey] = {}\n if require?.extensions?\n ok require(__filename).method() is magicValue\n delete global[magicKey]\n\n test \"javascript modules can be imported\", ->\n magicVal = 1\n for module in 'import.js import2 .import2 import.extension.js import.unknownextension .coffee .coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"coffeescript modules can be imported\", ->\n magicVal = 2\n for module in '.import.coffee import.coffee import.extension.coffee'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"literate coffeescript modules can be imported\", ->\n magicVal = 3\n # Leading space intentional to check for index.coffee.md\n for module in ' .import.coffee.md import.coffee.md import.litcoffee import.extension.coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "test/importing.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/importing.coffee", "line_start": 1, "line_end": 34} +{"id": "jashkenas/coffeescript:test/importing.coffee:1:completion", "type": "completion", "prompt": "# Importing\n# ---------\n\nunless window? or testingBrowser?\n test \"coffeescript modules can be imported and executed\", ->\n\n magicKey = __filename\n magicValue = 0xFFFF\n\n if global[magicKey]?\n if exports?\n local = magicValue\n exports.method = -> local\n else\n global[magicKey] = {}\n if require?.extensions?\n ok require(__filename).method() is magicValue", "response": "delete global[magicKey]\n\n test \"javascript modules can be imported\", ->\n magicVal = 1\n for module in 'import.js import2 .import2 import.extension.js import.unknownextension .coffee .coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"coffeescript modules can be imported\", ->\n magicVal = 2\n for module in '.import.coffee import.coffee import.extension.coffee'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module\n\n test \"literate coffeescript modules can be imported\", ->\n magicVal = 3\n # Leading space intentional to check for index.coffee.md\n for module in ' .import.coffee.md import.coffee.md import.litcoffee import.extension.coffee.md'.split ' '\n ok require(\"./importing/#{module}\").value?() is magicVal, module", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "test/importing.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/test/importing.coffee", "line_start": 1, "line_end": 34} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n\n doc = xml({ factura: {'@id':'comprabante','@version':'2.1.0' }}, {encoding: 'UTF-8'})\n .ele('identificacionComprador', '1303963712')\n doc.ele('node')\n\n for i in [1..3]\n person = xml('person').att('id', i)\n doc.importDocument(person)\n\n eq(\n doc.end()\n '' +\n '' +\n '' +\n '1303963712' +\n '' +\n '' +\n '' +\n '' +\n '' +\n ''\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/175.coffee", "line_start": 1, "line_end": 24} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n\n doc = xml({ factura: {'@id':'comprabante','@version':'2.1.0' }}, {encoding: 'UTF-8'})\n .ele('identificacionComprador', '1303963712')\n doc.ele('node')\n\n for i in [1..3]\n person = xml('person').att('id', i)\n doc.importDocument(person)\n\n eq(\n doc.end()\n '' +\n '' +\n '' +\n '1303963712' +\n '' +\n '' +\n '' +\n '' +\n '' +\n ''\n )\n```", "response": "suite('Tests specific to issues:', function() {\n return test('importDocument overwrites parent declaration: Issue 175', function() {\n var doc, i, j, person;\n doc = xml({\n factura: {\n '@id': 'comprabante',\n '@version': '2.1.0'\n }\n }, {\n encoding: 'UTF-8'\n }).ele('identificacionComprador', '1303963712');\n doc.ele('node');\n for (i = j = 1; j <= 3; i = ++j) {\n person = xml('person').att('id', i);\n doc.importDocument(person);\n }\n return eq(doc.end(), '' + '' + '' + '1303963712' + '' + '' + '' + '' + '' + '');\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/175.coffee", "line_start": 1, "line_end": 24} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('Tests specific to issues:', function() {\n return test('importDocument overwrites parent declaration: Issue 175', function() {\n var doc, i, j, person;\n doc = xml({\n factura: {\n '@id': 'comprabante',\n '@version': '2.1.0'\n }\n }, {\n encoding: 'UTF-8'\n }).ele('identificacionComprador', '1303963712');\n doc.ele('node');\n for (i = j = 1; j <= 3; i = ++j) {\n person = xml('person').att('id', i);\n doc.importDocument(person);\n }\n return eq(doc.end(), '' + '' + '' + '1303963712' + '' + '' + '' + '' + '' + '');\n });\n});\n```", "response": "suite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n\n doc = xml({ factura: {'@id':'comprabante','@version':'2.1.0' }}, {encoding: 'UTF-8'})\n .ele('identificacionComprador', '1303963712')\n doc.ele('node')\n\n for i in [1..3]\n person = xml('person').att('id', i)\n doc.importDocument(person)\n\n eq(\n doc.end()\n '' +\n '' +\n '' +\n '1303963712' +\n '' +\n '' +\n '' +\n '' +\n '' +\n ''\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/175.coffee", "line_start": 1, "line_end": 24} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:completion", "type": "completion", "prompt": "suite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n\n doc = xml({ factura: {'@id':'comprabante','@version':'2.1.0' }}, {encoding: 'UTF-8'})\n .ele('identificacionComprador', '1303963712')\n doc.ele('node')\n\n for i in [1..3]\n person = xml('person').att('id', i)\n doc.importDocument(person)\n\n eq(", "response": "doc.end()\n '' +\n '' +\n '' +\n '1303963712' +\n '' +\n '' +\n '' +\n '' +\n '' +\n ''\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/issues/175.coffee", "line_start": 1, "line_end": 24} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n imported = xml('import', { version: \"1.0\", encoding: \"utf-8\" })\n .ele('node', 'imported')\n\n eq(\n xml('test', {version : \"1.1\", encoding: \"de-de\"})\n .importDocument(imported)\n .end()\n '' +\n '' +\n '' +\n 'imported' +\n '' +\n ''\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "c2215ebdb751a3374905bee2202f6dbf0ad0b53a", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/c2215ebdb751a3374905bee2202f6dbf0ad0b53a/test/issues/175.coffee", "line_start": 1, "line_end": 16} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n imported = xml('import', { version: \"1.0\", encoding: \"utf-8\" })\n .ele('node', 'imported')\n\n eq(\n xml('test', {version : \"1.1\", encoding: \"de-de\"})\n .importDocument(imported)\n .end()\n '' +\n '' +\n '' +\n 'imported' +\n '' +\n ''\n )\n```", "response": "suite('Tests specific to issues:', function() {\n return test('importDocument overwrites parent declaration: Issue 175', function() {\n var imported;\n imported = xml('import', {\n version: \"1.0\",\n encoding: \"utf-8\"\n }).ele('node', 'imported');\n return eq(xml('test', {\n version: \"1.1\",\n encoding: \"de-de\"\n }).importDocument(imported).end(), '' + '' + '' + 'imported' + '' + '');\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "c2215ebdb751a3374905bee2202f6dbf0ad0b53a", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/c2215ebdb751a3374905bee2202f6dbf0ad0b53a/test/issues/175.coffee", "line_start": 1, "line_end": 16} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('Tests specific to issues:', function() {\n return test('importDocument overwrites parent declaration: Issue 175', function() {\n var imported;\n imported = xml('import', {\n version: \"1.0\",\n encoding: \"utf-8\"\n }).ele('node', 'imported');\n return eq(xml('test', {\n version: \"1.1\",\n encoding: \"de-de\"\n }).importDocument(imported).end(), '' + '' + '' + 'imported' + '' + '');\n });\n});\n```", "response": "suite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n imported = xml('import', { version: \"1.0\", encoding: \"utf-8\" })\n .ele('node', 'imported')\n\n eq(\n xml('test', {version : \"1.1\", encoding: \"de-de\"})\n .importDocument(imported)\n .end()\n '' +\n '' +\n '' +\n 'imported' +\n '' +\n ''\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "c2215ebdb751a3374905bee2202f6dbf0ad0b53a", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/c2215ebdb751a3374905bee2202f6dbf0ad0b53a/test/issues/175.coffee", "line_start": 1, "line_end": 16} +{"id": "oozcitak/xmlbuilder-js:test/issues/175.coffee:1:completion", "type": "completion", "prompt": "suite 'Tests specific to issues:', ->\n test 'importDocument overwrites parent declaration: Issue 175', ->\n imported = xml('import', { version: \"1.0\", encoding: \"utf-8\" })\n .ele('node', 'imported')\n\n eq(\n xml('test', {version : \"1.1\", encoding: \"de-de\"})\n .importDocument(imported)", "response": ".end()\n '' +\n '' +\n '' +\n 'imported' +\n '' +\n ''\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/issues/175.coffee", "license": "MIT", "commit": "c2215ebdb751a3374905bee2202f6dbf0ad0b53a", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/c2215ebdb751a3374905bee2202f6dbf0ad0b53a/test/issues/175.coffee", "line_start": 1, "line_end": 16} +{"id": "kelp404/angular-form-builder:src/drag.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "drag = ($injector) ->\n # ----------------------------------------\n # provider\n # ----------------------------------------\n\n\n # ----------------------------------------\n # properties\n # ----------------------------------------\n @data =\n # all draggable objects\n draggables: []\n # all droppable objects\n droppables: []\n\n\n # ----------------------------------------\n # event hooks\n # ----------------------------------------\n @eventMouseDown = ->\n @eventMouseMove = ->\n @eventMouseUp = ->\n $ =>\n $(document).on 'mousedown', (e) => @eventMouseDown e\n $(document).on 'mousemove', (e) => @eventMouseMove e\n $(document).on 'mouseup', (e) => @eventMouseUp e\n\n\n # ----------------------------------------\n # private methods\n # ----------------------------------------\n @makeMirrorMode = ($element) =>\n result =\n mode: 'mirror'\n maternal: $element[0]\n element: null\n\n $element.on 'mousedown', (e) =>\n e.preventDefault()\n\n $clone = $element.clone()\n result.element = $clone[0]\n $clone.css\n width: $element.width()\n height: $element.height()\n $clone.addClass \"fb-draggable form-horizontal dragging\"\n @eventMouseMove = (e) =>\n $clone.offset\n left: e.pageX - $clone.width() / 2\n top: e.pageY - $clone.height() / 2", "source_lang": "", "target_lang": "CoffeeScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 3, "line_end": 52} +{"id": "kelp404/angular-form-builder:src/drag.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndrag = ($injector) ->\n # ----------------------------------------\n # provider\n # ----------------------------------------\n\n\n # ----------------------------------------\n # properties\n # ----------------------------------------\n @data =\n # all draggable objects\n draggables: []\n # all droppable objects\n droppables: []\n\n\n # ----------------------------------------\n # event hooks\n # ----------------------------------------\n @eventMouseDown = ->\n @eventMouseMove = ->\n @eventMouseUp = ->\n $ =>\n $(document).on 'mousedown', (e) => @eventMouseDown e\n $(document).on 'mousemove', (e) => @eventMouseMove e\n $(document).on 'mouseup', (e) => @eventMouseUp e\n\n\n # ----------------------------------------\n # private methods\n # ----------------------------------------\n @makeMirrorMode = ($element) =>\n result =\n mode: 'mirror'\n maternal: $element[0]\n element: null\n\n $element.on 'mousedown', (e) =>\n e.preventDefault()\n\n $clone = $element.clone()\n result.element = $clone[0]\n $clone.css\n width: $element.width()\n height: $element.height()\n $clone.addClass \"fb-draggable form-horizontal dragging\"\n @eventMouseMove = (e) =>\n $clone.offset\n left: e.pageX - $clone.width() / 2\n top: e.pageY - $clone.height() / 2\n```", "response": "var drag;\n\ndrag = function($injector) {\n // ----------------------------------------\n // provider\n // ----------------------------------------\n\n // ----------------------------------------\n // properties\n // ----------------------------------------\n this.data = {\n // all draggable objects\n draggables: [],\n // all droppable objects\n droppables: []\n };\n // ----------------------------------------\n // event hooks\n // ----------------------------------------\n this.eventMouseDown = function() {};\n this.eventMouseMove = function() {};\n this.eventMouseUp = function() {};\n $(() => {\n $(document).on('mousedown', (e) => {\n return this.eventMouseDown(e);\n });\n $(document).on('mousemove', (e) => {\n return this.eventMouseMove(e);\n });\n return $(document).on('mouseup', (e) => {\n return this.eventMouseUp(e);\n });\n });\n // ----------------------------------------\n // private methods\n // ----------------------------------------\n return this.makeMirrorMode = ($element) => {\n var result;\n result = {\n mode: 'mirror',\n maternal: $element[0],\n element: null\n };\n return $element.on('mousedown', (e) => {\n var $clone;\n e.preventDefault();\n $clone = $element.clone();\n result.element = $clone[0];\n $clone.css({\n width: $element.width(),\n height: $element.height()\n });\n $clone.addClass(\"fb-draggable form-horizontal dragging\");\n return this.eventMouseMove = (e) => {\n return $clone.offset({\n left: e.pageX - $clone.width() / 2,\n top: e.pageY - $clone.height() / 2\n });\n };\n });\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 3, "line_end": 52} +{"id": "kelp404/angular-form-builder:src/drag.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar drag;\n\ndrag = function($injector) {\n // ----------------------------------------\n // provider\n // ----------------------------------------\n\n // ----------------------------------------\n // properties\n // ----------------------------------------\n this.data = {\n // all draggable objects\n draggables: [],\n // all droppable objects\n droppables: []\n };\n // ----------------------------------------\n // event hooks\n // ----------------------------------------\n this.eventMouseDown = function() {};\n this.eventMouseMove = function() {};\n this.eventMouseUp = function() {};\n $(() => {\n $(document).on('mousedown', (e) => {\n return this.eventMouseDown(e);\n });\n $(document).on('mousemove', (e) => {\n return this.eventMouseMove(e);\n });\n return $(document).on('mouseup', (e) => {\n return this.eventMouseUp(e);\n });\n });\n // ----------------------------------------\n // private methods\n // ----------------------------------------\n return this.makeMirrorMode = ($element) => {\n var result;\n result = {\n mode: 'mirror',\n maternal: $element[0],\n element: null\n };\n return $element.on('mousedown', (e) => {\n var $clone;\n e.preventDefault();\n $clone = $element.clone();\n result.element = $clone[0];\n $clone.css({\n width: $element.width(),\n height: $element.height()\n });\n $clone.addClass(\"fb-draggable form-horizontal dragging\");\n return this.eventMouseMove = (e) => {\n return $clone.offset({\n left: e.pageX - $clone.width() / 2,\n top: e.pageY - $clone.height() / 2\n });\n };\n });\n };\n};\n```", "response": "drag = ($injector) ->\n # ----------------------------------------\n # provider\n # ----------------------------------------\n\n\n # ----------------------------------------\n # properties\n # ----------------------------------------\n @data =\n # all draggable objects\n draggables: []\n # all droppable objects\n droppables: []\n\n\n # ----------------------------------------\n # event hooks\n # ----------------------------------------\n @eventMouseDown = ->\n @eventMouseMove = ->\n @eventMouseUp = ->\n $ =>\n $(document).on 'mousedown', (e) => @eventMouseDown e\n $(document).on 'mousemove', (e) => @eventMouseMove e\n $(document).on 'mouseup', (e) => @eventMouseUp e\n\n\n # ----------------------------------------\n # private methods\n # ----------------------------------------\n @makeMirrorMode = ($element) =>\n result =\n mode: 'mirror'\n maternal: $element[0]\n element: null\n\n $element.on 'mousedown', (e) =>\n e.preventDefault()\n\n $clone = $element.clone()\n result.element = $clone[0]\n $clone.css\n width: $element.width()\n height: $element.height()\n $clone.addClass \"fb-draggable form-horizontal dragging\"\n @eventMouseMove = (e) =>\n $clone.offset\n left: e.pageX - $clone.width() / 2\n top: e.pageY - $clone.height() / 2", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 3, "line_end": 52} +{"id": "kelp404/angular-form-builder:src/drag.coffee:1:completion", "type": "completion", "prompt": "drag = ($injector) ->\n # ----------------------------------------\n # provider\n # ----------------------------------------\n\n\n # ----------------------------------------\n # properties\n # ----------------------------------------\n @data =\n # all draggable objects\n draggables: []\n # all droppable objects\n droppables: []\n\n\n # ----------------------------------------\n # event hooks\n # ----------------------------------------\n @eventMouseDown = ->\n @eventMouseMove = ->\n @eventMouseUp = ->\n $ =>\n $(document).on 'mousedown', (e) => @eventMouseDown e\n $(document).on 'mousemove', (e) => @eventMouseMove e", "response": "$(document).on 'mouseup', (e) => @eventMouseUp e\n\n\n # ----------------------------------------\n # private methods\n # ----------------------------------------\n @makeMirrorMode = ($element) =>\n result =\n mode: 'mirror'\n maternal: $element[0]\n element: null\n\n $element.on 'mousedown', (e) =>\n e.preventDefault()\n\n $clone = $element.clone()\n result.element = $clone[0]\n $clone.css\n width: $element.width()\n height: $element.height()\n $clone.addClass \"fb-draggable form-horizontal dragging\"\n @eventMouseMove = (e) =>\n $clone.offset\n left: e.pageX - $clone.width() / 2\n top: e.pageY - $clone.height() / 2", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 3, "line_end": 52} +{"id": "kelp404/angular-form-builder:src/drag.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@eventMouseUp = (e) =>\n @eventMouseMove = ->\n @eventMouseUp = ->\n result.element = null\n $clone.remove()\n $('body').append $clone\n @eventMouseMove e # setup left & top of the element\n result\n\n\n @makeDragMode = ($element) =>\n result =\n mode: 'drag'\n maternal: null\n element: $element[0]\n\n $element.addClass 'fb-draggable'\n $element.on 'mousedown', (e) =>\n e.preventDefault()\n return if $element.hasClass 'dragging'\n\n $element.css\n width: $element.width()\n height: $element.height()\n $element.addClass 'dragging'\n @eventMouseMove = (e) =>\n $element.offset\n left: e.pageX - $element.width() / 2\n top: e.pageY - $element.height() / 2\n @eventMouseUp = (e) =>\n @eventMouseMove = ->\n @eventMouseUp = ->\n $element.css\n width: ''\n height: ''\n left: ''\n top: ''\n $element.removeClass 'dragging'\n @eventMouseMove e # setup left & top of the element\n result\n\n\n # ----------------------------------------\n # public methods\n # ----------------------------------------\n @draggable = ($element, options={}) =>\n ###\n Make the element could be drag.\n @param element: The jQuery element.\n @param options: Options", "source_lang": "", "target_lang": "CoffeeScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 53, "line_end": 102} +{"id": "kelp404/angular-form-builder:src/drag.coffee:2:completion", "type": "completion", "prompt": "@eventMouseUp = (e) =>\n @eventMouseMove = ->\n @eventMouseUp = ->\n result.element = null\n $clone.remove()\n $('body').append $clone\n @eventMouseMove e # setup left & top of the element\n result\n\n\n @makeDragMode = ($element) =>\n result =\n mode: 'drag'\n maternal: null\n element: $element[0]\n\n $element.addClass 'fb-draggable'\n $element.on 'mousedown', (e) =>\n e.preventDefault()\n return if $element.hasClass 'dragging'\n\n $element.css\n width: $element.width()\n height: $element.height()\n $element.addClass 'dragging'", "response": "@eventMouseMove = (e) =>\n $element.offset\n left: e.pageX - $element.width() / 2\n top: e.pageY - $element.height() / 2\n @eventMouseUp = (e) =>\n @eventMouseMove = ->\n @eventMouseUp = ->\n $element.css\n width: ''\n height: ''\n left: ''\n top: ''\n $element.removeClass 'dragging'\n @eventMouseMove e # setup left & top of the element\n result\n\n\n # ----------------------------------------\n # public methods\n # ----------------------------------------\n @draggable = ($element, options={}) =>\n ###\n Make the element could be drag.\n @param element: The jQuery element.\n @param options: Options", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 53, "line_end": 102} +{"id": "kelp404/angular-form-builder:src/drag.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "mode: 'drag' [default], 'mirror'\n ###\n if options.mode is 'mirror'\n for element in $element\n @data.draggables.push @makeMirrorMode($(element))\n else\n for element in $element\n @data.draggables.push @makeDragMode($(element))\n return\n\n\n @removeDraggable = ($element) ->\n $element\n\n\n @droppable = ($element, opeions) ->\n ###\n Make the element coulde be drop.\n @param $element: The jQuery element.\n ###\n $element\n\n\n # ----------------------------------------\n # factory\n # ----------------------------------------\n data: @data\n draggable: @draggable\n removeDraggable: @removeDraggable\n droppable: @droppable\n\ndrag.$inject = ['$injector']\na.factory '$drag', drag", "source_lang": "", "target_lang": "CoffeeScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 103, "line_end": 135} +{"id": "kelp404/angular-form-builder:src/drag.coffee:3:completion", "type": "completion", "prompt": "mode: 'drag' [default], 'mirror'\n ###\n if options.mode is 'mirror'\n for element in $element\n @data.draggables.push @makeMirrorMode($(element))\n else\n for element in $element\n @data.draggables.push @makeDragMode($(element))\n return\n\n\n @removeDraggable = ($element) ->\n $element\n\n\n @droppable = ($element, opeions) ->", "response": "###\n Make the element coulde be drop.\n @param $element: The jQuery element.\n ###\n $element\n\n\n # ----------------------------------------\n # factory\n # ----------------------------------------\n data: @data\n draggable: @draggable\n removeDraggable: @removeDraggable\n droppable: @droppable\n\ndrag.$inject = ['$injector']\na.factory '$drag', drag", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "kelp404/angular-form-builder", "path": "src/drag.coffee", "license": "MIT", "commit": "31b987cb64aa2aab15102e3b880b268cf3309cb7", "stars": 600, "source_url": "https://github.com/kelp404/angular-form-builder/blob/31b987cb64aa2aab15102e3b880b268cf3309cb7/src/drag.coffee", "line_start": 103, "line_end": 135} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Gets the primitive value of an object\ngetValue = (obj) ->\n if isFunction obj.valueOf\n obj.valueOf()\n else\n obj", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Gets the primitive value of an object\ngetValue = (obj) ->\n if isFunction obj.valueOf\n obj.valueOf()\n else\n obj\n```", "response": "// Copies all enumerable own properties from `sources` to `target`\nvar assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,\n hasProp = {}.hasOwnProperty;\n\nassign = function(target, ...sources) {\n var i, key, len, source;\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n};\n\n// Determines if `val` is a Function object\nisFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n};\n\n// Determines if `val` is an Object\nisObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n};\n\n// Determines if `val` is an Array\nisArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n};\n\n// Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n};\n\n// Determines if `val` is a plain Object\nisPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n};\n\n// Gets the primitive value of an object\ngetValue = function(obj) {\n if (isFunction(obj.valueOf)) {\n return obj.valueOf();\n } else {\n return obj;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Copies all enumerable own properties from `sources` to `target`\nvar assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,\n hasProp = {}.hasOwnProperty;\n\nassign = function(target, ...sources) {\n var i, key, len, source;\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n};\n\n// Determines if `val` is a Function object\nisFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n};\n\n// Determines if `val` is an Object\nisObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n};\n\n// Determines if `val` is an Array\nisArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n};\n\n// Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n};\n\n// Determines if `val` is a plain Object\nisPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n};\n\n// Gets the primitive value of an object\ngetValue = function(obj) {\n if (isFunction(obj.valueOf)) {\n return obj.valueOf();\n } else {\n return obj;\n }\n};\n```", "response": "# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Gets the primitive value of an object\ngetValue = (obj) ->\n if isFunction obj.valueOf\n obj.valueOf()\n else\n obj", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:completion", "type": "completion", "prompt": "# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'", "response": "# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Gets the primitive value of an object\ngetValue = (obj) ->\n if isFunction obj.valueOf\n obj.valueOf()\n else\n obj", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "b7da010f43dc58e32f0264943ee55c3fcf3e56bd", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n```", "response": "// Copies all enumerable own properties from `sources` to `target`\nvar assign, isArray, isEmpty, isFunction, isObject, isPlainObject,\n hasProp = {}.hasOwnProperty;\n\nassign = function(target, ...sources) {\n var i, key, len, source;\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n};\n\n// Determines if `val` is a Function object\nisFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n};\n\n// Determines if `val` is an Object\nisObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n};\n\n// Determines if `val` is an Array\nisArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n};\n\n// Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n};\n\n// Determines if `val` is a plain Object\nisPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n};\n\nmodule.exports.assign = assign;\n\nmodule.exports.isFunction = isFunction;\n\nmodule.exports.isObject = isObject;\n\nmodule.exports.isArray = isArray;\n\nmodule.exports.isEmpty = isEmpty;\n\nmodule.exports.isPlainObject = isPlainObject;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "b7da010f43dc58e32f0264943ee55c3fcf3e56bd", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Copies all enumerable own properties from `sources` to `target`\nvar assign, isArray, isEmpty, isFunction, isObject, isPlainObject,\n hasProp = {}.hasOwnProperty;\n\nassign = function(target, ...sources) {\n var i, key, len, source;\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n};\n\n// Determines if `val` is a Function object\nisFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n};\n\n// Determines if `val` is an Object\nisObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n};\n\n// Determines if `val` is an Array\nisArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n};\n\n// Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n};\n\n// Determines if `val` is a plain Object\nisPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n};\n\nmodule.exports.assign = assign;\n\nmodule.exports.isFunction = isFunction;\n\nmodule.exports.isObject = isObject;\n\nmodule.exports.isArray = isArray;\n\nmodule.exports.isEmpty = isEmpty;\n\nmodule.exports.isPlainObject = isPlainObject;\n```", "response": "# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "b7da010f43dc58e32f0264943ee55c3fcf3e56bd", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:completion", "type": "completion", "prompt": "# Copies all enumerable own properties from `sources` to `target`\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'", "response": "# Determines if `val` is an empty Array or an Object with no own properties\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "b7da010f43dc58e32f0264943ee55c3fcf3e56bd", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b7da010f43dc58e32f0264943ee55c3fcf3e56bd/src/Utility.coffee", "line_start": 1, "line_end": 50} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "assign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 2, "line_end": 11} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nassign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object\n```", "response": "var assign,\n hasProp = {}.hasOwnProperty;\n\nassign = function(target, ...sources) {\n var i, key, len, source;\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n};\n\n// Determines if `val` is a Function object", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 2, "line_end": 11} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar assign,\n hasProp = {}.hasOwnProperty;\n\nassign = function(target, ...sources) {\n var i, key, len, source;\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n};\n\n// Determines if `val` is a Function object\n```", "response": "assign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?\n target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 2, "line_end": 11} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:1:completion", "type": "completion", "prompt": "assign = (target, sources...) ->\n if isFunction Object.assign\n Object.assign.apply null, arguments\n else\n for source in sources when source?", "response": "target[key] = source[key] for own key of source\n\n return target\n\n# Determines if `val` is a Function object", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 2, "line_end": 11} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 12, "line_end": 15} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object\n```", "response": "var isFunction;\n\nisFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n};\n\n// Determines if `val` is an Object", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 12, "line_end": 15} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isFunction;\n\nisFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n};\n\n// Determines if `val` is an Object\n```", "response": "isFunction = (val) ->\n !!val and Object.prototype.toString.call(val) is '[object Function]'\n\n# Determines if `val` is an Object", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 12, "line_end": 15} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 16, "line_end": 19} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array\n```", "response": "var isObject;\n\nisObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n};\n\n// Determines if `val` is an Array", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 16, "line_end": 19} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isObject;\n\nisObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n};\n\n// Determines if `val` is an Array\n```", "response": "isObject = (val) ->\n !!val and typeof val in ['function', 'object']\n\n# Determines if `val` is an Array", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 16, "line_end": 19} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 20, "line_end": 26} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties\n```", "response": "var isArray;\n\nisArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n};\n\n// Determines if `val` is an empty Array or an Object with no own properties", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 20, "line_end": 26} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isArray;\n\nisArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n};\n\n// Determines if `val` is an empty Array or an Object with no own properties\n```", "response": "isArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val\n else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 20, "line_end": 26} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:4:completion", "type": "completion", "prompt": "isArray = (val) ->\n if isFunction Array.isArray\n Array.isArray val", "response": "else\n Object.prototype.toString.call(val) is '[object Array]'\n\n# Determines if `val` is an empty Array or an Object with no own properties", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 20, "line_end": 26} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 27, "line_end": 35} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object\n```", "response": "var isEmpty,\n hasProp = {}.hasOwnProperty;\n\nisEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n};\n\n// Determines if `val` is a plain Object", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 27, "line_end": 35} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isEmpty,\n hasProp = {}.hasOwnProperty;\n\nisEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n};\n\n// Determines if `val` is a plain Object\n```", "response": "isEmpty = (val) ->\n if isArray val\n return !val.length\n else\n for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 27, "line_end": 35} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:5:completion", "type": "completion", "prompt": "isEmpty = (val) ->\n if isArray val\n return !val.length\n else", "response": "for own key of val\n return false\n return true\n\n# Determines if `val` is a plain Object", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 27, "line_end": 35} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Splits the given string into words", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 36, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nisPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Splits the given string into words\n```", "response": "var isPlainObject;\n\nisPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n};\n\n// Splits the given string into words", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 36, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isPlainObject;\n\nisPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n};\n\n// Splits the given string into words\n```", "response": "isPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and\n (typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Splits the given string into words", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 36, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:6:completion", "type": "completion", "prompt": "isPlainObject = (val) ->\n isObject(val) and\n (proto = Object.getPrototypeOf val) and\n (ctor = proto.constructor) and", "response": "(typeof ctor is 'function') and\n (ctor instanceof ctor) and\n (Function.prototype.toString.call(ctor) is Function.prototype.toString.call(Object))\n\n# Splits the given string into words", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 36, "line_end": 44} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "words = (val) ->\n (val.split(/[-_\\s]+|(?=[A-Z][a-z])/) or []).filter((n) -> !!n)\n\n# Converts the string to camel case", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 45, "line_end": 48} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwords = (val) ->\n (val.split(/[-_\\s]+|(?=[A-Z][a-z])/) or []).filter((n) -> !!n)\n\n# Converts the string to camel case\n```", "response": "var words;\n\nwords = function(val) {\n return (val.split(/[-_\\s]+|(?=[A-Z][a-z])/) || []).filter(function(n) {\n return !!n;\n });\n};\n\n// Converts the string to camel case", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 45, "line_end": 48} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar words;\n\nwords = function(val) {\n return (val.split(/[-_\\s]+|(?=[A-Z][a-z])/) || []).filter(function(n) {\n return !!n;\n });\n};\n\n// Converts the string to camel case\n```", "response": "words = (val) ->\n (val.split(/[-_\\s]+|(?=[A-Z][a-z])/) or []).filter((n) -> !!n)\n\n# Converts the string to camel case", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 45, "line_end": 48} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "camelCase = (val) ->\n r = ''\n for word, index in words(val)\n r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to title case", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncamelCase = (val) ->\n r = ''\n for word, index in words(val)\n r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to title case\n```", "response": "var camelCase;\n\ncamelCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += index ? capitalize(word.toLowerCase()) : word.toLowerCase();\n }\n return r;\n};\n\n// Converts the string to title case", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar camelCase;\n\ncamelCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += index ? capitalize(word.toLowerCase()) : word.toLowerCase();\n }\n return r;\n};\n\n// Converts the string to title case\n```", "response": "camelCase = (val) ->\n r = ''\n for word, index in words(val)\n r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to title case", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:completion", "type": "completion", "prompt": "camelCase = (val) ->\n r = ''\n for word, index in words(val)", "response": "r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to title case", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "titleCase = (val) ->\n r = ''\n for word, index in words(val)\n r += capitalize(word.toLowerCase())\n return r\n\n# Converts the string to kebab case", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 56, "line_end": 62} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:9:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntitleCase = (val) ->\n r = ''\n for word, index in words(val)\n r += capitalize(word.toLowerCase())\n return r\n\n# Converts the string to kebab case\n```", "response": "var titleCase;\n\ntitleCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += capitalize(word.toLowerCase());\n }\n return r;\n};\n\n// Converts the string to kebab case", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 56, "line_end": 62} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:9:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar titleCase;\n\ntitleCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += capitalize(word.toLowerCase());\n }\n return r;\n};\n\n// Converts the string to kebab case\n```", "response": "titleCase = (val) ->\n r = ''\n for word, index in words(val)\n r += capitalize(word.toLowerCase())\n return r\n\n# Converts the string to kebab case", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 56, "line_end": 62} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:9:completion", "type": "completion", "prompt": "titleCase = (val) ->\n r = ''\n for word, index in words(val)", "response": "r += capitalize(word.toLowerCase())\n return r\n\n# Converts the string to kebab case", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 56, "line_end": 62} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:10:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "kebabCase = (val) ->\n r = ''\n for word, index in words(val)\n r += (if index then '-' else '') + word.toLowerCase()\n return r\n\n# Converts the string to snake case", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 63, "line_end": 69} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:10:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nkebabCase = (val) ->\n r = ''\n for word, index in words(val)\n r += (if index then '-' else '') + word.toLowerCase()\n return r\n\n# Converts the string to snake case\n```", "response": "var kebabCase;\n\nkebabCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += (index ? '-' : '') + word.toLowerCase();\n }\n return r;\n};\n\n// Converts the string to snake case", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 63, "line_end": 69} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:10:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar kebabCase;\n\nkebabCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += (index ? '-' : '') + word.toLowerCase();\n }\n return r;\n};\n\n// Converts the string to snake case\n```", "response": "kebabCase = (val) ->\n r = ''\n for word, index in words(val)\n r += (if index then '-' else '') + word.toLowerCase()\n return r\n\n# Converts the string to snake case", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 63, "line_end": 69} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:10:completion", "type": "completion", "prompt": "kebabCase = (val) ->\n r = ''\n for word, index in words(val)", "response": "r += (if index then '-' else '') + word.toLowerCase()\n return r\n\n# Converts the string to snake case", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 63, "line_end": 69} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "snakeCase = (val) ->\n r = ''\n for word, index in words(val)\n r += (if index then '_' else '') + word.toLowerCase()\n return r\n\n# Capitalize the first letter of the string", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 70, "line_end": 76} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsnakeCase = (val) ->\n r = ''\n for word, index in words(val)\n r += (if index then '_' else '') + word.toLowerCase()\n return r\n\n# Capitalize the first letter of the string\n```", "response": "var snakeCase;\n\nsnakeCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += (index ? '_' : '') + word.toLowerCase();\n }\n return r;\n};\n\n// Capitalize the first letter of the string", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 70, "line_end": 76} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar snakeCase;\n\nsnakeCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += (index ? '_' : '') + word.toLowerCase();\n }\n return r;\n};\n\n// Capitalize the first letter of the string\n```", "response": "snakeCase = (val) ->\n r = ''\n for word, index in words(val)\n r += (if index then '_' else '') + word.toLowerCase()\n return r\n\n# Capitalize the first letter of the string", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 70, "line_end": 76} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:completion", "type": "completion", "prompt": "snakeCase = (val) ->\n r = ''\n for word, index in words(val)", "response": "r += (if index then '_' else '') + word.toLowerCase()\n return r\n\n# Capitalize the first letter of the string", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 70, "line_end": 76} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:12:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "capitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.titleCase = titleCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 77, "line_end": 93} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:12:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncapitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.titleCase = titleCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words\n```", "response": "var capitalize;\n\ncapitalize = function(val) {\n return val.charAt(0).toUpperCase() + val.slice(1);\n};\n\nmodule.exports.assign = assign;\n\nmodule.exports.isFunction = isFunction;\n\nmodule.exports.isObject = isObject;\n\nmodule.exports.isArray = isArray;\n\nmodule.exports.isEmpty = isEmpty;\n\nmodule.exports.isPlainObject = isPlainObject;\n\nmodule.exports.camelCase = camelCase;\n\nmodule.exports.titleCase = titleCase;\n\nmodule.exports.kebabCase = kebabCase;\n\nmodule.exports.snakeCase = snakeCase;\n\nmodule.exports.capitalize = capitalize;\n\nmodule.exports.words = words;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 77, "line_end": 93} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:12:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar capitalize;\n\ncapitalize = function(val) {\n return val.charAt(0).toUpperCase() + val.slice(1);\n};\n\nmodule.exports.assign = assign;\n\nmodule.exports.isFunction = isFunction;\n\nmodule.exports.isObject = isObject;\n\nmodule.exports.isArray = isArray;\n\nmodule.exports.isEmpty = isEmpty;\n\nmodule.exports.isPlainObject = isPlainObject;\n\nmodule.exports.camelCase = camelCase;\n\nmodule.exports.titleCase = titleCase;\n\nmodule.exports.kebabCase = kebabCase;\n\nmodule.exports.snakeCase = snakeCase;\n\nmodule.exports.capitalize = capitalize;\n\nmodule.exports.words = words;\n```", "response": "capitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.titleCase = titleCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 77, "line_end": 93} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:12:completion", "type": "completion", "prompt": "capitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray", "response": "module.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.titleCase = titleCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "d8c2ad0658592b3fa6f04df1d21e24871ae156ea", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/d8c2ad0658592b3fa6f04df1d21e24871ae156ea/src/Utility.coffee", "line_start": 77, "line_end": 93} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "camelCase = (val) ->\n r = ''\n for word, index in words(val)\n r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to kebab case", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncamelCase = (val) ->\n r = ''\n for word, index in words(val)\n r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to kebab case\n```", "response": "var camelCase;\n\ncamelCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += index ? capitalize(word.toLowerCase()) : word.toLowerCase();\n }\n return r;\n};\n\n// Converts the string to kebab case", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar camelCase;\n\ncamelCase = function(val) {\n var i, index, len, r, ref, word;\n r = '';\n ref = words(val);\n for (index = i = 0, len = ref.length; i < len; index = ++i) {\n word = ref[index];\n r += index ? capitalize(word.toLowerCase()) : word.toLowerCase();\n }\n return r;\n};\n\n// Converts the string to kebab case\n```", "response": "camelCase = (val) ->\n r = ''\n for word, index in words(val)\n r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to kebab case", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:8:completion", "type": "completion", "prompt": "camelCase = (val) ->\n r = ''\n for word, index in words(val)", "response": "r += if index then capitalize(word.toLowerCase()) else word.toLowerCase()\n return r\n\n# Converts the string to kebab case", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 49, "line_end": 55} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "capitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 70, "line_end": 85} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncapitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words\n```", "response": "var capitalize;\n\ncapitalize = function(val) {\n return val.charAt(0).toUpperCase() + val.slice(1);\n};\n\nmodule.exports.assign = assign;\n\nmodule.exports.isFunction = isFunction;\n\nmodule.exports.isObject = isObject;\n\nmodule.exports.isArray = isArray;\n\nmodule.exports.isEmpty = isEmpty;\n\nmodule.exports.isPlainObject = isPlainObject;\n\nmodule.exports.camelCase = camelCase;\n\nmodule.exports.kebabCase = kebabCase;\n\nmodule.exports.snakeCase = snakeCase;\n\nmodule.exports.capitalize = capitalize;\n\nmodule.exports.words = words;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 70, "line_end": 85} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar capitalize;\n\ncapitalize = function(val) {\n return val.charAt(0).toUpperCase() + val.slice(1);\n};\n\nmodule.exports.assign = assign;\n\nmodule.exports.isFunction = isFunction;\n\nmodule.exports.isObject = isObject;\n\nmodule.exports.isArray = isArray;\n\nmodule.exports.isEmpty = isEmpty;\n\nmodule.exports.isPlainObject = isPlainObject;\n\nmodule.exports.camelCase = camelCase;\n\nmodule.exports.kebabCase = kebabCase;\n\nmodule.exports.snakeCase = snakeCase;\n\nmodule.exports.capitalize = capitalize;\n\nmodule.exports.words = words;\n```", "response": "capitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray\nmodule.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 70, "line_end": 85} +{"id": "oozcitak/xmlbuilder-js:src/Utility.coffee:11:completion", "type": "completion", "prompt": "capitalize = (val) ->\n val.charAt(0).toUpperCase() + val.slice(1);\n\n\nmodule.exports.assign = assign\nmodule.exports.isFunction = isFunction\nmodule.exports.isObject = isObject\nmodule.exports.isArray = isArray", "response": "module.exports.isEmpty = isEmpty\nmodule.exports.isPlainObject = isPlainObject\n\nmodule.exports.camelCase = camelCase\nmodule.exports.kebabCase = kebabCase\nmodule.exports.snakeCase = snakeCase\nmodule.exports.capitalize = capitalize\nmodule.exports.words = words", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/Utility.coffee", "license": "MIT", "commit": "ab0c6d3649828decfdd0c4b0e16021a3f300cc47", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ab0c6d3649828decfdd0c4b0e16021a3f300cc47/src/Utility.coffee", "line_start": 70, "line_end": 85} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class TransformerBase\n @run: (ast, options) ->\n new this(ast, options).run()\n\n constructor: (@ast, @options) ->\n @scopes = []\n @ctx = { vars: [] }\n\n ###*\n # run():\n # Runs estraverse on `@ast`, and invokes functions on enter and exit\n # depending on the node type. This is also in change of changing `@depth`,\n # `@node`, `@controller` (etc) every step of the way.\n #\n # Transformer.run(ast)\n # # roughly equivalent to: new Transformer(ast).run()\n ###\n\n run: ->\n @recurse @ast\n\n ###*\n # recurse():\n # Delegate function of `run()`. See [run()] for details.\n #\n # This is sometimes called on its own to recurse down a certain path which\n # will otherwise be skipped.\n ###\n\n recurse: (root) ->\n self = this\n @depth = 0\n\n runner = (direction, node, parent) =>\n @node = node\n @depth += if direction is 'Enter' then +1 else -1\n fnName = if direction is 'Enter' \\\n then \"#{node.type}\" else \"#{node.type}Exit\"\n\n @[\"onBefore#{direction}\"]?(node)\n result = @[fnName]?(node, parent)\n @[\"on#{direction}\"]?(node)\n result\n\n @estraverse().replace root,\n enter: (node, parent) ->\n self.controller = this\n runner(\"Enter\", node, parent)\n leave: (node, parent) ->\n runner(\"Exit\", node, parent)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 50, "line_end": 99} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass TransformerBase\n @run: (ast, options) ->\n new this(ast, options).run()\n\n constructor: (@ast, @options) ->\n @scopes = []\n @ctx = { vars: [] }\n\n ###*\n # run():\n # Runs estraverse on `@ast`, and invokes functions on enter and exit\n # depending on the node type. This is also in change of changing `@depth`,\n # `@node`, `@controller` (etc) every step of the way.\n #\n # Transformer.run(ast)\n # # roughly equivalent to: new Transformer(ast).run()\n ###\n\n run: ->\n @recurse @ast\n\n ###*\n # recurse():\n # Delegate function of `run()`. See [run()] for details.\n #\n # This is sometimes called on its own to recurse down a certain path which\n # will otherwise be skipped.\n ###\n\n recurse: (root) ->\n self = this\n @depth = 0\n\n runner = (direction, node, parent) =>\n @node = node\n @depth += if direction is 'Enter' then +1 else -1\n fnName = if direction is 'Enter' \\\n then \"#{node.type}\" else \"#{node.type}Exit\"\n\n @[\"onBefore#{direction}\"]?(node)\n result = @[fnName]?(node, parent)\n @[\"on#{direction}\"]?(node)\n result\n\n @estraverse().replace root,\n enter: (node, parent) ->\n self.controller = this\n runner(\"Enter\", node, parent)\n leave: (node, parent) ->\n runner(\"Exit\", node, parent)\n```", "response": "var TransformerBase;\n\nTransformerBase = class TransformerBase {\n static run(ast, options) {\n return new this(ast, options).run();\n }\n\n constructor(ast1, options1) {\n this.ast = ast1;\n this.options = options1;\n this.scopes = [];\n this.ctx = {\n vars: []\n };\n }\n\n /**\n * run():\n * Runs estraverse on `@ast`, and invokes functions on enter and exit\n * depending on the node type. This is also in change of changing `@depth`,\n * `@node`, `@controller` (etc) every step of the way.\n *\n * Transformer.run(ast)\n * # roughly equivalent to: new Transformer(ast).run()\n */\n run() {\n return this.recurse(this.ast);\n }\n\n /**\n * recurse():\n * Delegate function of `run()`. See [run()] for details.\n *\n * This is sometimes called on its own to recurse down a certain path which\n * will otherwise be skipped.\n */\n recurse(root) {\n var runner, self;\n self = this;\n this.depth = 0;\n runner = (direction, node, parent) => {\n var fnName, name, name1, result;\n this.node = node;\n this.depth += direction === 'Enter' ? +1 : -1;\n fnName = direction === 'Enter' ? `${node.type}` : `${node.type}Exit`;\n if (typeof this[name = `onBefore${direction}`] === \"function\") {\n this[name](node);\n }\n result = typeof this[fnName] === \"function\" ? this[fnName](node, parent) : void 0;\n if (typeof this[name1 = `on${direction}`] === \"function\") {\n this[name1](node);\n }\n return result;\n };\n return this.estraverse().replace(root, {\n enter: function(node, parent) {\n self.controller = this;\n return runner(\"Enter\", node, parent);\n },\n leave: function(node, parent) {\n return runner(\"Exit\", node, parent);\n }\n });\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 50, "line_end": 99} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar TransformerBase;\n\nTransformerBase = class TransformerBase {\n static run(ast, options) {\n return new this(ast, options).run();\n }\n\n constructor(ast1, options1) {\n this.ast = ast1;\n this.options = options1;\n this.scopes = [];\n this.ctx = {\n vars: []\n };\n }\n\n /**\n * run():\n * Runs estraverse on `@ast`, and invokes functions on enter and exit\n * depending on the node type. This is also in change of changing `@depth`,\n * `@node`, `@controller` (etc) every step of the way.\n *\n * Transformer.run(ast)\n * # roughly equivalent to: new Transformer(ast).run()\n */\n run() {\n return this.recurse(this.ast);\n }\n\n /**\n * recurse():\n * Delegate function of `run()`. See [run()] for details.\n *\n * This is sometimes called on its own to recurse down a certain path which\n * will otherwise be skipped.\n */\n recurse(root) {\n var runner, self;\n self = this;\n this.depth = 0;\n runner = (direction, node, parent) => {\n var fnName, name, name1, result;\n this.node = node;\n this.depth += direction === 'Enter' ? +1 : -1;\n fnName = direction === 'Enter' ? `${node.type}` : `${node.type}Exit`;\n if (typeof this[name = `onBefore${direction}`] === \"function\") {\n this[name](node);\n }\n result = typeof this[fnName] === \"function\" ? this[fnName](node, parent) : void 0;\n if (typeof this[name1 = `on${direction}`] === \"function\") {\n this[name1](node);\n }\n return result;\n };\n return this.estraverse().replace(root, {\n enter: function(node, parent) {\n self.controller = this;\n return runner(\"Enter\", node, parent);\n },\n leave: function(node, parent) {\n return runner(\"Exit\", node, parent);\n }\n });\n }\n\n};\n```", "response": "class TransformerBase\n @run: (ast, options) ->\n new this(ast, options).run()\n\n constructor: (@ast, @options) ->\n @scopes = []\n @ctx = { vars: [] }\n\n ###*\n # run():\n # Runs estraverse on `@ast`, and invokes functions on enter and exit\n # depending on the node type. This is also in change of changing `@depth`,\n # `@node`, `@controller` (etc) every step of the way.\n #\n # Transformer.run(ast)\n # # roughly equivalent to: new Transformer(ast).run()\n ###\n\n run: ->\n @recurse @ast\n\n ###*\n # recurse():\n # Delegate function of `run()`. See [run()] for details.\n #\n # This is sometimes called on its own to recurse down a certain path which\n # will otherwise be skipped.\n ###\n\n recurse: (root) ->\n self = this\n @depth = 0\n\n runner = (direction, node, parent) =>\n @node = node\n @depth += if direction is 'Enter' then +1 else -1\n fnName = if direction is 'Enter' \\\n then \"#{node.type}\" else \"#{node.type}Exit\"\n\n @[\"onBefore#{direction}\"]?(node)\n result = @[fnName]?(node, parent)\n @[\"on#{direction}\"]?(node)\n result\n\n @estraverse().replace root,\n enter: (node, parent) ->\n self.controller = this\n runner(\"Enter\", node, parent)\n leave: (node, parent) ->\n runner(\"Exit\", node, parent)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 50, "line_end": 99} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:1:completion", "type": "completion", "prompt": "class TransformerBase\n @run: (ast, options) ->\n new this(ast, options).run()\n\n constructor: (@ast, @options) ->\n @scopes = []\n @ctx = { vars: [] }\n\n ###*\n # run():\n # Runs estraverse on `@ast`, and invokes functions on enter and exit\n # depending on the node type. This is also in change of changing `@depth`,\n # `@node`, `@controller` (etc) every step of the way.\n #\n # Transformer.run(ast)\n # # roughly equivalent to: new Transformer(ast).run()\n ###\n\n run: ->\n @recurse @ast\n\n ###*\n # recurse():\n # Delegate function of `run()`. See [run()] for details.\n #", "response": "# This is sometimes called on its own to recurse down a certain path which\n # will otherwise be skipped.\n ###\n\n recurse: (root) ->\n self = this\n @depth = 0\n\n runner = (direction, node, parent) =>\n @node = node\n @depth += if direction is 'Enter' then +1 else -1\n fnName = if direction is 'Enter' \\\n then \"#{node.type}\" else \"#{node.type}Exit\"\n\n @[\"onBefore#{direction}\"]?(node)\n result = @[fnName]?(node, parent)\n @[\"on#{direction}\"]?(node)\n result\n\n @estraverse().replace root,\n enter: (node, parent) ->\n self.controller = this\n runner(\"Enter\", node, parent)\n leave: (node, parent) ->\n runner(\"Exit\", node, parent)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 50, "line_end": 99} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "root\n\n ###*\n # skip():\n # Skips a certain node from being parsed.\n #\n # class MyTransform extends TransformerBase\n # Identifier: ->\n # @skip()\n ###\n\n skip: ->\n @controller?.skip()\n\n ###*\n # estraverse():\n # Returns `estraverse`.\n #\n # @estraverse().replace ast, ...\n ###\n\n estraverse: ->\n @_estraverse ?= do ->\n es = require('estraverse')\n es.VisitorKeys.CoffeeEscapedExpression = []\n es.VisitorKeys.CoffeeListExpression = []\n es.VisitorKeys.CoffeePrototypeExpression = []\n es.VisitorKeys.CoffeeLoopStatement = []\n es.VisitorKeys.BlockComment = []\n es.VisitorKeys.LineComment = []\n es\n\n ###*\n # pushStack() : @pushStack(node)\n # Pushes a scope to the scope stack. Every time the scope changes, `@scope`\n # and `@ctx` gets changed.\n ###\n\n pushStack: (node) ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n @scopes.push [ node, @ctx ]\n @ctx = clone(@ctx)\n @scope = node\n @onScopeEnter?(@scope, @ctx, oldScope, oldCtx)\n\n popStack: () ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n [ @scope, @ctx ] = @scopes.pop()\n @onScopeExit?(@scope, @ctx, oldScope, oldCtx)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 100, "line_end": 149} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nroot\n\n ###*\n # skip():\n # Skips a certain node from being parsed.\n #\n # class MyTransform extends TransformerBase\n # Identifier: ->\n # @skip()\n ###\n\n skip: ->\n @controller?.skip()\n\n ###*\n # estraverse():\n # Returns `estraverse`.\n #\n # @estraverse().replace ast, ...\n ###\n\n estraverse: ->\n @_estraverse ?= do ->\n es = require('estraverse')\n es.VisitorKeys.CoffeeEscapedExpression = []\n es.VisitorKeys.CoffeeListExpression = []\n es.VisitorKeys.CoffeePrototypeExpression = []\n es.VisitorKeys.CoffeeLoopStatement = []\n es.VisitorKeys.BlockComment = []\n es.VisitorKeys.LineComment = []\n es\n\n ###*\n # pushStack() : @pushStack(node)\n # Pushes a scope to the scope stack. Every time the scope changes, `@scope`\n # and `@ctx` gets changed.\n ###\n\n pushStack: (node) ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n @scopes.push [ node, @ctx ]\n @ctx = clone(@ctx)\n @scope = node\n @onScopeEnter?(@scope, @ctx, oldScope, oldCtx)\n\n popStack: () ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n [ @scope, @ctx ] = @scopes.pop()\n @onScopeExit?(@scope, @ctx, oldScope, oldCtx)\n```", "response": "root({\n /**\n * skip():\n * Skips a certain node from being parsed.\n *\n * class MyTransform extends TransformerBase\n * Identifier: ->\n * @skip()\n */\n skip: function() {\n var ref;\n return (ref = this.controller) != null ? ref.skip() : void 0;\n },\n /**\n * estraverse():\n * Returns `estraverse`.\n *\n * @estraverse().replace ast, ...\n */\n estraverse: function() {\n return this._estraverse != null ? this._estraverse : this._estraverse = (function() {\n var es;\n es = require('estraverse');\n es.VisitorKeys.CoffeeEscapedExpression = [];\n es.VisitorKeys.CoffeeListExpression = [];\n es.VisitorKeys.CoffeePrototypeExpression = [];\n es.VisitorKeys.CoffeeLoopStatement = [];\n es.VisitorKeys.BlockComment = [];\n es.VisitorKeys.LineComment = [];\n return es;\n })();\n },\n /**\n * pushStack() : @pushStack(node)\n * Pushes a scope to the scope stack. Every time the scope changes, `@scope`\n * and `@ctx` gets changed.\n */\n pushStack: function(node) {\n var oldCtx, oldScope;\n [oldScope, oldCtx] = [this.scope, this.ctx];\n this.scopes.push([node, this.ctx]);\n this.ctx = clone(this.ctx);\n this.scope = node;\n return typeof this.onScopeEnter === \"function\" ? this.onScopeEnter(this.scope, this.ctx, oldScope, oldCtx) : void 0;\n },\n popStack: function() {\n var oldCtx, oldScope;\n [oldScope, oldCtx] = [this.scope, this.ctx];\n [this.scope, this.ctx] = this.scopes.pop();\n return typeof this.onScopeExit === \"function\" ? this.onScopeExit(this.scope, this.ctx, oldScope, oldCtx) : void 0;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 100, "line_end": 149} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nroot({\n /**\n * skip():\n * Skips a certain node from being parsed.\n *\n * class MyTransform extends TransformerBase\n * Identifier: ->\n * @skip()\n */\n skip: function() {\n var ref;\n return (ref = this.controller) != null ? ref.skip() : void 0;\n },\n /**\n * estraverse():\n * Returns `estraverse`.\n *\n * @estraverse().replace ast, ...\n */\n estraverse: function() {\n return this._estraverse != null ? this._estraverse : this._estraverse = (function() {\n var es;\n es = require('estraverse');\n es.VisitorKeys.CoffeeEscapedExpression = [];\n es.VisitorKeys.CoffeeListExpression = [];\n es.VisitorKeys.CoffeePrototypeExpression = [];\n es.VisitorKeys.CoffeeLoopStatement = [];\n es.VisitorKeys.BlockComment = [];\n es.VisitorKeys.LineComment = [];\n return es;\n })();\n },\n /**\n * pushStack() : @pushStack(node)\n * Pushes a scope to the scope stack. Every time the scope changes, `@scope`\n * and `@ctx` gets changed.\n */\n pushStack: function(node) {\n var oldCtx, oldScope;\n [oldScope, oldCtx] = [this.scope, this.ctx];\n this.scopes.push([node, this.ctx]);\n this.ctx = clone(this.ctx);\n this.scope = node;\n return typeof this.onScopeEnter === \"function\" ? this.onScopeEnter(this.scope, this.ctx, oldScope, oldCtx) : void 0;\n },\n popStack: function() {\n var oldCtx, oldScope;\n [oldScope, oldCtx] = [this.scope, this.ctx];\n [this.scope, this.ctx] = this.scopes.pop();\n return typeof this.onScopeExit === \"function\" ? this.onScopeExit(this.scope, this.ctx, oldScope, oldCtx) : void 0;\n }\n});\n```", "response": "root\n\n ###*\n # skip():\n # Skips a certain node from being parsed.\n #\n # class MyTransform extends TransformerBase\n # Identifier: ->\n # @skip()\n ###\n\n skip: ->\n @controller?.skip()\n\n ###*\n # estraverse():\n # Returns `estraverse`.\n #\n # @estraverse().replace ast, ...\n ###\n\n estraverse: ->\n @_estraverse ?= do ->\n es = require('estraverse')\n es.VisitorKeys.CoffeeEscapedExpression = []\n es.VisitorKeys.CoffeeListExpression = []\n es.VisitorKeys.CoffeePrototypeExpression = []\n es.VisitorKeys.CoffeeLoopStatement = []\n es.VisitorKeys.BlockComment = []\n es.VisitorKeys.LineComment = []\n es\n\n ###*\n # pushStack() : @pushStack(node)\n # Pushes a scope to the scope stack. Every time the scope changes, `@scope`\n # and `@ctx` gets changed.\n ###\n\n pushStack: (node) ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n @scopes.push [ node, @ctx ]\n @ctx = clone(@ctx)\n @scope = node\n @onScopeEnter?(@scope, @ctx, oldScope, oldCtx)\n\n popStack: () ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n [ @scope, @ctx ] = @scopes.pop()\n @onScopeExit?(@scope, @ctx, oldScope, oldCtx)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 100, "line_end": 149} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:2:completion", "type": "completion", "prompt": "root\n\n ###*\n # skip():\n # Skips a certain node from being parsed.\n #\n # class MyTransform extends TransformerBase\n # Identifier: ->\n # @skip()\n ###\n\n skip: ->\n @controller?.skip()\n\n ###*\n # estraverse():\n # Returns `estraverse`.\n #\n # @estraverse().replace ast, ...\n ###\n\n estraverse: ->\n @_estraverse ?= do ->\n es = require('estraverse')", "response": "es.VisitorKeys.CoffeeEscapedExpression = []\n es.VisitorKeys.CoffeeListExpression = []\n es.VisitorKeys.CoffeePrototypeExpression = []\n es.VisitorKeys.CoffeeLoopStatement = []\n es.VisitorKeys.BlockComment = []\n es.VisitorKeys.LineComment = []\n es\n\n ###*\n # pushStack() : @pushStack(node)\n # Pushes a scope to the scope stack. Every time the scope changes, `@scope`\n # and `@ctx` gets changed.\n ###\n\n pushStack: (node) ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n @scopes.push [ node, @ctx ]\n @ctx = clone(@ctx)\n @scope = node\n @onScopeEnter?(@scope, @ctx, oldScope, oldCtx)\n\n popStack: () ->\n [ oldScope, oldCtx ] = [ @scope, @ctx ]\n [ @scope, @ctx ] = @scopes.pop()\n @onScopeExit?(@scope, @ctx, oldScope, oldCtx)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 100, "line_end": 149} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###*\n # syntaxError() : @syntaxError(node, message)\n # Throws a syntax error for the given `node` with a given `message`.\n #\n # @syntaxError node, \"Not supported\"\n ###\n\n syntaxError: (node, description) ->\n err = buildError(\n lineNumber: node.loc?.start?.line,\n column: node.loc?.start?.column,\n description: description\n , @options.source, @options.filename)\n throw err\n\n ###*\n # Defaults: these are default handlers that will automatially change `@scope`.\n ###\n\n Program: (node) ->\n @pushStack node\n node\n\n ProgramExit: (node) ->\n @popStack()\n node\n\n FunctionExpression: (node) ->\n @pushStack node.body\n node\n\n FunctionExpressionExit: (node) ->\n @popStack()\n node", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 150, "line_end": 184} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###*\n # syntaxError() : @syntaxError(node, message)\n # Throws a syntax error for the given `node` with a given `message`.\n #\n # @syntaxError node, \"Not supported\"\n ###\n\n syntaxError: (node, description) ->\n err = buildError(\n lineNumber: node.loc?.start?.line,\n column: node.loc?.start?.column,\n description: description\n , @options.source, @options.filename)\n throw err\n\n ###*\n # Defaults: these are default handlers that will automatially change `@scope`.\n ###\n\n Program: (node) ->\n @pushStack node\n node\n\n ProgramExit: (node) ->\n @popStack()\n node\n\n FunctionExpression: (node) ->\n @pushStack node.body\n node\n\n FunctionExpressionExit: (node) ->\n @popStack()\n node\n```", "response": "/**\n * syntaxError() : @syntaxError(node, message)\n * Throws a syntax error for the given `node` with a given `message`.\n *\n * @syntaxError node, \"Not supported\"\n */\n({\n syntaxError: function(node, description) {\n var err, ref, ref1, ref2, ref3;\n err = buildError({\n lineNumber: (ref = node.loc) != null ? (ref1 = ref.start) != null ? ref1.line : void 0 : void 0,\n column: (ref2 = node.loc) != null ? (ref3 = ref2.start) != null ? ref3.column : void 0 : void 0,\n description: description\n }, this.options.source, this.options.filename);\n throw err;\n },\n /**\n * Defaults: these are default handlers that will automatially change `@scope`.\n */\n Program: function(node) {\n this.pushStack(node);\n return node;\n },\n ProgramExit: function(node) {\n this.popStack();\n return node;\n },\n FunctionExpression: function(node) {\n this.pushStack(node.body);\n return node;\n },\n FunctionExpressionExit: function(node) {\n this.popStack();\n return node;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 150, "line_end": 184} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/**\n * syntaxError() : @syntaxError(node, message)\n * Throws a syntax error for the given `node` with a given `message`.\n *\n * @syntaxError node, \"Not supported\"\n */\n({\n syntaxError: function(node, description) {\n var err, ref, ref1, ref2, ref3;\n err = buildError({\n lineNumber: (ref = node.loc) != null ? (ref1 = ref.start) != null ? ref1.line : void 0 : void 0,\n column: (ref2 = node.loc) != null ? (ref3 = ref2.start) != null ? ref3.column : void 0 : void 0,\n description: description\n }, this.options.source, this.options.filename);\n throw err;\n },\n /**\n * Defaults: these are default handlers that will automatially change `@scope`.\n */\n Program: function(node) {\n this.pushStack(node);\n return node;\n },\n ProgramExit: function(node) {\n this.popStack();\n return node;\n },\n FunctionExpression: function(node) {\n this.pushStack(node.body);\n return node;\n },\n FunctionExpressionExit: function(node) {\n this.popStack();\n return node;\n }\n});\n```", "response": "###*\n # syntaxError() : @syntaxError(node, message)\n # Throws a syntax error for the given `node` with a given `message`.\n #\n # @syntaxError node, \"Not supported\"\n ###\n\n syntaxError: (node, description) ->\n err = buildError(\n lineNumber: node.loc?.start?.line,\n column: node.loc?.start?.column,\n description: description\n , @options.source, @options.filename)\n throw err\n\n ###*\n # Defaults: these are default handlers that will automatially change `@scope`.\n ###\n\n Program: (node) ->\n @pushStack node\n node\n\n ProgramExit: (node) ->\n @popStack()\n node\n\n FunctionExpression: (node) ->\n @pushStack node.body\n node\n\n FunctionExpressionExit: (node) ->\n @popStack()\n node", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 150, "line_end": 184} +{"id": "js2coffee/js2coffee:lib/transformer_base.coffee:3:completion", "type": "completion", "prompt": "###*\n # syntaxError() : @syntaxError(node, message)\n # Throws a syntax error for the given `node` with a given `message`.\n #\n # @syntaxError node, \"Not supported\"\n ###\n\n syntaxError: (node, description) ->\n err = buildError(\n lineNumber: node.loc?.start?.line,\n column: node.loc?.start?.column,\n description: description\n , @options.source, @options.filename)\n throw err\n\n ###*\n # Defaults: these are default handlers that will automatially change `@scope`.", "response": "###\n\n Program: (node) ->\n @pushStack node\n node\n\n ProgramExit: (node) ->\n @popStack()\n node\n\n FunctionExpression: (node) ->\n @pushStack node.body\n node\n\n FunctionExpressionExit: (node) ->\n @popStack()\n node", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transformer_base.coffee", "license": "MIT", "commit": "78542bce2183cf83ba93c30265ea4543c17ccad4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/78542bce2183cf83ba93c30265ea4543c17ccad4/lib/transformer_base.coffee", "line_start": 150, "line_end": 184} +{"id": "jianliaoim/talk-os:talk-web/client/module/message-rich-image.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'message-rich-image'\n\n mixins: [ PureRenderMixin ]\n\n propTypes:\n # attachment = {\n # data:\n # thumbnailUrl: string\n # imageHeight: number\n # imageWidth: number\n # isUploading: boolean\n # progress: boolean\n # }\n attachment: T.instanceOf(Immutable.Map).isRequired\n widthBoundary: T.number\n heightBoundary: T.number\n onClick: T.func\n onLoaded: T.func\n\n getDefaultProps: ->\n widthBoundary: 360\n heightBoundary: 360\n\n onClick: ->\n @props.onClick?()\n\n onLoaded: ->\n @props.onLoaded?()\n\n renderPreview: ->\n thumbnailUrl = @props.attachment.getIn ['data', 'thumbnailUrl']\n imageHeight = @props.attachment.getIn ['data', 'imageHeight']\n imageWidth = @props.attachment.getIn ['data', 'imageWidth']\n\n insideX = imageWidth <= @props.widthBoundary\n insideY = imageHeight <= @props.heightBoundary\n\n if insideX and insideY\n previewWidth = imageWidth\n previewHeight = imageHeight\n else\n boundaryRatio = @props.widthBoundary / @props.heightBoundary\n realRatio = imageWidth / imageHeight\n\n if boundaryRatio > realRatio # boundary is wider, use height as base\n previewHeight = @props.heightBoundary\n previewWidth = Math.round(@props.heightBoundary / imageHeight * imageWidth)\n else\n previewWidth = @props.widthBoundary", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/module/message-rich-image.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/message-rich-image.coffee", "line_start": 11, "line_end": 60} +{"id": "jianliaoim/talk-os:talk-web/client/module/message-rich-image.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'message-rich-image'\n\n mixins: [ PureRenderMixin ]\n\n propTypes:\n # attachment = {\n # data:\n # thumbnailUrl: string\n # imageHeight: number\n # imageWidth: number\n # isUploading: boolean\n # progress: boolean\n # }\n attachment: T.instanceOf(Immutable.Map).isRequired\n widthBoundary: T.number\n heightBoundary: T.number\n onClick: T.func\n onLoaded: T.func\n\n getDefaultProps: ->\n widthBoundary: 360\n heightBoundary: 360\n\n onClick: ->\n @props.onClick?()\n\n onLoaded: ->\n @props.onLoaded?()\n\n renderPreview: ->\n thumbnailUrl = @props.attachment.getIn ['data', 'thumbnailUrl']\n imageHeight = @props.attachment.getIn ['data', 'imageHeight']\n imageWidth = @props.attachment.getIn ['data', 'imageWidth']\n\n insideX = imageWidth <= @props.widthBoundary\n insideY = imageHeight <= @props.heightBoundary\n\n if insideX and insideY\n previewWidth = imageWidth\n previewHeight = imageHeight\n else\n boundaryRatio = @props.widthBoundary / @props.heightBoundary\n realRatio = imageWidth / imageHeight\n\n if boundaryRatio > realRatio # boundary is wider, use height as base\n previewHeight = @props.heightBoundary\n previewWidth = Math.round(@props.heightBoundary / imageHeight * imageWidth)\n else\n previewWidth = @props.widthBoundary\n```", "response": "module.exports = React.createClass({\n displayName: 'message-rich-image',\n mixins: [PureRenderMixin],\n propTypes: {\n // attachment = {\n // data:\n // thumbnailUrl: string\n // imageHeight: number\n // imageWidth: number\n // isUploading: boolean\n // progress: boolean\n // }\n attachment: T.instanceOf(Immutable.Map).isRequired,\n widthBoundary: T.number,\n heightBoundary: T.number,\n onClick: T.func,\n onLoaded: T.func\n },\n getDefaultProps: function() {\n return {\n widthBoundary: 360,\n heightBoundary: 360\n };\n },\n onClick: function() {\n var base;\n return typeof (base = this.props).onClick === \"function\" ? base.onClick() : void 0;\n },\n onLoaded: function() {\n var base;\n return typeof (base = this.props).onLoaded === \"function\" ? base.onLoaded() : void 0;\n },\n renderPreview: function() {\n var boundaryRatio, imageHeight, imageWidth, insideX, insideY, previewHeight, previewWidth, realRatio, thumbnailUrl;\n thumbnailUrl = this.props.attachment.getIn(['data', 'thumbnailUrl']);\n imageHeight = this.props.attachment.getIn(['data', 'imageHeight']);\n imageWidth = this.props.attachment.getIn(['data', 'imageWidth']);\n insideX = imageWidth <= this.props.widthBoundary;\n insideY = imageHeight <= this.props.heightBoundary;\n if (insideX && insideY) {\n previewWidth = imageWidth;\n return previewHeight = imageHeight;\n } else {\n boundaryRatio = this.props.widthBoundary / this.props.heightBoundary;\n realRatio = imageWidth / imageHeight;\n if (boundaryRatio > realRatio) { // boundary is wider, use height as base\n previewHeight = this.props.heightBoundary;\n return previewWidth = Math.round(this.props.heightBoundary / imageHeight * imageWidth);\n } else {\n return previewWidth = this.props.widthBoundary;\n }\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/module/message-rich-image.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/message-rich-image.coffee", "line_start": 11, "line_end": 60} +{"id": "jianliaoim/talk-os:talk-web/client/module/message-rich-image.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'message-rich-image',\n mixins: [PureRenderMixin],\n propTypes: {\n // attachment = {\n // data:\n // thumbnailUrl: string\n // imageHeight: number\n // imageWidth: number\n // isUploading: boolean\n // progress: boolean\n // }\n attachment: T.instanceOf(Immutable.Map).isRequired,\n widthBoundary: T.number,\n heightBoundary: T.number,\n onClick: T.func,\n onLoaded: T.func\n },\n getDefaultProps: function() {\n return {\n widthBoundary: 360,\n heightBoundary: 360\n };\n },\n onClick: function() {\n var base;\n return typeof (base = this.props).onClick === \"function\" ? base.onClick() : void 0;\n },\n onLoaded: function() {\n var base;\n return typeof (base = this.props).onLoaded === \"function\" ? base.onLoaded() : void 0;\n },\n renderPreview: function() {\n var boundaryRatio, imageHeight, imageWidth, insideX, insideY, previewHeight, previewWidth, realRatio, thumbnailUrl;\n thumbnailUrl = this.props.attachment.getIn(['data', 'thumbnailUrl']);\n imageHeight = this.props.attachment.getIn(['data', 'imageHeight']);\n imageWidth = this.props.attachment.getIn(['data', 'imageWidth']);\n insideX = imageWidth <= this.props.widthBoundary;\n insideY = imageHeight <= this.props.heightBoundary;\n if (insideX && insideY) {\n previewWidth = imageWidth;\n return previewHeight = imageHeight;\n } else {\n boundaryRatio = this.props.widthBoundary / this.props.heightBoundary;\n realRatio = imageWidth / imageHeight;\n if (boundaryRatio > realRatio) { // boundary is wider, use height as base\n previewHeight = this.props.heightBoundary;\n return previewWidth = Math.round(this.props.heightBoundary / imageHeight * imageWidth);\n } else {\n return previewWidth = this.props.widthBoundary;\n }\n }\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'message-rich-image'\n\n mixins: [ PureRenderMixin ]\n\n propTypes:\n # attachment = {\n # data:\n # thumbnailUrl: string\n # imageHeight: number\n # imageWidth: number\n # isUploading: boolean\n # progress: boolean\n # }\n attachment: T.instanceOf(Immutable.Map).isRequired\n widthBoundary: T.number\n heightBoundary: T.number\n onClick: T.func\n onLoaded: T.func\n\n getDefaultProps: ->\n widthBoundary: 360\n heightBoundary: 360\n\n onClick: ->\n @props.onClick?()\n\n onLoaded: ->\n @props.onLoaded?()\n\n renderPreview: ->\n thumbnailUrl = @props.attachment.getIn ['data', 'thumbnailUrl']\n imageHeight = @props.attachment.getIn ['data', 'imageHeight']\n imageWidth = @props.attachment.getIn ['data', 'imageWidth']\n\n insideX = imageWidth <= @props.widthBoundary\n insideY = imageHeight <= @props.heightBoundary\n\n if insideX and insideY\n previewWidth = imageWidth\n previewHeight = imageHeight\n else\n boundaryRatio = @props.widthBoundary / @props.heightBoundary\n realRatio = imageWidth / imageHeight\n\n if boundaryRatio > realRatio # boundary is wider, use height as base\n previewHeight = @props.heightBoundary\n previewWidth = Math.round(@props.heightBoundary / imageHeight * imageWidth)\n else\n previewWidth = @props.widthBoundary", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/module/message-rich-image.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/message-rich-image.coffee", "line_start": 11, "line_end": 60} +{"id": "jianliaoim/talk-os:talk-web/client/module/message-rich-image.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'message-rich-image'\n\n mixins: [ PureRenderMixin ]\n\n propTypes:\n # attachment = {\n # data:\n # thumbnailUrl: string\n # imageHeight: number\n # imageWidth: number\n # isUploading: boolean\n # progress: boolean\n # }\n attachment: T.instanceOf(Immutable.Map).isRequired\n widthBoundary: T.number\n heightBoundary: T.number\n onClick: T.func\n onLoaded: T.func\n\n getDefaultProps: ->\n widthBoundary: 360\n heightBoundary: 360\n\n onClick: ->", "response": "@props.onClick?()\n\n onLoaded: ->\n @props.onLoaded?()\n\n renderPreview: ->\n thumbnailUrl = @props.attachment.getIn ['data', 'thumbnailUrl']\n imageHeight = @props.attachment.getIn ['data', 'imageHeight']\n imageWidth = @props.attachment.getIn ['data', 'imageWidth']\n\n insideX = imageWidth <= @props.widthBoundary\n insideY = imageHeight <= @props.heightBoundary\n\n if insideX and insideY\n previewWidth = imageWidth\n previewHeight = imageHeight\n else\n boundaryRatio = @props.widthBoundary / @props.heightBoundary\n realRatio = imageWidth / imageHeight\n\n if boundaryRatio > realRatio # boundary is wider, use height as base\n previewHeight = @props.heightBoundary\n previewWidth = Math.round(@props.heightBoundary / imageHeight * imageWidth)\n else\n previewWidth = @props.widthBoundary", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/module/message-rich-image.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/message-rich-image.coffee", "line_start": 11, "line_end": 60} +{"id": "jianliaoim/talk-os:talk-web/client/module/message-rich-image.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "previewHeight = Math.round(@props.widthBoundary / imageWidth * imageHeight)\n\n src = # don't parse preview image if thumbnailUrl is a data uri generated from canvas.todataurl\n if thumbnailUrl.substring(0, 4) is 'data'\n thumbnailUrl\n else\n thumbnailUrl\n .replace(/(\\/h\\/\\d+)/g, \"/h/#{previewHeight}\")\n .replace(/(\\/w\\/\\d+)/g, \"/w/#{previewWidth}\")\n\n style =\n height: previewHeight\n maxWidth: previewWidth\n\n image = LightImage\n src: src\n onClick: @onClick\n onLoaded: @onLoaded\n width: previewWidth\n height: previewHeight\n\n div className: 'preview', style: style,\n image\n\n render: ->\n div className: 'attachment-image',\n @renderPreview()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/module/message-rich-image.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/message-rich-image.coffee", "line_start": 61, "line_end": 87} +{"id": "jianliaoim/talk-os:talk-web/client/module/message-rich-image.coffee:2:completion", "type": "completion", "prompt": "previewHeight = Math.round(@props.widthBoundary / imageWidth * imageHeight)\n\n src = # don't parse preview image if thumbnailUrl is a data uri generated from canvas.todataurl\n if thumbnailUrl.substring(0, 4) is 'data'\n thumbnailUrl\n else\n thumbnailUrl\n .replace(/(\\/h\\/\\d+)/g, \"/h/#{previewHeight}\")\n .replace(/(\\/w\\/\\d+)/g, \"/w/#{previewWidth}\")\n\n style =\n height: previewHeight\n maxWidth: previewWidth", "response": "image = LightImage\n src: src\n onClick: @onClick\n onLoaded: @onLoaded\n width: previewWidth\n height: previewHeight\n\n div className: 'preview', style: style,\n image\n\n render: ->\n div className: 'attachment-image',\n @renderPreview()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/module/message-rich-image.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/message-rich-image.coffee", "line_start": 61, "line_end": 87} +{"id": "elving/swag:test/html_test.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "require 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\nSwag.registerHelpers Handlebars\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '\n\ndescribe 'ol', ->\n describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/test/html_test.coffee", "line_start": 1, "line_end": 36} +{"id": "elving/swag:test/html_test.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrequire 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\nSwag.registerHelpers Handlebars\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '\n\ndescribe 'ol', ->\n describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '\n```", "response": "var Handlebars, Swag;\n\nrequire('should');\n\nHandlebars = require('handlebars');\n\nSwag = require('../lib/swag');\n\nSwag.registerHelpers(Handlebars);\n\ndescribe('ul', function() {\n return describe('{{#ul list class=\"list\"}} \\n {{this}} \\n {{/ul}}', function() {\n return it('should create an unordered list.', function() {\n var context, source, template;\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}';\n template = Handlebars.compile(source);\n context = {\n list: ['one']\n };\n return template(context).should.equal('
                • one
                ');\n });\n });\n});\n\ndescribe('ol', function() {\n return describe('{{#ol list class=\"list\"}} \\n {{this}} \\n {{/ol}}', function() {\n return it('should create an ordered list.', function() {\n var context, source, template;\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}';\n template = Handlebars.compile(source);\n context = {\n list: ['boom']\n };\n return template(context).should.equal('
                1. boom
                ');\n });\n });\n});\n\ndescribe('br', function() {\n return describe('{{br 4}}', function() {\n return it('should return
                tags based on a count.', function() {\n var source, template;\n source = '{{br 4}}';\n template = Handlebars.compile(source);\n return template(context).should.equal('



                ');\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/test/html_test.coffee", "line_start": 1, "line_end": 36} +{"id": "elving/swag:test/html_test.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Handlebars, Swag;\n\nrequire('should');\n\nHandlebars = require('handlebars');\n\nSwag = require('../lib/swag');\n\nSwag.registerHelpers(Handlebars);\n\ndescribe('ul', function() {\n return describe('{{#ul list class=\"list\"}} \\n {{this}} \\n {{/ul}}', function() {\n return it('should create an unordered list.', function() {\n var context, source, template;\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}';\n template = Handlebars.compile(source);\n context = {\n list: ['one']\n };\n return template(context).should.equal('
                • one
                ');\n });\n });\n});\n\ndescribe('ol', function() {\n return describe('{{#ol list class=\"list\"}} \\n {{this}} \\n {{/ol}}', function() {\n return it('should create an ordered list.', function() {\n var context, source, template;\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}';\n template = Handlebars.compile(source);\n context = {\n list: ['boom']\n };\n return template(context).should.equal('
                1. boom
                ');\n });\n });\n});\n\ndescribe('br', function() {\n return describe('{{br 4}}', function() {\n return it('should return
                tags based on a count.', function() {\n var source, template;\n source = '{{br 4}}';\n template = Handlebars.compile(source);\n return template(context).should.equal('



                ');\n });\n });\n});\n```", "response": "require 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\nSwag.registerHelpers Handlebars\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '\n\ndescribe 'ol', ->\n describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/test/html_test.coffee", "line_start": 1, "line_end": 36} +{"id": "elving/swag:test/html_test.coffee:1:completion", "type": "completion", "prompt": "require 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\nSwag.registerHelpers Handlebars\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '", "response": "describe 'ol', ->\n describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/test/html_test.coffee", "line_start": 1, "line_end": 36} +{"id": "elving/swag:test/html_test.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "require 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '\n\ndescribe 'ol', ->\n describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "5e45f8e30f1605c8b521997024c9a49806571fc8", "stars": 675, "source_url": "https://github.com/elving/swag/blob/5e45f8e30f1605c8b521997024c9a49806571fc8/test/html_test.coffee", "line_start": 1, "line_end": 34} +{"id": "elving/swag:test/html_test.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrequire 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '\n\ndescribe 'ol', ->\n describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '\n```", "response": "var Handlebars, Swag;\n\nrequire('should');\n\nHandlebars = require('handlebars');\n\nSwag = require('../lib/swag');\n\ndescribe('ul', function() {\n return describe('{{#ul list class=\"list\"}} \\n {{this}} \\n {{/ul}}', function() {\n return it('should create an unordered list.', function() {\n var context, source, template;\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}';\n template = Handlebars.compile(source);\n context = {\n list: ['one']\n };\n return template(context).should.equal('
                • one
                ');\n });\n });\n});\n\ndescribe('ol', function() {\n return describe('{{#ol list class=\"list\"}} \\n {{this}} \\n {{/ol}}', function() {\n return it('should create an ordered list.', function() {\n var context, source, template;\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}';\n template = Handlebars.compile(source);\n context = {\n list: ['boom']\n };\n return template(context).should.equal('
                1. boom
                ');\n });\n });\n});\n\ndescribe('br', function() {\n return describe('{{br 4}}', function() {\n return it('should return
                tags based on a count.', function() {\n var source, template;\n source = '{{br 4}}';\n template = Handlebars.compile(source);\n return template(context).should.equal('



                ');\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "5e45f8e30f1605c8b521997024c9a49806571fc8", "stars": 675, "source_url": "https://github.com/elving/swag/blob/5e45f8e30f1605c8b521997024c9a49806571fc8/test/html_test.coffee", "line_start": 1, "line_end": 34} +{"id": "elving/swag:test/html_test.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Handlebars, Swag;\n\nrequire('should');\n\nHandlebars = require('handlebars');\n\nSwag = require('../lib/swag');\n\ndescribe('ul', function() {\n return describe('{{#ul list class=\"list\"}} \\n {{this}} \\n {{/ul}}', function() {\n return it('should create an unordered list.', function() {\n var context, source, template;\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}';\n template = Handlebars.compile(source);\n context = {\n list: ['one']\n };\n return template(context).should.equal('
                • one
                ');\n });\n });\n});\n\ndescribe('ol', function() {\n return describe('{{#ol list class=\"list\"}} \\n {{this}} \\n {{/ol}}', function() {\n return it('should create an ordered list.', function() {\n var context, source, template;\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}';\n template = Handlebars.compile(source);\n context = {\n list: ['boom']\n };\n return template(context).should.equal('
                1. boom
                ');\n });\n });\n});\n\ndescribe('br', function() {\n return describe('{{br 4}}', function() {\n return it('should return
                tags based on a count.', function() {\n var source, template;\n source = '{{br 4}}';\n template = Handlebars.compile(source);\n return template(context).should.equal('



                ');\n });\n });\n});\n```", "response": "require 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '\n\ndescribe 'ol', ->\n describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "5e45f8e30f1605c8b521997024c9a49806571fc8", "stars": 675, "source_url": "https://github.com/elving/swag/blob/5e45f8e30f1605c8b521997024c9a49806571fc8/test/html_test.coffee", "line_start": 1, "line_end": 34} +{"id": "elving/swag:test/html_test.coffee:1:completion", "type": "completion", "prompt": "require 'should'\n\nHandlebars = require 'handlebars'\nSwag = require '../lib/swag'\n\ndescribe 'ul', ->\n describe '{{#ul list class=\"list\"}} \\n\n {{this}} \\n\n {{/ul}}', ->\n it 'should create an unordered list.', ->\n source = '{{#ul list class=\"list\"}}{{this}}{{/ul}}'\n template = Handlebars.compile(source)\n context = list: ['one']\n\n template(context).should.equal '
                • one
                '\n\ndescribe 'ol', ->", "response": "describe '{{#ol list class=\"list\"}} \\n\n {{this}} \\n\n {{/ol}}', ->\n it 'should create an ordered list.', ->\n source = '{{#ol list class=\"list\"}}{{this}}{{/ol}}'\n template = Handlebars.compile(source)\n context = list: ['boom']\n\n template(context).should.equal '
                1. boom
                '\n\ndescribe 'br', ->\n describe '{{br 4}}', ->\n it 'should return
                tags based on a count.', ->\n source = '{{br 4}}'\n template = Handlebars.compile(source)\n\n template(context).should.equal '



                '", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "test/html_test.coffee", "license": "MIT", "commit": "5e45f8e30f1605c8b521997024c9a49806571fc8", "stars": 675, "source_url": "https://github.com/elving/swag/blob/5e45f8e30f1605c8b521997024c9a49806571fc8/test/html_test.coffee", "line_start": 1, "line_end": 34} +{"id": "jianliaoim/talk-os:talk-web/client/app/channel-info.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'channel-info'\n mixins: [ mixinChannelInfo ]\n\n propTypes:\n _teamId: T.string.isRequired\n _channelType: T.string.isRequired\n channel: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n showMemberCard: false\n showStoryViewer: false\n\n componentDidMount: ->\n @_headerEl = @refs.header\n\n getBaseArea: ->\n @_headerEl?.getBoundingClientRect() or {}\n\n positionAlgorithm: (area) ->\n top: area.top + 56\n left: area.left\n\n togglePopover: ->\n @setState showMemberCard: not @state.showMemberCard\n\n onTitleClick: (event) ->\n if @props._channelType is 'chat'\n event.stopPropagation()\n @togglePopover()\n\n onStoryViewerClose: ->\n @setState showStoryViewer: false\n\n onPreviewClick: ->\n @setState showStoryViewer: true\n\n onOpenLink: (event) ->\n event.preventDefault()\n\n href = @props.channel.getIn [ 'data', 'url' ]\n window.open urlParse href, true\n\n renderPreview: ->\n return noscript() unless @props._channelType is 'story'\n return noscript() unless detect.isImageWithPreview(@props.channel.get('data'))\n\n url = constraint.thumbnail @props.channel.getIn([ 'data', 'thumbnailUrl' ]), 40, 56\n\n span", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/channel-info.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-info.coffee", "line_start": 21, "line_end": 70} +{"id": "jianliaoim/talk-os:talk-web/client/app/channel-info.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'channel-info'\n mixins: [ mixinChannelInfo ]\n\n propTypes:\n _teamId: T.string.isRequired\n _channelType: T.string.isRequired\n channel: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n showMemberCard: false\n showStoryViewer: false\n\n componentDidMount: ->\n @_headerEl = @refs.header\n\n getBaseArea: ->\n @_headerEl?.getBoundingClientRect() or {}\n\n positionAlgorithm: (area) ->\n top: area.top + 56\n left: area.left\n\n togglePopover: ->\n @setState showMemberCard: not @state.showMemberCard\n\n onTitleClick: (event) ->\n if @props._channelType is 'chat'\n event.stopPropagation()\n @togglePopover()\n\n onStoryViewerClose: ->\n @setState showStoryViewer: false\n\n onPreviewClick: ->\n @setState showStoryViewer: true\n\n onOpenLink: (event) ->\n event.preventDefault()\n\n href = @props.channel.getIn [ 'data', 'url' ]\n window.open urlParse href, true\n\n renderPreview: ->\n return noscript() unless @props._channelType is 'story'\n return noscript() unless detect.isImageWithPreview(@props.channel.get('data'))\n\n url = constraint.thumbnail @props.channel.getIn([ 'data', 'thumbnailUrl' ]), 40, 56\n\n span\n```", "response": "module.exports = React.createClass({\n displayName: 'channel-info',\n mixins: [mixinChannelInfo],\n propTypes: {\n _teamId: T.string.isRequired,\n _channelType: T.string.isRequired,\n channel: T.instanceOf(Immutable.Map).isRequired\n },\n getInitialState: function() {\n return {\n showMemberCard: false,\n showStoryViewer: false\n };\n },\n componentDidMount: function() {\n return this._headerEl = this.refs.header;\n },\n getBaseArea: function() {\n var ref;\n return ((ref = this._headerEl) != null ? ref.getBoundingClientRect() : void 0) || {};\n },\n positionAlgorithm: function(area) {\n return {\n top: area.top + 56,\n left: area.left\n };\n },\n togglePopover: function() {\n return this.setState({\n showMemberCard: !this.state.showMemberCard\n });\n },\n onTitleClick: function(event) {\n if (this.props._channelType === 'chat') {\n event.stopPropagation();\n return this.togglePopover();\n }\n },\n onStoryViewerClose: function() {\n return this.setState({\n showStoryViewer: false\n });\n },\n onPreviewClick: function() {\n return this.setState({\n showStoryViewer: true\n });\n },\n onOpenLink: function(event) {\n var href;\n event.preventDefault();\n href = this.props.channel.getIn(['data', 'url']);\n return window.open(urlParse(href, true));\n },\n renderPreview: function() {\n var url;\n if (this.props._channelType !== 'story') {\n return noscript();\n }\n if (!detect.isImageWithPreview(this.props.channel.get('data'))) {\n return noscript();\n }\n url = constraint.thumbnail(this.props.channel.getIn(['data', 'thumbnailUrl']), 40, 56);\n return span;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/channel-info.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-info.coffee", "line_start": 21, "line_end": 70} +{"id": "jianliaoim/talk-os:talk-web/client/app/channel-info.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'channel-info',\n mixins: [mixinChannelInfo],\n propTypes: {\n _teamId: T.string.isRequired,\n _channelType: T.string.isRequired,\n channel: T.instanceOf(Immutable.Map).isRequired\n },\n getInitialState: function() {\n return {\n showMemberCard: false,\n showStoryViewer: false\n };\n },\n componentDidMount: function() {\n return this._headerEl = this.refs.header;\n },\n getBaseArea: function() {\n var ref;\n return ((ref = this._headerEl) != null ? ref.getBoundingClientRect() : void 0) || {};\n },\n positionAlgorithm: function(area) {\n return {\n top: area.top + 56,\n left: area.left\n };\n },\n togglePopover: function() {\n return this.setState({\n showMemberCard: !this.state.showMemberCard\n });\n },\n onTitleClick: function(event) {\n if (this.props._channelType === 'chat') {\n event.stopPropagation();\n return this.togglePopover();\n }\n },\n onStoryViewerClose: function() {\n return this.setState({\n showStoryViewer: false\n });\n },\n onPreviewClick: function() {\n return this.setState({\n showStoryViewer: true\n });\n },\n onOpenLink: function(event) {\n var href;\n event.preventDefault();\n href = this.props.channel.getIn(['data', 'url']);\n return window.open(urlParse(href, true));\n },\n renderPreview: function() {\n var url;\n if (this.props._channelType !== 'story') {\n return noscript();\n }\n if (!detect.isImageWithPreview(this.props.channel.get('data'))) {\n return noscript();\n }\n url = constraint.thumbnail(this.props.channel.getIn(['data', 'thumbnailUrl']), 40, 56);\n return span;\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'channel-info'\n mixins: [ mixinChannelInfo ]\n\n propTypes:\n _teamId: T.string.isRequired\n _channelType: T.string.isRequired\n channel: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n showMemberCard: false\n showStoryViewer: false\n\n componentDidMount: ->\n @_headerEl = @refs.header\n\n getBaseArea: ->\n @_headerEl?.getBoundingClientRect() or {}\n\n positionAlgorithm: (area) ->\n top: area.top + 56\n left: area.left\n\n togglePopover: ->\n @setState showMemberCard: not @state.showMemberCard\n\n onTitleClick: (event) ->\n if @props._channelType is 'chat'\n event.stopPropagation()\n @togglePopover()\n\n onStoryViewerClose: ->\n @setState showStoryViewer: false\n\n onPreviewClick: ->\n @setState showStoryViewer: true\n\n onOpenLink: (event) ->\n event.preventDefault()\n\n href = @props.channel.getIn [ 'data', 'url' ]\n window.open urlParse href, true\n\n renderPreview: ->\n return noscript() unless @props._channelType is 'story'\n return noscript() unless detect.isImageWithPreview(@props.channel.get('data'))\n\n url = constraint.thumbnail @props.channel.getIn([ 'data', 'thumbnailUrl' ]), 40, 56\n\n span", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/channel-info.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-info.coffee", "line_start": 21, "line_end": 70} +{"id": "jianliaoim/talk-os:talk-web/client/app/channel-info.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'channel-info'\n mixins: [ mixinChannelInfo ]\n\n propTypes:\n _teamId: T.string.isRequired\n _channelType: T.string.isRequired\n channel: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n showMemberCard: false\n showStoryViewer: false\n\n componentDidMount: ->\n @_headerEl = @refs.header\n\n getBaseArea: ->\n @_headerEl?.getBoundingClientRect() or {}\n\n positionAlgorithm: (area) ->\n top: area.top + 56\n left: area.left\n\n togglePopover: ->\n @setState showMemberCard: not @state.showMemberCard", "response": "onTitleClick: (event) ->\n if @props._channelType is 'chat'\n event.stopPropagation()\n @togglePopover()\n\n onStoryViewerClose: ->\n @setState showStoryViewer: false\n\n onPreviewClick: ->\n @setState showStoryViewer: true\n\n onOpenLink: (event) ->\n event.preventDefault()\n\n href = @props.channel.getIn [ 'data', 'url' ]\n window.open urlParse href, true\n\n renderPreview: ->\n return noscript() unless @props._channelType is 'story'\n return noscript() unless detect.isImageWithPreview(@props.channel.get('data'))\n\n url = constraint.thumbnail @props.channel.getIn([ 'data', 'thumbnailUrl' ]), 40, 56\n\n span", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/channel-info.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-info.coffee", "line_start": 21, "line_end": 70} +{"id": "jianliaoim/talk-os:talk-web/client/app/channel-info.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "className: 'preview flex-static'\n style: backgroundImage: \"url(#{ url })\"\n onClick: @onPreviewClick\n\n renderTitle: ->\n cxSpan = cx 'title', 'text-overflow', 'flex-static', 'is-clickable': @props._channelType is 'chat'\n span className: cxSpan, onClick: @onTitleClick, @extractTitle()\n\n renderArchivedInfo: ->\n return null if not @props.channel.get('isArchived')\n cxSpan = cx 'archived', 'flex-static', 'muted'\n span className: cxSpan, \"(#{lang.getText('archived-topic')})\"\n\n renderUrl: ->\n return noscript() if @props.channel.get('category') isnt 'link'\n a className: 'url text-overflow', onClick: @onOpenLink, @props.channel.getIn [ 'data', 'url' ]\n\n renderMemberCard: ->\n LightPopover\n baseArea: if @state.showMemberCard then @getBaseArea() else {}\n onPopoverClose: @togglePopover\n positionAlgorithm: @positionAlgorithm\n showClose: false\n show: @state.showMemberCard\n name: 'member-card'\n MemberCard\n _teamId: @props._teamId\n member: @props.channel\n showEntrance: false\n\n renderStoryViewer: ->\n LightModal\n name: 'story-viewer'\n show: @state.showStoryViewer\n onCloseClick: @onStoryViewerClose\n StoryViewer\n story: @props.channel\n onClose: @onStoryViewerClose\n\n render: ->\n div className: 'channel-info flex-horiz flex-vcenter', ref: 'header',\n @renderPreview()\n @renderTitle()\n @renderArchivedInfo()\n @renderUrl()\n @renderMemberCard()\n @renderStoryViewer()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/channel-info.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-info.coffee", "line_start": 71, "line_end": 117} +{"id": "jianliaoim/talk-os:talk-web/client/app/channel-info.coffee:2:completion", "type": "completion", "prompt": "className: 'preview flex-static'\n style: backgroundImage: \"url(#{ url })\"\n onClick: @onPreviewClick\n\n renderTitle: ->\n cxSpan = cx 'title', 'text-overflow', 'flex-static', 'is-clickable': @props._channelType is 'chat'\n span className: cxSpan, onClick: @onTitleClick, @extractTitle()\n\n renderArchivedInfo: ->\n return null if not @props.channel.get('isArchived')\n cxSpan = cx 'archived', 'flex-static', 'muted'\n span className: cxSpan, \"(#{lang.getText('archived-topic')})\"\n\n renderUrl: ->\n return noscript() if @props.channel.get('category') isnt 'link'\n a className: 'url text-overflow', onClick: @onOpenLink, @props.channel.getIn [ 'data', 'url' ]\n\n renderMemberCard: ->\n LightPopover\n baseArea: if @state.showMemberCard then @getBaseArea() else {}\n onPopoverClose: @togglePopover\n positionAlgorithm: @positionAlgorithm\n showClose: false", "response": "show: @state.showMemberCard\n name: 'member-card'\n MemberCard\n _teamId: @props._teamId\n member: @props.channel\n showEntrance: false\n\n renderStoryViewer: ->\n LightModal\n name: 'story-viewer'\n show: @state.showStoryViewer\n onCloseClick: @onStoryViewerClose\n StoryViewer\n story: @props.channel\n onClose: @onStoryViewerClose\n\n render: ->\n div className: 'channel-info flex-horiz flex-vcenter', ref: 'header',\n @renderPreview()\n @renderTitle()\n @renderArchivedInfo()\n @renderUrl()\n @renderMemberCard()\n @renderStoryViewer()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/channel-info.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-info.coffee", "line_start": 71, "line_end": 117} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n total : 1\n source : 2\n comment : 3\n single : 4\n block : 5\n mixed : 6\n empty : 7\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Comment,Single-line comment,Block comment,Mixed,Empty\n Total,1,2,3,4,5,6,7\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 25} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nchai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n total : 1\n source : 2\n comment : 3\n single : 4\n block : 5\n mixed : 6\n empty : 7\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Comment,Single-line comment,Block comment,Mixed,Empty\n Total,1,2,3,4,5,6,7\n \"\"\"\n```", "response": "var chai, csv, should;\n\nchai = require('chai');\n\ncsv = require('../../src/formatters/csv');\n\nshould = chai.should();\n\ndescribe(\"The CSV formatter\", function() {\n it(\"should be a function\", function() {\n return csv.should.be.a('function');\n });\n it(\"should return a string\", function() {\n return csv({}).should.be.a('string');\n });\n return it(\"should create a csv\", function() {\n var stats;\n stats = {\n total: 1,\n source: 2,\n comment: 3,\n single: 4,\n block: 5,\n mixed: 6,\n empty: 7\n };\n return csv({\n summary: stats\n }).should.equal(`Path,Physical,Source,Comment,Single-line comment,Block comment,Mixed,Empty\nTotal,1,2,3,4,5,6,7`);\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 25} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar chai, csv, should;\n\nchai = require('chai');\n\ncsv = require('../../src/formatters/csv');\n\nshould = chai.should();\n\ndescribe(\"The CSV formatter\", function() {\n it(\"should be a function\", function() {\n return csv.should.be.a('function');\n });\n it(\"should return a string\", function() {\n return csv({}).should.be.a('string');\n });\n return it(\"should create a csv\", function() {\n var stats;\n stats = {\n total: 1,\n source: 2,\n comment: 3,\n single: 4,\n block: 5,\n mixed: 6,\n empty: 7\n };\n return csv({\n summary: stats\n }).should.equal(`Path,Physical,Source,Comment,Single-line comment,Block comment,Mixed,Empty\nTotal,1,2,3,4,5,6,7`);\n });\n});\n```", "response": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n total : 1\n source : 2\n comment : 3\n single : 4\n block : 5\n mixed : 6\n empty : 7\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Comment,Single-line comment,Block comment,Mixed,Empty\n Total,1,2,3,4,5,6,7\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 25} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:completion", "type": "completion", "prompt": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'", "response": "it \"should create a csv\", ->\n stats =\n total : 1\n source : 2\n comment : 3\n single : 4\n block : 5\n mixed : 6\n empty : 7\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Comment,Single-line comment,Block comment,Mixed,Empty\n Total,1,2,3,4,5,6,7\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 25} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nchai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"\n```", "response": "var chai, csv, should;\n\nchai = require('chai');\n\ncsv = require('../../src/formatters/csv');\n\nshould = chai.should();\n\ndescribe(\"The CSV formatter\", function() {\n it(\"should be a function\", function() {\n return csv.should.be.a('function');\n });\n it(\"should return a string\", function() {\n return csv({}).should.be.a('string');\n });\n return it(\"should create a csv\", function() {\n var stats;\n stats = {\n loc: 1,\n sloc: 2,\n cloc: 3,\n scloc: 4,\n mcloc: 5,\n nloc: 6\n };\n return csv({\n summary: stats\n }).should.equal(`Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\nTotal,1,2,3,4,5,6`);\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar chai, csv, should;\n\nchai = require('chai');\n\ncsv = require('../../src/formatters/csv');\n\nshould = chai.should();\n\ndescribe(\"The CSV formatter\", function() {\n it(\"should be a function\", function() {\n return csv.should.be.a('function');\n });\n it(\"should return a string\", function() {\n return csv({}).should.be.a('string');\n });\n return it(\"should create a csv\", function() {\n var stats;\n stats = {\n loc: 1,\n sloc: 2,\n cloc: 3,\n scloc: 4,\n mcloc: 5,\n nloc: 6\n };\n return csv({\n summary: stats\n }).should.equal(`Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\nTotal,1,2,3,4,5,6`);\n });\n});\n```", "response": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:completion", "type": "completion", "prompt": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'", "response": "it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(summary: stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "dccfbc207600750a7689dea1ca9148af59d3d740", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/dccfbc207600750a7689dea1ca9148af59d3d740/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nchai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"\n```", "response": "var chai, csv, should;\n\nchai = require('chai');\n\ncsv = require('../../src/formatters/csv');\n\nshould = chai.should();\n\ndescribe(\"The CSV formatter\", function() {\n it(\"should be a function\", function() {\n return csv.should.be.a('function');\n });\n it(\"should return a string\", function() {\n return csv({}).should.be.a('string');\n });\n return it(\"should create a csv\", function() {\n var stats;\n stats = {\n loc: 1,\n sloc: 2,\n cloc: 3,\n scloc: 4,\n mcloc: 5,\n nloc: 6\n };\n return csv(stats).should.equal(`Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\nTotal,1,2,3,4,5,6`);\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "dccfbc207600750a7689dea1ca9148af59d3d740", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/dccfbc207600750a7689dea1ca9148af59d3d740/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar chai, csv, should;\n\nchai = require('chai');\n\ncsv = require('../../src/formatters/csv');\n\nshould = chai.should();\n\ndescribe(\"The CSV formatter\", function() {\n it(\"should be a function\", function() {\n return csv.should.be.a('function');\n });\n it(\"should return a string\", function() {\n return csv({}).should.be.a('string');\n });\n return it(\"should create a csv\", function() {\n var stats;\n stats = {\n loc: 1,\n sloc: 2,\n cloc: 3,\n scloc: 4,\n mcloc: 5,\n nloc: 6\n };\n return csv(stats).should.equal(`Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\nTotal,1,2,3,4,5,6`);\n });\n});\n```", "response": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'\n\n it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "dccfbc207600750a7689dea1ca9148af59d3d740", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/dccfbc207600750a7689dea1ca9148af59d3d740/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "flosse/sloc:spec/formatters/csv.spec.coffee:1:completion", "type": "completion", "prompt": "chai = require 'chai'\ncsv = require '../../src/formatters/csv'\nshould = chai.should()\n\ndescribe \"The CSV formatter\", ->\n\n it \"should be a function\", ->\n csv.should.be.a 'function'\n\n it \"should return a string\", ->\n csv({}).should.be.a 'string'", "response": "it \"should create a csv\", ->\n stats =\n loc : 1\n sloc : 2\n cloc : 3\n scloc : 4\n mcloc : 5\n nloc : 6\n csv(stats).should.equal \"\"\"\n Path,Physical,Source,Total comment,Single-line comment,Multi-line comment,Empty\n Total,1,2,3,4,5,6\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "spec/formatters/csv.spec.coffee", "license": "MIT", "commit": "dccfbc207600750a7689dea1ca9148af59d3d740", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/dccfbc207600750a7689dea1ca9148af59d3d740/spec/formatters/csv.spec.coffee", "line_start": 1, "line_end": 24} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.NodeWithAttributes.createVariant\n label: \"Component\"\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->\n {x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}\n {point: [1, 0], attributesToChange: [sx], filled: false}\n {point: [0, 1], attributesToChange: [sy], filled: false}\n ]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 36, "line_end": 85} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreateAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.NodeWithAttributes.createVariant\n label: \"Component\"\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->\n {x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}\n {point: [1, 0], attributesToChange: [sx], filled: false}\n {point: [0, 1], attributesToChange: [sy], filled: false}\n ]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]\n```", "response": "var createAttribute;\n\ncreateAttribute = function(label, name, exprString) {\n var attribute;\n attribute = Model.Attribute.createVariant({\n label: label,\n name: name\n });\n attribute.setExpression(exprString);\n return attribute;\n};\n\n// =============================================================================\n// Components\n// =============================================================================\nModel.Component = Model.NodeWithAttributes.createVariant({\n label: \"Component\",\n graphicClass: Graphic.Component,\n graphic: function() {\n var graphic;\n graphic = new this.graphicClass();\n _.extend(graphic, this.getAttributesValuesByName());\n return graphic;\n }\n});\n\nModel.Transform = Model.Component.createVariant({\n label: \"Transform\",\n matrix: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesValuesByName());\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate);\n },\n defaultAttributesToChange: function() {\n var x, y;\n ({x, y} = this.getAttributesByName());\n return [x, y];\n },\n controllableAttributes: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesByName());\n return [x, y, sx, sy, rotate];\n },\n controlPoints: function() {\n var sx, sy, x, y;\n ({x, y, sx, sy} = this.getAttributesByName());\n return [\n {\n point: [0,\n 0],\n attributesToChange: [x,\n y],\n filled: true\n },\n {\n point: [1,\n 0],\n attributesToChange: [sx],\n filled: false\n },\n {\n point: [0,\n 1],\n attributesToChange: [sy],\n filled: false\n }\n ];\n }\n});\n\nModel.Transform.addChildren([createAttribute(\"X\", \"x\", \"0.00\"), createAttribute(\"Y\", \"y\", \"0.00\"), createAttribute(\"Scale X\", \"sx\", \"1.00\"), createAttribute(\"Scale Y\", \"sy\", \"1.00\"), createAttribute(\"Rotate\", \"rotate\", \"0.00\")]);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 36, "line_end": 85} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar createAttribute;\n\ncreateAttribute = function(label, name, exprString) {\n var attribute;\n attribute = Model.Attribute.createVariant({\n label: label,\n name: name\n });\n attribute.setExpression(exprString);\n return attribute;\n};\n\n// =============================================================================\n// Components\n// =============================================================================\nModel.Component = Model.NodeWithAttributes.createVariant({\n label: \"Component\",\n graphicClass: Graphic.Component,\n graphic: function() {\n var graphic;\n graphic = new this.graphicClass();\n _.extend(graphic, this.getAttributesValuesByName());\n return graphic;\n }\n});\n\nModel.Transform = Model.Component.createVariant({\n label: \"Transform\",\n matrix: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesValuesByName());\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate);\n },\n defaultAttributesToChange: function() {\n var x, y;\n ({x, y} = this.getAttributesByName());\n return [x, y];\n },\n controllableAttributes: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesByName());\n return [x, y, sx, sy, rotate];\n },\n controlPoints: function() {\n var sx, sy, x, y;\n ({x, y, sx, sy} = this.getAttributesByName());\n return [\n {\n point: [0,\n 0],\n attributesToChange: [x,\n y],\n filled: true\n },\n {\n point: [1,\n 0],\n attributesToChange: [sx],\n filled: false\n },\n {\n point: [0,\n 1],\n attributesToChange: [sy],\n filled: false\n }\n ];\n }\n});\n\nModel.Transform.addChildren([createAttribute(\"X\", \"x\", \"0.00\"), createAttribute(\"Y\", \"y\", \"0.00\"), createAttribute(\"Scale X\", \"sx\", \"1.00\"), createAttribute(\"Scale Y\", \"sy\", \"1.00\"), createAttribute(\"Rotate\", \"rotate\", \"0.00\")]);\n```", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.NodeWithAttributes.createVariant\n label: \"Component\"\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->\n {x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}\n {point: [1, 0], attributesToChange: [sx], filled: false}\n {point: [0, 1], attributesToChange: [sy], filled: false}\n ]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 36, "line_end": 85} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:completion", "type": "completion", "prompt": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.NodeWithAttributes.createVariant\n label: \"Component\"\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"", "response": "matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->\n {x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}\n {point: [1, 0], attributesToChange: [sx], filled: false}\n {point: [0, 1], attributesToChange: [sy], filled: false}\n ]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 36, "line_end": 85} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n _devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n _devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 129, "line_end": 178} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreateAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n _devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n _devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent\n```", "response": "var createAnchor;\n\ncreateAnchor = function(x, y) {\n var anchor, attributes, transform;\n anchor = Model.Anchor.createVariant();\n transform = anchor.childOfType(Model.Transform);\n attributes = transform.getAttributesByName();\n attributes.x.setExpression(x);\n attributes.y.setExpression(y);\n return anchor;\n};\n\nModel.PathComponent = Model.Component.createVariant({\n _devLabel: \"PathComponent\",\n label: \"Path\",\n graphicClass: Graphic.PathComponent\n});\n\nModel.PathComponent.addChildren([createAttribute(\"Close Path\", \"closed\", \"true\")]);\n\nModel.Path = Model.Shape.createVariant({\n label: \"Path\",\n graphicClass: Graphic.Path\n});\n\nModel.Path.addChildren([Model.PathComponent.createVariant(), Model.Fill.createVariant(), Model.Stroke.createVariant()]);\n\nModel.Circle = Model.Path.createVariant({\n label: \"Circle\",\n graphicClass: Graphic.Circle\n});\n\nModel.Rectangle = Model.Path.createVariant({\n label: \"Rectangle\"\n});\n\nModel.Rectangle.addChildren([createAnchor(\"0.00\", \"0.00\"), createAnchor(\"0.00\", \"1.00\"), createAnchor(\"1.00\", \"1.00\"), createAnchor(\"1.00\", \"0.00\")]);\n\nModel.TextComponent = Model.Component.createVariant({\n _devLabel: \"TextComponent\",\n label: \"Text\",\n graphicClass: Graphic.TextComponent\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 129, "line_end": 178} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar createAnchor;\n\ncreateAnchor = function(x, y) {\n var anchor, attributes, transform;\n anchor = Model.Anchor.createVariant();\n transform = anchor.childOfType(Model.Transform);\n attributes = transform.getAttributesByName();\n attributes.x.setExpression(x);\n attributes.y.setExpression(y);\n return anchor;\n};\n\nModel.PathComponent = Model.Component.createVariant({\n _devLabel: \"PathComponent\",\n label: \"Path\",\n graphicClass: Graphic.PathComponent\n});\n\nModel.PathComponent.addChildren([createAttribute(\"Close Path\", \"closed\", \"true\")]);\n\nModel.Path = Model.Shape.createVariant({\n label: \"Path\",\n graphicClass: Graphic.Path\n});\n\nModel.Path.addChildren([Model.PathComponent.createVariant(), Model.Fill.createVariant(), Model.Stroke.createVariant()]);\n\nModel.Circle = Model.Path.createVariant({\n label: \"Circle\",\n graphicClass: Graphic.Circle\n});\n\nModel.Rectangle = Model.Path.createVariant({\n label: \"Rectangle\"\n});\n\nModel.Rectangle.addChildren([createAnchor(\"0.00\", \"0.00\"), createAnchor(\"0.00\", \"1.00\"), createAnchor(\"1.00\", \"1.00\"), createAnchor(\"1.00\", \"0.00\")]);\n\nModel.TextComponent = Model.Component.createVariant({\n _devLabel: \"TextComponent\",\n label: \"Text\",\n graphicClass: Graphic.TextComponent\n});\n```", "response": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n _devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n _devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 129, "line_end": 178} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:4:completion", "type": "completion", "prompt": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n _devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()", "response": "Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n _devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "33341b13fca2662eeb70581100c8419fca12cb41", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/33341b13fca2662eeb70581100c8419fca12cb41/src/Model/Model.coffee", "line_start": 129, "line_end": 178} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n label: \"Component\"\n\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "edc013ad3429cd6b175dd67ebfa43b5ef0a20993", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/edc013ad3429cd6b175dd67ebfa43b5ef0a20993/src/Model/Model.coffee", "line_start": 35, "line_end": 84} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreateAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n label: \"Component\"\n\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->\n```", "response": "var createAttribute;\n\ncreateAttribute = function(label, name, exprString) {\n var attribute;\n attribute = Model.Attribute.createVariant({\n label: label,\n name: name\n });\n attribute.setExpression(exprString);\n return attribute;\n};\n\n// =============================================================================\n// Components\n// =============================================================================\nModel.Component = Model.Node.createVariant({\n label: \"Component\",\n attributes: function() {\n return this.childrenOfType(Model.Attribute);\n },\n getAttributesByName: function() {\n return _.indexBy(this.attributes(), \"name\");\n },\n getAttributesValuesByName: function() {\n var attribute, i, len, name, ref, result, value;\n result = {};\n ref = this.attributes();\n for (i = 0, len = ref.length; i < len; i++) {\n attribute = ref[i];\n name = attribute.name;\n value = attribute.value();\n result[name] = value;\n }\n return result;\n },\n graphicClass: Graphic.Component,\n graphic: function() {\n var graphic;\n graphic = new this.graphicClass();\n _.extend(graphic, this.getAttributesValuesByName());\n return graphic;\n }\n});\n\nModel.Transform = Model.Component.createVariant({\n label: \"Transform\",\n matrix: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesValuesByName());\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate);\n },\n defaultAttributesToChange: function() {\n var x, y;\n ({x, y} = this.getAttributesByName());\n return [x, y];\n },\n controllableAttributes: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesByName());\n return [x, y, sx, sy, rotate];\n },\n controlPoints: function() {}\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "edc013ad3429cd6b175dd67ebfa43b5ef0a20993", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/edc013ad3429cd6b175dd67ebfa43b5ef0a20993/src/Model/Model.coffee", "line_start": 35, "line_end": 84} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar createAttribute;\n\ncreateAttribute = function(label, name, exprString) {\n var attribute;\n attribute = Model.Attribute.createVariant({\n label: label,\n name: name\n });\n attribute.setExpression(exprString);\n return attribute;\n};\n\n// =============================================================================\n// Components\n// =============================================================================\nModel.Component = Model.Node.createVariant({\n label: \"Component\",\n attributes: function() {\n return this.childrenOfType(Model.Attribute);\n },\n getAttributesByName: function() {\n return _.indexBy(this.attributes(), \"name\");\n },\n getAttributesValuesByName: function() {\n var attribute, i, len, name, ref, result, value;\n result = {};\n ref = this.attributes();\n for (i = 0, len = ref.length; i < len; i++) {\n attribute = ref[i];\n name = attribute.name;\n value = attribute.value();\n result[name] = value;\n }\n return result;\n },\n graphicClass: Graphic.Component,\n graphic: function() {\n var graphic;\n graphic = new this.graphicClass();\n _.extend(graphic, this.getAttributesValuesByName());\n return graphic;\n }\n});\n\nModel.Transform = Model.Component.createVariant({\n label: \"Transform\",\n matrix: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesValuesByName());\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate);\n },\n defaultAttributesToChange: function() {\n var x, y;\n ({x, y} = this.getAttributesByName());\n return [x, y];\n },\n controllableAttributes: function() {\n var rotate, sx, sy, x, y;\n ({x, y, sx, sy, rotate} = this.getAttributesByName());\n return [x, y, sx, sy, rotate];\n },\n controlPoints: function() {}\n});\n```", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n label: \"Component\"\n\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "edc013ad3429cd6b175dd67ebfa43b5ef0a20993", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/edc013ad3429cd6b175dd67ebfa43b5ef0a20993/src/Model/Model.coffee", "line_start": 35, "line_end": 84} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:completion", "type": "completion", "prompt": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n label: \"Component\"\n\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()", "response": "result[name] = value\n return result\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "edc013ad3429cd6b175dd67ebfa43b5ef0a20993", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/edc013ad3429cd6b175dd67ebfa43b5ef0a20993/src/Model/Model.coffee", "line_start": 35, "line_end": 84} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}\n {point: [1, 0], attributesToChange: [sx], filled: false}\n {point: [0, 1], attributesToChange: [sy], filled: false}\n ]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]\n\n\n\nModel.Fill = Model.Component.createVariant\n label: \"Fill\"\n graphicClass: Graphic.Fill\n\nModel.Fill.addChildren [\n createAttribute(\"Fill Color\", \"color\", \"rgba(0.93, 0.93, 0.93, 1.00)\")\n]\n\n\nModel.Stroke = Model.Component.createVariant\n label: \"Stroke\"\n graphicClass: Graphic.Stroke\n\nModel.Stroke.addChildren [\n createAttribute(\"Stroke Color\", \"color\", \"rgba(0.60, 0.60, 0.60, 1.00)\")\n createAttribute(\"Line Width\", \"lineWidth\", \"1\")\n]\n\n\n# =============================================================================\n# Elements\n# =============================================================================\n\nModel.Shape = Model.Element.createVariant\n label: \"Shape\"\n\nModel.Shape.addChildren [\n Model.Transform.createVariant()\n]\n\n\nModel.Group = Model.Shape.createVariant\n label: \"Group\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "edc013ad3429cd6b175dd67ebfa43b5ef0a20993", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/edc013ad3429cd6b175dd67ebfa43b5ef0a20993/src/Model/Model.coffee", "line_start": 85, "line_end": 134} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:3:completion", "type": "completion", "prompt": "{x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}\n {point: [1, 0], attributesToChange: [sx], filled: false}\n {point: [0, 1], attributesToChange: [sy], filled: false}\n ]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]\n\n\n\nModel.Fill = Model.Component.createVariant\n label: \"Fill\"\n graphicClass: Graphic.Fill\n\nModel.Fill.addChildren [\n createAttribute(\"Fill Color\", \"color\", \"rgba(0.93, 0.93, 0.93, 1.00)\")\n]", "response": "Model.Stroke = Model.Component.createVariant\n label: \"Stroke\"\n graphicClass: Graphic.Stroke\n\nModel.Stroke.addChildren [\n createAttribute(\"Stroke Color\", \"color\", \"rgba(0.60, 0.60, 0.60, 1.00)\")\n createAttribute(\"Line Width\", \"lineWidth\", \"1\")\n]\n\n\n# =============================================================================\n# Elements\n# =============================================================================\n\nModel.Shape = Model.Element.createVariant\n label: \"Shape\"\n\nModel.Shape.addChildren [\n Model.Transform.createVariant()\n]\n\n\nModel.Group = Model.Shape.createVariant\n label: \"Group\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "edc013ad3429cd6b175dd67ebfa43b5ef0a20993", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/edc013ad3429cd6b175dd67ebfa43b5ef0a20993/src/Model/Model.coffee", "line_start": 85, "line_end": 134} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd/src/Model/Model.coffee", "line_start": 142, "line_end": 191} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreateAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent\n```", "response": "var createAnchor;\n\ncreateAnchor = function(x, y) {\n var anchor, attributes, transform;\n anchor = Model.Anchor.createVariant();\n transform = anchor.childOfType(Model.Transform);\n attributes = transform.getAttributesByName();\n attributes.x.setExpression(x);\n attributes.y.setExpression(y);\n return anchor;\n};\n\nModel.PathComponent = Model.Component.createVariant({\n devLabel: \"PathComponent\",\n label: \"Path\",\n graphicClass: Graphic.PathComponent\n});\n\nModel.PathComponent.addChildren([createAttribute(\"Close Path\", \"closed\", \"true\")]);\n\nModel.Path = Model.Shape.createVariant({\n label: \"Path\",\n graphicClass: Graphic.Path\n});\n\nModel.Path.addChildren([Model.PathComponent.createVariant(), Model.Fill.createVariant(), Model.Stroke.createVariant()]);\n\nModel.Circle = Model.Path.createVariant({\n label: \"Circle\",\n graphicClass: Graphic.Circle\n});\n\nModel.Rectangle = Model.Path.createVariant({\n label: \"Rectangle\"\n});\n\nModel.Rectangle.addChildren([createAnchor(\"0.00\", \"0.00\"), createAnchor(\"0.00\", \"1.00\"), createAnchor(\"1.00\", \"1.00\"), createAnchor(\"1.00\", \"0.00\")]);\n\nModel.TextComponent = Model.Component.createVariant({\n devLabel: \"TextComponent\",\n label: \"Text\",\n graphicClass: Graphic.TextComponent\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd/src/Model/Model.coffee", "line_start": 142, "line_end": 191} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar createAnchor;\n\ncreateAnchor = function(x, y) {\n var anchor, attributes, transform;\n anchor = Model.Anchor.createVariant();\n transform = anchor.childOfType(Model.Transform);\n attributes = transform.getAttributesByName();\n attributes.x.setExpression(x);\n attributes.y.setExpression(y);\n return anchor;\n};\n\nModel.PathComponent = Model.Component.createVariant({\n devLabel: \"PathComponent\",\n label: \"Path\",\n graphicClass: Graphic.PathComponent\n});\n\nModel.PathComponent.addChildren([createAttribute(\"Close Path\", \"closed\", \"true\")]);\n\nModel.Path = Model.Shape.createVariant({\n label: \"Path\",\n graphicClass: Graphic.Path\n});\n\nModel.Path.addChildren([Model.PathComponent.createVariant(), Model.Fill.createVariant(), Model.Stroke.createVariant()]);\n\nModel.Circle = Model.Path.createVariant({\n label: \"Circle\",\n graphicClass: Graphic.Circle\n});\n\nModel.Rectangle = Model.Path.createVariant({\n label: \"Rectangle\"\n});\n\nModel.Rectangle.addChildren([createAnchor(\"0.00\", \"0.00\"), createAnchor(\"0.00\", \"1.00\"), createAnchor(\"1.00\", \"1.00\"), createAnchor(\"1.00\", \"0.00\")]);\n\nModel.TextComponent = Model.Component.createVariant({\n devLabel: \"TextComponent\",\n label: \"Text\",\n graphicClass: Graphic.TextComponent\n});\n```", "response": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd/src/Model/Model.coffee", "line_start": 142, "line_end": 191} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:5:completion", "type": "completion", "prompt": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n devLabel: \"PathComponent\"\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()", "response": "Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n devLabel: \"TextComponent\"\n label: \"Text\"\n graphicClass: Graphic.TextComponent", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/bb5014cf07ab6e104c4ce9fc8b56de00f9ad99bd/src/Model/Model.coffee", "line_start": 142, "line_end": 191} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->\n {x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Model.coffee", "line_start": 32, "line_end": 81} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:completion", "type": "completion", "prompt": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result", "response": "graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n controlPoints: ->\n {x, y, sx, sy} = @getAttributesByName()\n return [\n {point: [0, 0], attributesToChange: [x, y], filled: true}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Model.coffee", "line_start": 32, "line_end": 81} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n label: \"Text\"\n graphicClass: Graphic.TextComponent\n\nModel.TextComponent.addChildren [\n createAttribute(\"Text\", \"text\", '\"Text\"')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Model.coffee", "line_start": 134, "line_end": 183} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:5:completion", "type": "completion", "prompt": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n label: \"Path\"\n graphicClass: Graphic.PathComponent\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()", "response": "]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n label: \"Text\"\n graphicClass: Graphic.TextComponent\n\nModel.TextComponent.addChildren [\n createAttribute(\"Text\", \"text\", '\"Text\"')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "197f7a87562a6de36185a768b3627749831d5c75", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/197f7a87562a6de36185a768b3627749831d5c75/src/Model/Model.coffee", "line_start": 134, "line_end": 183} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Model.coffee", "line_start": 31, "line_end": 80} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:completion", "type": "completion", "prompt": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result", "response": "graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n {x, y, sx, sy, rotate} = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(x, y, sx, sy, rotate)\n defaultAttributesToChange: ->\n {x, y} = @getAttributesByName()\n return [x, y]\n controllableAttributes: ->\n {x, y, sx, sy, rotate} = @getAttributesByName()\n return [x, y, sx, sy, rotate]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "8488c61d326045c635d28cfa1580a37deeb7fecc", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/8488c61d326045c635d28cfa1580a37deeb7fecc/src/Model/Model.coffee", "line_start": 31, "line_end": 80} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n v = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate)\n defaultAttributesToChange: ->\n attributesByName = @getAttributesByName()\n return [attributesByName.x, attributesByName.y]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "01d0628f253632c227bb0a7fc7afac851870213f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Model/Model.coffee", "line_start": 34, "line_end": 83} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:completion", "type": "completion", "prompt": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n result = {}\n for attribute in @attributes()\n name = attribute.name\n value = attribute.value()\n result[name] = value\n return result", "response": "graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n v = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate)\n defaultAttributesToChange: ->\n attributesByName = @getAttributesByName()\n return [attributesByName.x, attributesByName.y]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "01d0628f253632c227bb0a7fc7afac851870213f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/01d0628f253632c227bb0a7fc7afac851870213f/src/Model/Model.coffee", "line_start": 34, "line_end": 83} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n _.mapObject @getAttributesByName(), (attribute) ->\n attribute.value()\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n v = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate)\n defaultAttributesToChange: ->\n attributesByName = @getAttributesByName()\n return [attributesByName.x, attributesByName.y]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "1fd72ed910569a6428762d38f4e2578a90f0be7f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/1fd72ed910569a6428762d38f4e2578a90f0be7f/src/Model/Model.coffee", "line_start": 21, "line_end": 70} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreateAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n _.mapObject @getAttributesByName(), (attribute) ->\n attribute.value()\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n v = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate)\n defaultAttributesToChange: ->\n attributesByName = @getAttributesByName()\n return [attributesByName.x, attributesByName.y]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]\n```", "response": "var createAttribute;\n\ncreateAttribute = function(label, name, exprString) {\n var attribute;\n attribute = Model.Attribute.createVariant({\n label: label,\n name: name\n });\n attribute.setExpression(exprString);\n return attribute;\n};\n\n// =============================================================================\n// Components\n// =============================================================================\nModel.Component = Model.Node.createVariant({\n attributes: function() {\n return this.childrenOfType(Model.Attribute);\n },\n getAttributesByName: function() {\n return _.indexBy(this.attributes(), \"name\");\n },\n getAttributesValuesByName: function() {\n return _.mapObject(this.getAttributesByName(), function(attribute) {\n return attribute.value();\n });\n },\n graphicClass: Graphic.Component,\n graphic: function() {\n var graphic;\n graphic = new this.graphicClass();\n _.extend(graphic, this.getAttributesValuesByName());\n return graphic;\n }\n});\n\nModel.Transform = Model.Component.createVariant({\n label: \"Transform\",\n matrix: function() {\n var v;\n v = this.getAttributesValuesByName();\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate);\n },\n defaultAttributesToChange: function() {\n var attributesByName;\n attributesByName = this.getAttributesByName();\n return [attributesByName.x, attributesByName.y];\n }\n});\n\nModel.Transform.addChildren([createAttribute(\"X\", \"x\", \"0.00\"), createAttribute(\"Y\", \"y\", \"0.00\"), createAttribute(\"Scale X\", \"sx\", \"1.00\"), createAttribute(\"Scale Y\", \"sy\", \"1.00\"), createAttribute(\"Rotate\", \"rotate\", \"0.00\")]);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "1fd72ed910569a6428762d38f4e2578a90f0be7f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/1fd72ed910569a6428762d38f4e2578a90f0be7f/src/Model/Model.coffee", "line_start": 21, "line_end": 70} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar createAttribute;\n\ncreateAttribute = function(label, name, exprString) {\n var attribute;\n attribute = Model.Attribute.createVariant({\n label: label,\n name: name\n });\n attribute.setExpression(exprString);\n return attribute;\n};\n\n// =============================================================================\n// Components\n// =============================================================================\nModel.Component = Model.Node.createVariant({\n attributes: function() {\n return this.childrenOfType(Model.Attribute);\n },\n getAttributesByName: function() {\n return _.indexBy(this.attributes(), \"name\");\n },\n getAttributesValuesByName: function() {\n return _.mapObject(this.getAttributesByName(), function(attribute) {\n return attribute.value();\n });\n },\n graphicClass: Graphic.Component,\n graphic: function() {\n var graphic;\n graphic = new this.graphicClass();\n _.extend(graphic, this.getAttributesValuesByName());\n return graphic;\n }\n});\n\nModel.Transform = Model.Component.createVariant({\n label: \"Transform\",\n matrix: function() {\n var v;\n v = this.getAttributesValuesByName();\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate);\n },\n defaultAttributesToChange: function() {\n var attributesByName;\n attributesByName = this.getAttributesByName();\n return [attributesByName.x, attributesByName.y];\n }\n});\n\nModel.Transform.addChildren([createAttribute(\"X\", \"x\", \"0.00\"), createAttribute(\"Y\", \"y\", \"0.00\"), createAttribute(\"Scale X\", \"sx\", \"1.00\"), createAttribute(\"Scale Y\", \"sy\", \"1.00\"), createAttribute(\"Rotate\", \"rotate\", \"0.00\")]);\n```", "response": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n _.mapObject @getAttributesByName(), (attribute) ->\n attribute.value()\n\n graphicClass: Graphic.Component\n\n graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n v = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate)\n defaultAttributesToChange: ->\n attributesByName = @getAttributesByName()\n return [attributesByName.x, attributesByName.y]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "1fd72ed910569a6428762d38f4e2578a90f0be7f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/1fd72ed910569a6428762d38f4e2578a90f0be7f/src/Model/Model.coffee", "line_start": 21, "line_end": 70} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:2:completion", "type": "completion", "prompt": "createAttribute = (label, name, exprString) ->\n attribute = Model.Attribute.createVariant\n label: label\n name: name\n attribute.setExpression(exprString)\n return attribute\n\n# =============================================================================\n# Components\n# =============================================================================\n\nModel.Component = Model.Node.createVariant\n attributes: ->\n @childrenOfType(Model.Attribute)\n\n getAttributesByName: ->\n _.indexBy @attributes(), \"name\"\n\n getAttributesValuesByName: ->\n _.mapObject @getAttributesByName(), (attribute) ->\n attribute.value()\n\n graphicClass: Graphic.Component", "response": "graphic: ->\n graphic = new @graphicClass()\n _.extend graphic, @getAttributesValuesByName()\n return graphic\n\n\n\nModel.Transform = Model.Component.createVariant\n label: \"Transform\"\n matrix: ->\n v = @getAttributesValuesByName()\n return Util.Matrix.naturalConstruct(v.x, v.y, v.sx, v.sy, v.rotate)\n defaultAttributesToChange: ->\n attributesByName = @getAttributesByName()\n return [attributesByName.x, attributesByName.y]\n\nModel.Transform.addChildren [\n createAttribute(\"X\", \"x\", \"0.00\")\n createAttribute(\"Y\", \"y\", \"0.00\")\n createAttribute(\"Scale X\", \"sx\", \"1.00\")\n createAttribute(\"Scale Y\", \"sy\", \"1.00\")\n createAttribute(\"Rotate\", \"rotate\", \"0.00\")\n]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "1fd72ed910569a6428762d38f4e2578a90f0be7f", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/1fd72ed910569a6428762d38f4e2578a90f0be7f/src/Model/Model.coffee", "line_start": 21, "line_end": 70} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n label: \"Path\"\n # TODO graphicClass\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()\n]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n label: \"Text\"\n # TODO graphicClass\n\nModel.TextComponent.addChildren [\n createAttribute(\"Text\", \"text\", '\"Text\"')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "e6bd2b9859b5c223ed589131247a02487b570769", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/Model/Model.coffee", "line_start": 109, "line_end": 158} +{"id": "cdglabs/apparatus:src/Model/Model.coffee:4:completion", "type": "completion", "prompt": "createAnchor = (x, y) ->\n anchor = Model.Anchor.createVariant()\n transform = anchor.childOfType(Model.Transform)\n attributes = transform.getAttributesByName()\n attributes.x.setExpression(x)\n attributes.y.setExpression(y)\n return anchor\n\n\nModel.PathComponent = Model.Component.createVariant\n label: \"Path\"\n # TODO graphicClass\n\nModel.PathComponent.addChildren [\n createAttribute(\"Close Path\", \"closed\", \"true\")\n]\n\nModel.Path = Model.Shape.createVariant\n label: \"Path\"\n graphicClass: Graphic.Path\n\nModel.Path.addChildren [\n Model.PathComponent.createVariant()\n Model.Fill.createVariant()\n Model.Stroke.createVariant()", "response": "]\n\n\nModel.Circle = Model.Path.createVariant\n label: \"Circle\"\n graphicClass: Graphic.Circle\n\n\nModel.Rectangle = Model.Path.createVariant\n label: \"Rectangle\"\n\nModel.Rectangle.addChildren [\n createAnchor(\"0.00\", \"0.00\")\n createAnchor(\"0.00\", \"1.00\")\n createAnchor(\"1.00\", \"1.00\")\n createAnchor(\"1.00\", \"0.00\")\n]\n\n\nModel.TextComponent = Model.Component.createVariant\n label: \"Text\"\n # TODO graphicClass\n\nModel.TextComponent.addChildren [\n createAttribute(\"Text\", \"text\", '\"Text\"')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Model/Model.coffee", "license": "MIT", "commit": "e6bd2b9859b5c223ed589131247a02487b570769", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/Model/Model.coffee", "line_start": 109, "line_end": 158} +{"id": "jianliaoim/talk-os:talk-web/client/locales/lang.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "recorder = require 'actions-recorder'\n\n# Todo: language function and Monent locale\n\nenLocale = require '../locales/en'\nzhLocale = require '../locales/zh'\nzhTwLocale = require '../locales/zh-tw'\nmoment = require '../util/moment'\n\nif module.hot\n module.hot.accept ['../locales/en', '../locales/zh', '../locales/zh-tw'], ->\n enLocale = require '../locales/en'\n zhLocale = require '../locales/zh'\n zhTwLocale = require '../locales/zh-tw'\n\ncachedLanguage = 'zh'\nmoment.locale 'zh-cn'\n\nrecorder.subscribe (core) ->\n language = exports.getLang()\n if language isnt cachedLanguage\n if language is 'en'\n cachedLanguage = 'en'\n moment.locale 'en'\n else if language is 'zh-tw'\n cachedLanguage = 'zh-tw'\n moment.locale 'zh-tw'\n else if language is 'zh'\n cachedLanguage = 'zh'\n moment.locale 'zh-cn'\n\nexports.getText = (text, language) ->\n language or= exports.getLang()\n\n if language is 'en'\n localeSource = enLocale\n else if language is 'zh-tw'\n localeSource = zhTwLocale\n else\n localeSource = zhLocale\n\n if localeSource[text]?\n localeSource[text]\n else\n \"{{#{text}}}\"\n\nexports.getLang = ->\n store = recorder.getStore()\n language = store.getIn(['prefs', 'language']) or 'zh'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/locales/lang.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/locales/lang.coffee", "line_start": 1, "line_end": 49} +{"id": "jianliaoim/talk-os:talk-web/client/locales/lang.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrecorder = require 'actions-recorder'\n\n# Todo: language function and Monent locale\n\nenLocale = require '../locales/en'\nzhLocale = require '../locales/zh'\nzhTwLocale = require '../locales/zh-tw'\nmoment = require '../util/moment'\n\nif module.hot\n module.hot.accept ['../locales/en', '../locales/zh', '../locales/zh-tw'], ->\n enLocale = require '../locales/en'\n zhLocale = require '../locales/zh'\n zhTwLocale = require '../locales/zh-tw'\n\ncachedLanguage = 'zh'\nmoment.locale 'zh-cn'\n\nrecorder.subscribe (core) ->\n language = exports.getLang()\n if language isnt cachedLanguage\n if language is 'en'\n cachedLanguage = 'en'\n moment.locale 'en'\n else if language is 'zh-tw'\n cachedLanguage = 'zh-tw'\n moment.locale 'zh-tw'\n else if language is 'zh'\n cachedLanguage = 'zh'\n moment.locale 'zh-cn'\n\nexports.getText = (text, language) ->\n language or= exports.getLang()\n\n if language is 'en'\n localeSource = enLocale\n else if language is 'zh-tw'\n localeSource = zhTwLocale\n else\n localeSource = zhLocale\n\n if localeSource[text]?\n localeSource[text]\n else\n \"{{#{text}}}\"\n\nexports.getLang = ->\n store = recorder.getStore()\n language = store.getIn(['prefs', 'language']) or 'zh'\n```", "response": "var cachedLanguage, enLocale, moment, recorder, zhLocale, zhTwLocale;\n\nrecorder = require('actions-recorder');\n\n// Todo: language function and Monent locale\nenLocale = require('../locales/en');\n\nzhLocale = require('../locales/zh');\n\nzhTwLocale = require('../locales/zh-tw');\n\nmoment = require('../util/moment');\n\nif (module.hot) {\n module.hot.accept(['../locales/en', '../locales/zh', '../locales/zh-tw'], function() {\n enLocale = require('../locales/en');\n zhLocale = require('../locales/zh');\n return zhTwLocale = require('../locales/zh-tw');\n });\n}\n\ncachedLanguage = 'zh';\n\nmoment.locale('zh-cn');\n\nrecorder.subscribe(function(core) {\n var language;\n language = exports.getLang();\n if (language !== cachedLanguage) {\n if (language === 'en') {\n cachedLanguage = 'en';\n return moment.locale('en');\n } else if (language === 'zh-tw') {\n cachedLanguage = 'zh-tw';\n return moment.locale('zh-tw');\n } else if (language === 'zh') {\n cachedLanguage = 'zh';\n return moment.locale('zh-cn');\n }\n }\n});\n\nexports.getText = function(text, language) {\n var localeSource;\n language || (language = exports.getLang());\n if (language === 'en') {\n localeSource = enLocale;\n } else if (language === 'zh-tw') {\n localeSource = zhTwLocale;\n } else {\n localeSource = zhLocale;\n }\n if (localeSource[text] != null) {\n return localeSource[text];\n } else {\n return `{{${text}}}`;\n }\n};\n\nexports.getLang = function() {\n var language, store;\n store = recorder.getStore();\n return language = store.getIn(['prefs', 'language']) || 'zh';\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/locales/lang.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/locales/lang.coffee", "line_start": 1, "line_end": 49} +{"id": "jianliaoim/talk-os:talk-web/client/locales/lang.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar cachedLanguage, enLocale, moment, recorder, zhLocale, zhTwLocale;\n\nrecorder = require('actions-recorder');\n\n// Todo: language function and Monent locale\nenLocale = require('../locales/en');\n\nzhLocale = require('../locales/zh');\n\nzhTwLocale = require('../locales/zh-tw');\n\nmoment = require('../util/moment');\n\nif (module.hot) {\n module.hot.accept(['../locales/en', '../locales/zh', '../locales/zh-tw'], function() {\n enLocale = require('../locales/en');\n zhLocale = require('../locales/zh');\n return zhTwLocale = require('../locales/zh-tw');\n });\n}\n\ncachedLanguage = 'zh';\n\nmoment.locale('zh-cn');\n\nrecorder.subscribe(function(core) {\n var language;\n language = exports.getLang();\n if (language !== cachedLanguage) {\n if (language === 'en') {\n cachedLanguage = 'en';\n return moment.locale('en');\n } else if (language === 'zh-tw') {\n cachedLanguage = 'zh-tw';\n return moment.locale('zh-tw');\n } else if (language === 'zh') {\n cachedLanguage = 'zh';\n return moment.locale('zh-cn');\n }\n }\n});\n\nexports.getText = function(text, language) {\n var localeSource;\n language || (language = exports.getLang());\n if (language === 'en') {\n localeSource = enLocale;\n } else if (language === 'zh-tw') {\n localeSource = zhTwLocale;\n } else {\n localeSource = zhLocale;\n }\n if (localeSource[text] != null) {\n return localeSource[text];\n } else {\n return `{{${text}}}`;\n }\n};\n\nexports.getLang = function() {\n var language, store;\n store = recorder.getStore();\n return language = store.getIn(['prefs', 'language']) || 'zh';\n};\n```", "response": "recorder = require 'actions-recorder'\n\n# Todo: language function and Monent locale\n\nenLocale = require '../locales/en'\nzhLocale = require '../locales/zh'\nzhTwLocale = require '../locales/zh-tw'\nmoment = require '../util/moment'\n\nif module.hot\n module.hot.accept ['../locales/en', '../locales/zh', '../locales/zh-tw'], ->\n enLocale = require '../locales/en'\n zhLocale = require '../locales/zh'\n zhTwLocale = require '../locales/zh-tw'\n\ncachedLanguage = 'zh'\nmoment.locale 'zh-cn'\n\nrecorder.subscribe (core) ->\n language = exports.getLang()\n if language isnt cachedLanguage\n if language is 'en'\n cachedLanguage = 'en'\n moment.locale 'en'\n else if language is 'zh-tw'\n cachedLanguage = 'zh-tw'\n moment.locale 'zh-tw'\n else if language is 'zh'\n cachedLanguage = 'zh'\n moment.locale 'zh-cn'\n\nexports.getText = (text, language) ->\n language or= exports.getLang()\n\n if language is 'en'\n localeSource = enLocale\n else if language is 'zh-tw'\n localeSource = zhTwLocale\n else\n localeSource = zhLocale\n\n if localeSource[text]?\n localeSource[text]\n else\n \"{{#{text}}}\"\n\nexports.getLang = ->\n store = recorder.getStore()\n language = store.getIn(['prefs', 'language']) or 'zh'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/locales/lang.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/locales/lang.coffee", "line_start": 1, "line_end": 49} +{"id": "jianliaoim/talk-os:talk-web/client/locales/lang.coffee:1:completion", "type": "completion", "prompt": "recorder = require 'actions-recorder'\n\n# Todo: language function and Monent locale\n\nenLocale = require '../locales/en'\nzhLocale = require '../locales/zh'\nzhTwLocale = require '../locales/zh-tw'\nmoment = require '../util/moment'\n\nif module.hot\n module.hot.accept ['../locales/en', '../locales/zh', '../locales/zh-tw'], ->\n enLocale = require '../locales/en'\n zhLocale = require '../locales/zh'\n zhTwLocale = require '../locales/zh-tw'\n\ncachedLanguage = 'zh'\nmoment.locale 'zh-cn'\n\nrecorder.subscribe (core) ->\n language = exports.getLang()\n if language isnt cachedLanguage\n if language is 'en'\n cachedLanguage = 'en'\n moment.locale 'en'", "response": "else if language is 'zh-tw'\n cachedLanguage = 'zh-tw'\n moment.locale 'zh-tw'\n else if language is 'zh'\n cachedLanguage = 'zh'\n moment.locale 'zh-cn'\n\nexports.getText = (text, language) ->\n language or= exports.getLang()\n\n if language is 'en'\n localeSource = enLocale\n else if language is 'zh-tw'\n localeSource = zhTwLocale\n else\n localeSource = zhLocale\n\n if localeSource[text]?\n localeSource[text]\n else\n \"{{#{text}}}\"\n\nexports.getLang = ->\n store = recorder.getStore()\n language = store.getIn(['prefs', 'language']) or 'zh'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/locales/lang.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/locales/lang.coffee", "line_start": 1, "line_end": 49} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn(@file, args, @options)\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nlog = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn(@file, args, @options)\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>\n```", "response": "var log, spawn;\n\nlog = require('./logger');\n\nspawn = require('child_process').spawn;\n\nmodule.exports = function() {\n this.Processes = {};\n return this.Process = class Process {\n constructor(file, message, options = {}) {\n this.stop = this.stop.bind(this);\n this._stdout = this._stdout.bind(this);\n this._stderr = this._stderr.bind(this);\n this._exit = this._exit.bind(this);\n this._error = this._error.bind(this);\n this._close = this._close.bind(this);\n this.file = file;\n this.message = message;\n this.options = options;\n }\n\n start(...args) {\n if (!this._started) {\n this._started = $.defer();\n this._process = spawn(this.file, args, this.options);\n this._process.stdout.on('data', this._stdout);\n this._process.stderr.on('data', this._stderr);\n this._process.on('exit', this._exit);\n this._process.on('error', this._error);\n this._process.on('close', this._close);\n this._process.on('disconnect', this._disconnect);\n this._process.on('message', this._message);\n process.on('exit', this.stop);\n process.on('error', this.stop);\n }\n return this._started.promise;\n }\n\n stop() {\n if (this._process) {\n this._process.kill() && (this._process = null);\n }\n return $.fulfilled(!this._process);\n }\n\n _stdout(data) {\n this._logBuffer(log.info, \"STDOUT\", data);\n if (this._started.promise.isPending()) {\n if (~data.toString().indexOf(this.message)) {\n return this._started.fulfill();\n }\n }\n }\n\n _stderr(data) {\n return this._logBuffer(log.warn, \"STDERR\", data);\n }\n\n _exit(code, signal) {\n return this._log(log.error, \"EXIT\", [code, signal].join(', '));\n }\n\n _error(error) {\n return this._started.reject(error);\n }\n\n _close(code, signal) {}\n\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar log, spawn;\n\nlog = require('./logger');\n\nspawn = require('child_process').spawn;\n\nmodule.exports = function() {\n this.Processes = {};\n return this.Process = class Process {\n constructor(file, message, options = {}) {\n this.stop = this.stop.bind(this);\n this._stdout = this._stdout.bind(this);\n this._stderr = this._stderr.bind(this);\n this._exit = this._exit.bind(this);\n this._error = this._error.bind(this);\n this._close = this._close.bind(this);\n this.file = file;\n this.message = message;\n this.options = options;\n }\n\n start(...args) {\n if (!this._started) {\n this._started = $.defer();\n this._process = spawn(this.file, args, this.options);\n this._process.stdout.on('data', this._stdout);\n this._process.stderr.on('data', this._stderr);\n this._process.on('exit', this._exit);\n this._process.on('error', this._error);\n this._process.on('close', this._close);\n this._process.on('disconnect', this._disconnect);\n this._process.on('message', this._message);\n process.on('exit', this.stop);\n process.on('error', this.stop);\n }\n return this._started.promise;\n }\n\n stop() {\n if (this._process) {\n this._process.kill() && (this._process = null);\n }\n return $.fulfilled(!this._process);\n }\n\n _stdout(data) {\n this._logBuffer(log.info, \"STDOUT\", data);\n if (this._started.promise.isPending()) {\n if (~data.toString().indexOf(this.message)) {\n return this._started.fulfill();\n }\n }\n }\n\n _stderr(data) {\n return this._logBuffer(log.warn, \"STDERR\", data);\n }\n\n _exit(code, signal) {\n return this._log(log.error, \"EXIT\", [code, signal].join(', '));\n }\n\n _error(error) {\n return this._started.reject(error);\n }\n\n _close(code, signal) {}\n\n };\n};\n```", "response": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn(@file, args, @options)\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:completion", "type": "completion", "prompt": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn(@file, args, @options)\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message", "response": "process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@_log log.warn, \"CLOSE\", [code, signal].join(', ')\n\n _disconnect: =>\n @_log log.info, \"DISCONNECT\"\n\n _message: (message) =>\n @_log log.info, \"MESSAGE\", message\n\n _log: (logger, type, data) =>\n logger \"#{@file}:#{type} - #{data}\" if data\n\n _logBuffer: (logger, type, buffer) =>\n @_log(logger, type, line) for line in buffer.toString().split(\"\\n\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 51, "line_end": 63} +{"id": "mojotech/pioneer:src/support/Process.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@_log log.warn, \"CLOSE\", [code, signal].join(', ')\n\n _disconnect: =>\n @_log log.info, \"DISCONNECT\"\n\n _message: (message) =>\n @_log log.info, \"MESSAGE\", message\n\n _log: (logger, type, data) =>\n logger \"#{@file}:#{type} - #{data}\" if data\n\n _logBuffer: (logger, type, buffer) =>\n @_log(logger, type, line) for line in buffer.toString().split(\"\\n\")\n```", "response": "this._log(log.warn, \"CLOSE\", [code, signal].join(', ')({\n _disconnect: () => {\n return this._log(log.info, \"DISCONNECT\");\n },\n _message: (message) => {\n return this._log(log.info, \"MESSAGE\", message);\n },\n _log: (logger, type, data) => {\n if (data) {\n return logger(`${this.file}:${type} - ${data}`);\n }\n },\n _logBuffer: (logger, type, buffer) => {\n var i, len, line, ref, results;\n ref = buffer.toString().split(\"\\n\");\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n line = ref[i];\n results.push(this._log(logger, type, line));\n }\n return results;\n }\n}));", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 51, "line_end": 63} +{"id": "mojotech/pioneer:src/support/Process.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis._log(log.warn, \"CLOSE\", [code, signal].join(', ')({\n _disconnect: () => {\n return this._log(log.info, \"DISCONNECT\");\n },\n _message: (message) => {\n return this._log(log.info, \"MESSAGE\", message);\n },\n _log: (logger, type, data) => {\n if (data) {\n return logger(`${this.file}:${type} - ${data}`);\n }\n },\n _logBuffer: (logger, type, buffer) => {\n var i, len, line, ref, results;\n ref = buffer.toString().split(\"\\n\");\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n line = ref[i];\n results.push(this._log(logger, type, line));\n }\n return results;\n }\n}));\n```", "response": "@_log log.warn, \"CLOSE\", [code, signal].join(', ')\n\n _disconnect: =>\n @_log log.info, \"DISCONNECT\"\n\n _message: (message) =>\n @_log log.info, \"MESSAGE\", message\n\n _log: (logger, type, data) =>\n logger \"#{@file}:#{type} - #{data}\" if data\n\n _logBuffer: (logger, type, buffer) =>\n @_log(logger, type, line) for line in buffer.toString().split(\"\\n\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 51, "line_end": 63} +{"id": "mojotech/pioneer:src/support/Process.coffee:2:completion", "type": "completion", "prompt": "@_log log.warn, \"CLOSE\", [code, signal].join(', ')\n\n _disconnect: =>\n @_log log.info, \"DISCONNECT\"\n\n _message: (message) =>", "response": "@_log log.info, \"MESSAGE\", message\n\n _log: (logger, type, data) =>\n logger \"#{@file}:#{type} - #{data}\" if data\n\n _logBuffer: (logger, type, buffer) =>\n @_log(logger, type, line) for line in buffer.toString().split(\"\\n\")", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "07e15b1ce0df989d461720e33b0bc29d12499ded", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/07e15b1ce0df989d461720e33b0bc29d12499ded/src/support/Process.coffee", "line_start": 51, "line_end": 63} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "02dd4b4deb2b4a732811805d815aaa4bfda17890", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/02dd4b4deb2b4a732811805d815aaa4bfda17890/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nlog = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>\n```", "response": "var log, spawn;\n\nlog = require('./logger');\n\nspawn = require('child_process').spawn;\n\nmodule.exports = function() {\n this.Processes = {};\n return this.Process = class Process {\n constructor(file, message, options = {}) {\n this.stop = this.stop.bind(this);\n this._stdout = this._stdout.bind(this);\n this._stderr = this._stderr.bind(this);\n this._exit = this._exit.bind(this);\n this._error = this._error.bind(this);\n this._close = this._close.bind(this);\n this.file = file;\n this.message = message;\n this.options = options;\n }\n\n start(...args) {\n if (!this._started) {\n this._started = $.defer();\n this._process = spawn('node', [this.file].concat(args));\n this._process.stdout.on('data', this._stdout);\n this._process.stderr.on('data', this._stderr);\n this._process.on('exit', this._exit);\n this._process.on('error', this._error);\n this._process.on('close', this._close);\n this._process.on('disconnect', this._disconnect);\n this._process.on('message', this._message);\n process.on('exit', this.stop);\n process.on('error', this.stop);\n }\n return this._started.promise;\n }\n\n stop() {\n if (this._process) {\n this._process.kill() && (this._process = null);\n }\n return $.fulfilled(!this._process);\n }\n\n _stdout(data) {\n this._logBuffer(log.info, \"STDOUT\", data);\n if (this._started.promise.isPending()) {\n if (~data.toString().indexOf(this.message)) {\n return this._started.fulfill();\n }\n }\n }\n\n _stderr(data) {\n return this._logBuffer(log.warn, \"STDERR\", data);\n }\n\n _exit(code, signal) {\n return this._log(log.error, \"EXIT\", [code, signal].join(', '));\n }\n\n _error(error) {\n return this._started.reject(error);\n }\n\n _close(code, signal) {}\n\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "02dd4b4deb2b4a732811805d815aaa4bfda17890", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/02dd4b4deb2b4a732811805d815aaa4bfda17890/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar log, spawn;\n\nlog = require('./logger');\n\nspawn = require('child_process').spawn;\n\nmodule.exports = function() {\n this.Processes = {};\n return this.Process = class Process {\n constructor(file, message, options = {}) {\n this.stop = this.stop.bind(this);\n this._stdout = this._stdout.bind(this);\n this._stderr = this._stderr.bind(this);\n this._exit = this._exit.bind(this);\n this._error = this._error.bind(this);\n this._close = this._close.bind(this);\n this.file = file;\n this.message = message;\n this.options = options;\n }\n\n start(...args) {\n if (!this._started) {\n this._started = $.defer();\n this._process = spawn('node', [this.file].concat(args));\n this._process.stdout.on('data', this._stdout);\n this._process.stderr.on('data', this._stderr);\n this._process.on('exit', this._exit);\n this._process.on('error', this._error);\n this._process.on('close', this._close);\n this._process.on('disconnect', this._disconnect);\n this._process.on('message', this._message);\n process.on('exit', this.stop);\n process.on('error', this.stop);\n }\n return this._started.promise;\n }\n\n stop() {\n if (this._process) {\n this._process.kill() && (this._process = null);\n }\n return $.fulfilled(!this._process);\n }\n\n _stdout(data) {\n this._logBuffer(log.info, \"STDOUT\", data);\n if (this._started.promise.isPending()) {\n if (~data.toString().indexOf(this.message)) {\n return this._started.fulfill();\n }\n }\n }\n\n _stderr(data) {\n return this._logBuffer(log.warn, \"STDERR\", data);\n }\n\n _exit(code, signal) {\n return this._log(log.error, \"EXIT\", [code, signal].join(', '));\n }\n\n _error(error) {\n return this._started.reject(error);\n }\n\n _close(code, signal) {}\n\n };\n};\n```", "response": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "02dd4b4deb2b4a732811805d815aaa4bfda17890", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/02dd4b4deb2b4a732811805d815aaa4bfda17890/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:completion", "type": "completion", "prompt": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n @options = options\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message", "response": "process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "02dd4b4deb2b4a732811805d815aaa4bfda17890", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/02dd4b4deb2b4a732811805d815aaa4bfda17890/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n _.extend(@options, options)\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nlog = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n _.extend(@options, options)\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>\n```", "response": "var log, spawn;\n\nlog = require('./logger');\n\nspawn = require('child_process').spawn;\n\nmodule.exports = function() {\n this.Processes = {};\n return this.Process = class Process {\n constructor(file, message, options = {}) {\n this.stop = this.stop.bind(this);\n this._stdout = this._stdout.bind(this);\n this._stderr = this._stderr.bind(this);\n this._exit = this._exit.bind(this);\n this._error = this._error.bind(this);\n this._close = this._close.bind(this);\n this.file = file;\n this.message = message;\n _.extend(this.options, options);\n }\n\n start(...args) {\n if (!this._started) {\n this._started = $.defer();\n this._process = spawn('node', [this.file].concat(args));\n this._process.stdout.on('data', this._stdout);\n this._process.stderr.on('data', this._stderr);\n this._process.on('exit', this._exit);\n this._process.on('error', this._error);\n this._process.on('close', this._close);\n this._process.on('disconnect', this._disconnect);\n this._process.on('message', this._message);\n process.on('exit', this.stop);\n process.on('error', this.stop);\n }\n return this._started.promise;\n }\n\n stop() {\n if (this._process) {\n this._process.kill() && (this._process = null);\n }\n return $.fulfilled(!this._process);\n }\n\n _stdout(data) {\n this._logBuffer(log.info, \"STDOUT\", data);\n if (this._started.promise.isPending()) {\n if (~data.toString().indexOf(this.message)) {\n return this._started.fulfill();\n }\n }\n }\n\n _stderr(data) {\n return this._logBuffer(log.warn, \"STDERR\", data);\n }\n\n _exit(code, signal) {\n return this._log(log.error, \"EXIT\", [code, signal].join(', '));\n }\n\n _error(error) {\n return this._started.reject(error);\n }\n\n _close(code, signal) {}\n\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar log, spawn;\n\nlog = require('./logger');\n\nspawn = require('child_process').spawn;\n\nmodule.exports = function() {\n this.Processes = {};\n return this.Process = class Process {\n constructor(file, message, options = {}) {\n this.stop = this.stop.bind(this);\n this._stdout = this._stdout.bind(this);\n this._stderr = this._stderr.bind(this);\n this._exit = this._exit.bind(this);\n this._error = this._error.bind(this);\n this._close = this._close.bind(this);\n this.file = file;\n this.message = message;\n _.extend(this.options, options);\n }\n\n start(...args) {\n if (!this._started) {\n this._started = $.defer();\n this._process = spawn('node', [this.file].concat(args));\n this._process.stdout.on('data', this._stdout);\n this._process.stderr.on('data', this._stderr);\n this._process.on('exit', this._exit);\n this._process.on('error', this._error);\n this._process.on('close', this._close);\n this._process.on('disconnect', this._disconnect);\n this._process.on('message', this._message);\n process.on('exit', this.stop);\n process.on('error', this.stop);\n }\n return this._started.promise;\n }\n\n stop() {\n if (this._process) {\n this._process.kill() && (this._process = null);\n }\n return $.fulfilled(!this._process);\n }\n\n _stdout(data) {\n this._logBuffer(log.info, \"STDOUT\", data);\n if (this._started.promise.isPending()) {\n if (~data.toString().indexOf(this.message)) {\n return this._started.fulfill();\n }\n }\n }\n\n _stderr(data) {\n return this._logBuffer(log.warn, \"STDERR\", data);\n }\n\n _exit(code, signal) {\n return this._log(log.error, \"EXIT\", [code, signal].join(', '));\n }\n\n _error(error) {\n return this._started.reject(error);\n }\n\n _close(code, signal) {}\n\n };\n};\n```", "response": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n _.extend(@options, options)\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message\n\n process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "mojotech/pioneer:src/support/Process.coffee:1:completion", "type": "completion", "prompt": "log = require('./logger')\nspawn = require('child_process').spawn\n\nmodule.exports = ->\n @Processes = {}\n\n class @Process\n constructor: (file, message, options = {}) ->\n @file = file\n @message = message\n _.extend(@options, options)\n\n start: (args...) ->\n unless @_started\n @_started = $.defer()\n @_process = spawn('node', [@file].concat(args))\n @_process.stdout.on 'data', @_stdout\n @_process.stderr.on 'data', @_stderr\n\n @_process.on 'exit', @_exit\n @_process.on 'error', @_error\n @_process.on 'close', @_close\n @_process.on 'disconnect', @_disconnect\n @_process.on 'message', @_message", "response": "process.on 'exit', @stop\n process.on 'error', @stop\n\n @_started.promise\n\n stop: =>\n @_process.kill() and (@_process = null) if @_process\n $.fulfilled(!@_process)\n\n _stdout: (data) =>\n @_logBuffer(log.info, \"STDOUT\", data)\n\n if @_started.promise.isPending()\n @_started.fulfill() if ~data.toString().indexOf(@message)\n\n _stderr: (data) =>\n @_logBuffer log.warn, \"STDERR\", data\n\n _exit: (code, signal) =>\n @_log log.error, \"EXIT\", [code, signal].join(', ')\n\n _error: (error) =>\n @_started.reject(error)\n\n _close: (code, signal) =>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mojotech/pioneer", "path": "src/support/Process.coffee", "license": "MIT", "commit": "e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9", "stars": 523, "source_url": "https://github.com/mojotech/pioneer/blob/e9fdc7a7ba2009bbc9b1ac7e53b8659124d901f9/src/support/Process.coffee", "line_start": 1, "line_end": 50} +{"id": "elving/swag:src/swag.logging.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'log', (value) ->\n console.log value\n, 'string|number|boolean|array|object'\n\nSwag.addHelper 'debug', (value) ->\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.logging.coffee", "line_start": 1, "line_end": 8} +{"id": "elving/swag:src/swag.logging.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.addHelper 'log', (value) ->\n console.log value\n, 'string|number|boolean|array|object'\n\nSwag.addHelper 'debug', (value) ->\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'\n```", "response": "Swag.addHelper('log', function(value) {\n return console.log(value);\n}, 'string|number|boolean|array|object');\n\nSwag.addHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.logging.coffee", "line_start": 1, "line_end": 8} +{"id": "elving/swag:src/swag.logging.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.addHelper('log', function(value) {\n return console.log(value);\n}, 'string|number|boolean|array|object');\n\nSwag.addHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});\n```", "response": "Swag.addHelper 'log', (value) ->\n console.log value\n, 'string|number|boolean|array|object'\n\nSwag.addHelper 'debug', (value) ->\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.logging.coffee", "line_start": 1, "line_end": 8} +{"id": "elving/swag:src/swag.logging.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'log', (value) ->\n console.log value\n, 'string|number|boolean|array|object'", "response": "Swag.addHelper 'debug', (value) ->\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.logging.coffee", "line_start": 1, "line_end": 8} +{"id": "elving/swag:src/swag.logging.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'log', (value) ->\n value = Utils.result value\n console.log value\n, 'string|number|boolean|array|object'\n\nSwag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.logging.coffee", "line_start": 1, "line_end": 10} +{"id": "elving/swag:src/swag.logging.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.addHelper 'log', (value) ->\n value = Utils.result value\n console.log value\n, 'string|number|boolean|array|object'\n\nSwag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'\n```", "response": "Swag.addHelper('log', function(value) {\n value = Utils.result(value);\n return console.log(value);\n}, 'string|number|boolean|array|object');\n\nSwag.addHelper('debug', function(value) {\n if (!Utils.isUndefined(value)) {\n value = Utils.result(value);\n }\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.logging.coffee", "line_start": 1, "line_end": 10} +{"id": "elving/swag:src/swag.logging.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.addHelper('log', function(value) {\n value = Utils.result(value);\n return console.log(value);\n}, 'string|number|boolean|array|object');\n\nSwag.addHelper('debug', function(value) {\n if (!Utils.isUndefined(value)) {\n value = Utils.result(value);\n }\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});\n```", "response": "Swag.addHelper 'log', (value) ->\n value = Utils.result value\n console.log value\n, 'string|number|boolean|array|object'\n\nSwag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.logging.coffee", "line_start": 1, "line_end": 10} +{"id": "elving/swag:src/swag.logging.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'log', (value) ->\n value = Utils.result value\n console.log value\n, 'string|number|boolean|array|object'", "response": "Swag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.logging.coffee", "line_start": 1, "line_end": 10} +{"id": "elving/swag:src/swag.logging.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'log', (value) ->\n unless Utils.isUndefined value\n value = Utils.result value\n console.log value\n else\n Utils.err '{{log}} takes one arguments (string|number|boolean|array|object).'\n\nSwag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.logging.coffee", "line_start": 1, "line_end": 12} +{"id": "elving/swag:src/swag.logging.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.addHelper 'log', (value) ->\n unless Utils.isUndefined value\n value = Utils.result value\n console.log value\n else\n Utils.err '{{log}} takes one arguments (string|number|boolean|array|object).'\n\nSwag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'\n```", "response": "Swag.addHelper('log', function(value) {\n if (!Utils.isUndefined(value)) {\n value = Utils.result(value);\n return console.log(value);\n } else {\n return Utils.err('{{log}} takes one arguments (string|number|boolean|array|object).');\n }\n});\n\nSwag.addHelper('debug', function(value) {\n if (!Utils.isUndefined(value)) {\n value = Utils.result(value);\n }\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.logging.coffee", "line_start": 1, "line_end": 12} +{"id": "elving/swag:src/swag.logging.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.addHelper('log', function(value) {\n if (!Utils.isUndefined(value)) {\n value = Utils.result(value);\n return console.log(value);\n } else {\n return Utils.err('{{log}} takes one arguments (string|number|boolean|array|object).');\n }\n});\n\nSwag.addHelper('debug', function(value) {\n if (!Utils.isUndefined(value)) {\n value = Utils.result(value);\n }\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});\n```", "response": "Swag.addHelper 'log', (value) ->\n unless Utils.isUndefined value\n value = Utils.result value\n console.log value\n else\n Utils.err '{{log}} takes one arguments (string|number|boolean|array|object).'\n\nSwag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.logging.coffee", "line_start": 1, "line_end": 12} +{"id": "elving/swag:src/swag.logging.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'log', (value) ->\n unless Utils.isUndefined value\n value = Utils.result value\n console.log value\n else\n Utils.err '{{log}} takes one arguments (string|number|boolean|array|object).'", "response": "Swag.addHelper 'debug', (value) ->\n value = Utils.result value unless Utils.isUndefined value\n console.log 'Context: ', this\n console.log 'Value: ', value unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.logging.coffee", "line_start": 1, "line_end": 12} +{"id": "elving/swag:src/swag.logging.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'log', (value) ->\n console.log value\n\nSwag.addHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.addHelper 'log', (value) ->\n console.log value\n\nSwag.addHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'\n```", "response": "Swag.addHelper('log', function(value) {\n return console.log(value);\n});\n\nSwag.addHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.addHelper('log', function(value) {\n return console.log(value);\n});\n\nSwag.addHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});\n```", "response": "Swag.addHelper 'log', (value) ->\n console.log value\n\nSwag.addHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'log', (value) ->\n console.log value", "response": "Swag.addHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.registerHelper 'log', (value) ->\n console.log value\n\nSwag.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.registerHelper 'log', (value) ->\n console.log value\n\nSwag.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'\n```", "response": "Swag.registerHelper('log', function(value) {\n return console.log(value);\n});\n\nSwag.registerHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.registerHelper('log', function(value) {\n return console.log(value);\n});\n\nSwag.registerHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});\n```", "response": "Swag.registerHelper 'log', (value) ->\n console.log value\n\nSwag.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:completion", "type": "completion", "prompt": "Swag.registerHelper 'log', (value) ->\n console.log value", "response": "Swag.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Handlebars.registerHelper 'log', (value) ->\n console.log value\n\nHandlebars.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1f0945b3e028e6481bd460e3ae65c5ab0236ca6e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1f0945b3e028e6481bd460e3ae65c5ab0236ca6e/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHandlebars.registerHelper 'log', (value) ->\n console.log value\n\nHandlebars.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'\n```", "response": "Handlebars.registerHelper('log', function(value) {\n return console.log(value);\n});\n\nHandlebars.registerHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1f0945b3e028e6481bd460e3ae65c5ab0236ca6e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1f0945b3e028e6481bd460e3ae65c5ab0236ca6e/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHandlebars.registerHelper('log', function(value) {\n return console.log(value);\n});\n\nHandlebars.registerHelper('debug', function(value) {\n console.log('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.log('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});\n```", "response": "Handlebars.registerHelper 'log', (value) ->\n console.log value\n\nHandlebars.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1f0945b3e028e6481bd460e3ae65c5ab0236ca6e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1f0945b3e028e6481bd460e3ae65c5ab0236ca6e/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:completion", "type": "completion", "prompt": "Handlebars.registerHelper 'log', (value) ->\n console.log value", "response": "Handlebars.registerHelper 'debug', (value) ->\n console.log 'Context: ', @\n console.log('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "1f0945b3e028e6481bd460e3ae65c5ab0236ca6e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1f0945b3e028e6481bd460e3ae65c5ab0236ca6e/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Handlebars.registerHelper 'log', (value) ->\n console.log value\n\nHandlebars.registerHelper 'debug', (value) ->\n console.debug 'Context: ', @\n console.debug('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHandlebars.registerHelper 'log', (value) ->\n console.log value\n\nHandlebars.registerHelper 'debug', (value) ->\n console.debug 'Context: ', @\n console.debug('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'\n```", "response": "Handlebars.registerHelper('log', function(value) {\n return console.log(value);\n});\n\nHandlebars.registerHelper('debug', function(value) {\n console.debug('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.debug('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHandlebars.registerHelper('log', function(value) {\n return console.log(value);\n});\n\nHandlebars.registerHelper('debug', function(value) {\n console.debug('Context: ', this);\n if (!Utils.isUndefined(value)) {\n console.debug('Value: ', value);\n }\n return console.log('-----------------------------------------------');\n});\n```", "response": "Handlebars.registerHelper 'log', (value) ->\n console.log value\n\nHandlebars.registerHelper 'debug', (value) ->\n console.debug 'Context: ', @\n console.debug('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "elving/swag:src/swag.logging.coffee:1:completion", "type": "completion", "prompt": "Handlebars.registerHelper 'log', (value) ->\n console.log value", "response": "Handlebars.registerHelper 'debug', (value) ->\n console.debug 'Context: ', @\n console.debug('Value: ', value) unless Utils.isUndefined value\n console.log '-----------------------------------------------'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.logging.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.logging.coffee", "line_start": 1, "line_end": 7} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "prepare = (done) ->\n async.auto\n prepare: app.prepare\n createGuestUser: app.createGuestUser\n , done\n\ndescribe 'Guest.Room#ReadOne', ->\n\n before prepare\n\n it 'should get the room info and nested team infomation', (done) ->\n options =\n method: 'get'\n url: 'guest/rooms/' + app.room1.guestToken\n request options, (err, res, room) ->\n room.should.have.properties 'team', 'topic'\n room.should.not.have.properties 'members', 'latestMessages'\n room.team.should.have.properties 'name'\n done err\n\n after clear\n\ndescribe 'Guest.Room#Join', ->\n\n before prepare\n\n it 'should join a room and get detail infomation of this room', (done) ->\n\n async.auto\n broadcast: (callback) ->\n app.broadcast = (room, event, data) ->\n hits = 0\n if event is 'room:join'\n hits |= 0b1\n data.should.have.properties 'name', 'avatarUrl', '_roomId'\n data._roomId.should.eql app.room1._id\n callback() if hits is 0b1\n join: (callback) -> # Join user2 to the room\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, (err, res, room) ->\n room.should.have.properties '_teamId', 'topic', 'members', 'latestMessages', 'unread'\n (room.members.some (member) -> member._id is app.user1._id).should.eql true\n room.members.forEach (member) -> member.should.not.have.properties 'email', 'mobile'\n callback err\n , done", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 6, "line_end": 55} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nprepare = (done) ->\n async.auto\n prepare: app.prepare\n createGuestUser: app.createGuestUser\n , done\n\ndescribe 'Guest.Room#ReadOne', ->\n\n before prepare\n\n it 'should get the room info and nested team infomation', (done) ->\n options =\n method: 'get'\n url: 'guest/rooms/' + app.room1.guestToken\n request options, (err, res, room) ->\n room.should.have.properties 'team', 'topic'\n room.should.not.have.properties 'members', 'latestMessages'\n room.team.should.have.properties 'name'\n done err\n\n after clear\n\ndescribe 'Guest.Room#Join', ->\n\n before prepare\n\n it 'should join a room and get detail infomation of this room', (done) ->\n\n async.auto\n broadcast: (callback) ->\n app.broadcast = (room, event, data) ->\n hits = 0\n if event is 'room:join'\n hits |= 0b1\n data.should.have.properties 'name', 'avatarUrl', '_roomId'\n data._roomId.should.eql app.room1._id\n callback() if hits is 0b1\n join: (callback) -> # Join user2 to the room\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, (err, res, room) ->\n room.should.have.properties '_teamId', 'topic', 'members', 'latestMessages', 'unread'\n (room.members.some (member) -> member._id is app.user1._id).should.eql true\n room.members.forEach (member) -> member.should.not.have.properties 'email', 'mobile'\n callback err\n , done\n```", "response": "var prepare;\n\nprepare = function(done) {\n return async.auto({\n prepare: app.prepare,\n createGuestUser: app.createGuestUser\n }, done);\n};\n\ndescribe('Guest.Room#ReadOne', function() {\n before(prepare);\n it('should get the room info and nested team infomation', function(done) {\n var options;\n options = {\n method: 'get',\n url: 'guest/rooms/' + app.room1.guestToken\n };\n return request(options, function(err, res, room) {\n room.should.have.properties('team', 'topic');\n room.should.not.have.properties('members', 'latestMessages');\n room.team.should.have.properties('name');\n return done(err);\n });\n });\n return after(clear);\n});\n\ndescribe('Guest.Room#Join', function() {\n before(prepare);\n return it('should join a room and get detail infomation of this room', function(done) {\n return async.auto({\n broadcast: function(callback) {\n return app.broadcast = function(room, event, data) {\n var hits;\n hits = 0;\n if (event === 'room:join') {\n hits |= 0b1;\n data.should.have.properties('name', 'avatarUrl', '_roomId');\n data._roomId.should.eql(app.room1._id);\n }\n if (hits === 0b1) {\n return callback();\n }\n };\n },\n join: function(callback) { // Join user2 to the room\n var options;\n options = {\n method: 'post',\n url: `guest/rooms/${app.room1.guestToken}/join`,\n body: JSON.stringify({\n _sessionUserId: app.guest1._id\n })\n };\n return request(options, function(err, res, room) {\n room.should.have.properties('_teamId', 'topic', 'members', 'latestMessages', 'unread');\n (room.members.some(function(member) {\n return member._id === app.user1._id;\n })).should.eql(true);\n room.members.forEach(function(member) {\n return member.should.not.have.properties('email', 'mobile');\n });\n return callback(err);\n });\n }\n }, done);\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 6, "line_end": 55} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar prepare;\n\nprepare = function(done) {\n return async.auto({\n prepare: app.prepare,\n createGuestUser: app.createGuestUser\n }, done);\n};\n\ndescribe('Guest.Room#ReadOne', function() {\n before(prepare);\n it('should get the room info and nested team infomation', function(done) {\n var options;\n options = {\n method: 'get',\n url: 'guest/rooms/' + app.room1.guestToken\n };\n return request(options, function(err, res, room) {\n room.should.have.properties('team', 'topic');\n room.should.not.have.properties('members', 'latestMessages');\n room.team.should.have.properties('name');\n return done(err);\n });\n });\n return after(clear);\n});\n\ndescribe('Guest.Room#Join', function() {\n before(prepare);\n return it('should join a room and get detail infomation of this room', function(done) {\n return async.auto({\n broadcast: function(callback) {\n return app.broadcast = function(room, event, data) {\n var hits;\n hits = 0;\n if (event === 'room:join') {\n hits |= 0b1;\n data.should.have.properties('name', 'avatarUrl', '_roomId');\n data._roomId.should.eql(app.room1._id);\n }\n if (hits === 0b1) {\n return callback();\n }\n };\n },\n join: function(callback) { // Join user2 to the room\n var options;\n options = {\n method: 'post',\n url: `guest/rooms/${app.room1.guestToken}/join`,\n body: JSON.stringify({\n _sessionUserId: app.guest1._id\n })\n };\n return request(options, function(err, res, room) {\n room.should.have.properties('_teamId', 'topic', 'members', 'latestMessages', 'unread');\n (room.members.some(function(member) {\n return member._id === app.user1._id;\n })).should.eql(true);\n room.members.forEach(function(member) {\n return member.should.not.have.properties('email', 'mobile');\n });\n return callback(err);\n });\n }\n }, done);\n });\n});\n```", "response": "prepare = (done) ->\n async.auto\n prepare: app.prepare\n createGuestUser: app.createGuestUser\n , done\n\ndescribe 'Guest.Room#ReadOne', ->\n\n before prepare\n\n it 'should get the room info and nested team infomation', (done) ->\n options =\n method: 'get'\n url: 'guest/rooms/' + app.room1.guestToken\n request options, (err, res, room) ->\n room.should.have.properties 'team', 'topic'\n room.should.not.have.properties 'members', 'latestMessages'\n room.team.should.have.properties 'name'\n done err\n\n after clear\n\ndescribe 'Guest.Room#Join', ->\n\n before prepare\n\n it 'should join a room and get detail infomation of this room', (done) ->\n\n async.auto\n broadcast: (callback) ->\n app.broadcast = (room, event, data) ->\n hits = 0\n if event is 'room:join'\n hits |= 0b1\n data.should.have.properties 'name', 'avatarUrl', '_roomId'\n data._roomId.should.eql app.room1._id\n callback() if hits is 0b1\n join: (callback) -> # Join user2 to the room\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, (err, res, room) ->\n room.should.have.properties '_teamId', 'topic', 'members', 'latestMessages', 'unread'\n (room.members.some (member) -> member._id is app.user1._id).should.eql true\n room.members.forEach (member) -> member.should.not.have.properties 'email', 'mobile'\n callback err\n , done", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 6, "line_end": 55} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:1:completion", "type": "completion", "prompt": "prepare = (done) ->\n async.auto\n prepare: app.prepare\n createGuestUser: app.createGuestUser\n , done\n\ndescribe 'Guest.Room#ReadOne', ->\n\n before prepare\n\n it 'should get the room info and nested team infomation', (done) ->\n options =\n method: 'get'\n url: 'guest/rooms/' + app.room1.guestToken\n request options, (err, res, room) ->\n room.should.have.properties 'team', 'topic'\n room.should.not.have.properties 'members', 'latestMessages'\n room.team.should.have.properties 'name'\n done err\n\n after clear\n\ndescribe 'Guest.Room#Join', ->", "response": "before prepare\n\n it 'should join a room and get detail infomation of this room', (done) ->\n\n async.auto\n broadcast: (callback) ->\n app.broadcast = (room, event, data) ->\n hits = 0\n if event is 'room:join'\n hits |= 0b1\n data.should.have.properties 'name', 'avatarUrl', '_roomId'\n data._roomId.should.eql app.room1._id\n callback() if hits is 0b1\n join: (callback) -> # Join user2 to the room\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, (err, res, room) ->\n room.should.have.properties '_teamId', 'topic', 'members', 'latestMessages', 'unread'\n (room.members.some (member) -> member._id is app.user1._id).should.eql true\n room.members.forEach (member) -> member.should.not.have.properties 'email', 'mobile'\n callback err\n , done", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 6, "line_end": 55} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "after clear\n\ndescribe 'Guest.Room#Leave', ->\n\n before prepare\n\n it 'should leave the room and recieve the history message email', (done) ->\n async.auto\n join: (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n setTimeout ->\n request options, callback\n , 1000\n # Create messages by user1\n createMessages: ['join', (callback) ->\n options =\n method: 'post'\n url: 'messages'\n body: JSON.stringify\n _sessionUserId: app.user1._id\n _roomId: app.room1._id\n body: 'Hello Guest'\n request options, callback\n ]\n leave: ['createMessages', (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1._id}/leave\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, callback\n ]\n mailer: (callback) ->\n app.mailer = (email) ->\n {messages, to} = email\n to.should.eql app.guest1.email\n messages.length.should.eql 1\n callback()\n , done\n\n after clear", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 56, "line_end": 100} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nafter clear\n\ndescribe 'Guest.Room#Leave', ->\n\n before prepare\n\n it 'should leave the room and recieve the history message email', (done) ->\n async.auto\n join: (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n setTimeout ->\n request options, callback\n , 1000\n # Create messages by user1\n createMessages: ['join', (callback) ->\n options =\n method: 'post'\n url: 'messages'\n body: JSON.stringify\n _sessionUserId: app.user1._id\n _roomId: app.room1._id\n body: 'Hello Guest'\n request options, callback\n ]\n leave: ['createMessages', (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1._id}/leave\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, callback\n ]\n mailer: (callback) ->\n app.mailer = (email) ->\n {messages, to} = email\n to.should.eql app.guest1.email\n messages.length.should.eql 1\n callback()\n , done\n\n after clear\n```", "response": "after(clear);\n\ndescribe('Guest.Room#Leave', function() {\n before(prepare);\n it('should leave the room and recieve the history message email', function(done) {\n return async.auto({\n join: function(callback) {\n var options;\n options = {\n method: 'post',\n url: `guest/rooms/${app.room1.guestToken}/join`,\n body: JSON.stringify({\n _sessionUserId: app.guest1._id\n })\n };\n return setTimeout(function() {\n return request(options, callback);\n }, 1000);\n },\n // Create messages by user1\n createMessages: [\n 'join',\n function(callback) {\n var options;\n options = {\n method: 'post',\n url: 'messages',\n body: JSON.stringify({\n _sessionUserId: app.user1._id,\n _roomId: app.room1._id,\n body: 'Hello Guest'\n })\n };\n return request(options,\n callback);\n }\n ],\n leave: [\n 'createMessages',\n function(callback) {\n var options;\n options = {\n method: 'post',\n url: `guest/rooms/${app.room1._id}/leave`,\n body: JSON.stringify({\n _sessionUserId: app.guest1._id\n })\n };\n return request(options,\n callback);\n }\n ],\n mailer: function(callback) {\n return app.mailer = function(email) {\n var messages, to;\n ({messages, to} = email);\n to.should.eql(app.guest1.email);\n messages.length.should.eql(1);\n return callback();\n };\n }\n }, done);\n });\n return after(clear);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 56, "line_end": 100} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nafter(clear);\n\ndescribe('Guest.Room#Leave', function() {\n before(prepare);\n it('should leave the room and recieve the history message email', function(done) {\n return async.auto({\n join: function(callback) {\n var options;\n options = {\n method: 'post',\n url: `guest/rooms/${app.room1.guestToken}/join`,\n body: JSON.stringify({\n _sessionUserId: app.guest1._id\n })\n };\n return setTimeout(function() {\n return request(options, callback);\n }, 1000);\n },\n // Create messages by user1\n createMessages: [\n 'join',\n function(callback) {\n var options;\n options = {\n method: 'post',\n url: 'messages',\n body: JSON.stringify({\n _sessionUserId: app.user1._id,\n _roomId: app.room1._id,\n body: 'Hello Guest'\n })\n };\n return request(options,\n callback);\n }\n ],\n leave: [\n 'createMessages',\n function(callback) {\n var options;\n options = {\n method: 'post',\n url: `guest/rooms/${app.room1._id}/leave`,\n body: JSON.stringify({\n _sessionUserId: app.guest1._id\n })\n };\n return request(options,\n callback);\n }\n ],\n mailer: function(callback) {\n return app.mailer = function(email) {\n var messages, to;\n ({messages, to} = email);\n to.should.eql(app.guest1.email);\n messages.length.should.eql(1);\n return callback();\n };\n }\n }, done);\n });\n return after(clear);\n});\n```", "response": "after clear\n\ndescribe 'Guest.Room#Leave', ->\n\n before prepare\n\n it 'should leave the room and recieve the history message email', (done) ->\n async.auto\n join: (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n setTimeout ->\n request options, callback\n , 1000\n # Create messages by user1\n createMessages: ['join', (callback) ->\n options =\n method: 'post'\n url: 'messages'\n body: JSON.stringify\n _sessionUserId: app.user1._id\n _roomId: app.room1._id\n body: 'Hello Guest'\n request options, callback\n ]\n leave: ['createMessages', (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1._id}/leave\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, callback\n ]\n mailer: (callback) ->\n app.mailer = (email) ->\n {messages, to} = email\n to.should.eql app.guest1.email\n messages.length.should.eql 1\n callback()\n , done\n\n after clear", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 56, "line_end": 100} +{"id": "jianliaoim/talk-os:talk-api2x/test/controllers/guest/room.coffee:2:completion", "type": "completion", "prompt": "after clear\n\ndescribe 'Guest.Room#Leave', ->\n\n before prepare\n\n it 'should leave the room and recieve the history message email', (done) ->\n async.auto\n join: (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1.guestToken}/join\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n setTimeout ->\n request options, callback\n , 1000\n # Create messages by user1\n createMessages: ['join', (callback) ->\n options =\n method: 'post'\n url: 'messages'", "response": "body: JSON.stringify\n _sessionUserId: app.user1._id\n _roomId: app.room1._id\n body: 'Hello Guest'\n request options, callback\n ]\n leave: ['createMessages', (callback) ->\n options =\n method: 'post'\n url: \"guest/rooms/#{app.room1._id}/leave\"\n body: JSON.stringify\n _sessionUserId: app.guest1._id\n request options, callback\n ]\n mailer: (callback) ->\n app.mailer = (email) ->\n {messages, to} = email\n to.should.eql app.guest1.email\n messages.length.should.eql 1\n callback()\n , done\n\n after clear", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/controllers/guest/room.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/controllers/guest/room.coffee", "line_start": 56, "line_end": 100} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "React = require 'react'\nhljs = require 'highlight.js/lib/highlight'\nImmutable = require 'immutable'\nPureRenderMixin = require 'react-addons-pure-render-mixin'\n\nreqwest = require '../util/reqwest'\n\nlang = require '../locales/lang'\n\nLoadingIndicator = React.createFactory require('react-lite-misc').LoadingIndicator\n\ndiv = React.createFactory 'div'\npre = React.createFactory 'pre'\ncode = React.createFactory 'code'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'file-text'\n mixins: [PureRenderMixin]\n\n propTypes:\n file: T.instanceOf(Immutable.Map)\n\n getInitialState: ->\n loading: true\n text: null\n\n componentDidMount: ->\n @loadTextContent()\n\n loadTextContent: ->\n # file server rejects X-Socket-Id, so bypass api.get\n # and X-Requested-With is added by reqwest by default\n reqwest\n url: @props.file.get('downloadUrl')\n method: 'get'\n type: 'text'\n success: (resp) =>\n # text, html, css and JSON supported\n @setState text: resp.responseText, loading: false\n error: (resp) =>\n failedText = \"#{lang.getText('text-download-failed')}: #{@props.file.get('fileName')}\"\n @setState text: failedText, loading: false\n\n renderCode: ->\n result = hljs.highlightAuto (@state.text or '')\n pre {},\n code\n className: result.language", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nReact = require 'react'\nhljs = require 'highlight.js/lib/highlight'\nImmutable = require 'immutable'\nPureRenderMixin = require 'react-addons-pure-render-mixin'\n\nreqwest = require '../util/reqwest'\n\nlang = require '../locales/lang'\n\nLoadingIndicator = React.createFactory require('react-lite-misc').LoadingIndicator\n\ndiv = React.createFactory 'div'\npre = React.createFactory 'pre'\ncode = React.createFactory 'code'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'file-text'\n mixins: [PureRenderMixin]\n\n propTypes:\n file: T.instanceOf(Immutable.Map)\n\n getInitialState: ->\n loading: true\n text: null\n\n componentDidMount: ->\n @loadTextContent()\n\n loadTextContent: ->\n # file server rejects X-Socket-Id, so bypass api.get\n # and X-Requested-With is added by reqwest by default\n reqwest\n url: @props.file.get('downloadUrl')\n method: 'get'\n type: 'text'\n success: (resp) =>\n # text, html, css and JSON supported\n @setState text: resp.responseText, loading: false\n error: (resp) =>\n failedText = \"#{lang.getText('text-download-failed')}: #{@props.file.get('fileName')}\"\n @setState text: failedText, loading: false\n\n renderCode: ->\n result = hljs.highlightAuto (@state.text or '')\n pre {},\n code\n className: result.language\n```", "response": "var Immutable, LoadingIndicator, PureRenderMixin, React, T, code, div, hljs, lang, pre, reqwest;\n\nReact = require('react');\n\nhljs = require('highlight.js/lib/highlight');\n\nImmutable = require('immutable');\n\nPureRenderMixin = require('react-addons-pure-render-mixin');\n\nreqwest = require('../util/reqwest');\n\nlang = require('../locales/lang');\n\nLoadingIndicator = React.createFactory(require('react-lite-misc').LoadingIndicator);\n\ndiv = React.createFactory('div');\n\npre = React.createFactory('pre');\n\ncode = React.createFactory('code');\n\nT = React.PropTypes;\n\nmodule.exports = React.createClass({\n displayName: 'file-text',\n mixins: [PureRenderMixin],\n propTypes: {\n file: T.instanceOf(Immutable.Map)\n },\n getInitialState: function() {\n return {\n loading: true,\n text: null\n };\n },\n componentDidMount: function() {\n return this.loadTextContent();\n },\n loadTextContent: function() {\n // file server rejects X-Socket-Id, so bypass api.get\n // and X-Requested-With is added by reqwest by default\n return reqwest({\n url: this.props.file.get('downloadUrl'),\n method: 'get',\n type: 'text',\n success: (resp) => {\n // text, html, css and JSON supported\n return this.setState({\n text: resp.responseText,\n loading: false\n });\n },\n error: (resp) => {\n var failedText;\n failedText = `${lang.getText('text-download-failed')}: ${this.props.file.get('fileName')}`;\n return this.setState({\n text: failedText,\n loading: false\n });\n }\n });\n },\n renderCode: function() {\n var result;\n result = hljs.highlightAuto(this.state.text || '');\n return pre({}, code({\n className: result.language\n }));\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Immutable, LoadingIndicator, PureRenderMixin, React, T, code, div, hljs, lang, pre, reqwest;\n\nReact = require('react');\n\nhljs = require('highlight.js/lib/highlight');\n\nImmutable = require('immutable');\n\nPureRenderMixin = require('react-addons-pure-render-mixin');\n\nreqwest = require('../util/reqwest');\n\nlang = require('../locales/lang');\n\nLoadingIndicator = React.createFactory(require('react-lite-misc').LoadingIndicator);\n\ndiv = React.createFactory('div');\n\npre = React.createFactory('pre');\n\ncode = React.createFactory('code');\n\nT = React.PropTypes;\n\nmodule.exports = React.createClass({\n displayName: 'file-text',\n mixins: [PureRenderMixin],\n propTypes: {\n file: T.instanceOf(Immutable.Map)\n },\n getInitialState: function() {\n return {\n loading: true,\n text: null\n };\n },\n componentDidMount: function() {\n return this.loadTextContent();\n },\n loadTextContent: function() {\n // file server rejects X-Socket-Id, so bypass api.get\n // and X-Requested-With is added by reqwest by default\n return reqwest({\n url: this.props.file.get('downloadUrl'),\n method: 'get',\n type: 'text',\n success: (resp) => {\n // text, html, css and JSON supported\n return this.setState({\n text: resp.responseText,\n loading: false\n });\n },\n error: (resp) => {\n var failedText;\n failedText = `${lang.getText('text-download-failed')}: ${this.props.file.get('fileName')}`;\n return this.setState({\n text: failedText,\n loading: false\n });\n }\n });\n },\n renderCode: function() {\n var result;\n result = hljs.highlightAuto(this.state.text || '');\n return pre({}, code({\n className: result.language\n }));\n }\n});\n```", "response": "React = require 'react'\nhljs = require 'highlight.js/lib/highlight'\nImmutable = require 'immutable'\nPureRenderMixin = require 'react-addons-pure-render-mixin'\n\nreqwest = require '../util/reqwest'\n\nlang = require '../locales/lang'\n\nLoadingIndicator = React.createFactory require('react-lite-misc').LoadingIndicator\n\ndiv = React.createFactory 'div'\npre = React.createFactory 'pre'\ncode = React.createFactory 'code'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'file-text'\n mixins: [PureRenderMixin]\n\n propTypes:\n file: T.instanceOf(Immutable.Map)\n\n getInitialState: ->\n loading: true\n text: null\n\n componentDidMount: ->\n @loadTextContent()\n\n loadTextContent: ->\n # file server rejects X-Socket-Id, so bypass api.get\n # and X-Requested-With is added by reqwest by default\n reqwest\n url: @props.file.get('downloadUrl')\n method: 'get'\n type: 'text'\n success: (resp) =>\n # text, html, css and JSON supported\n @setState text: resp.responseText, loading: false\n error: (resp) =>\n failedText = \"#{lang.getText('text-download-failed')}: #{@props.file.get('fileName')}\"\n @setState text: failedText, loading: false\n\n renderCode: ->\n result = hljs.highlightAuto (@state.text or '')\n pre {},\n code\n className: result.language", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:1:completion", "type": "completion", "prompt": "React = require 'react'\nhljs = require 'highlight.js/lib/highlight'\nImmutable = require 'immutable'\nPureRenderMixin = require 'react-addons-pure-render-mixin'\n\nreqwest = require '../util/reqwest'\n\nlang = require '../locales/lang'\n\nLoadingIndicator = React.createFactory require('react-lite-misc').LoadingIndicator\n\ndiv = React.createFactory 'div'\npre = React.createFactory 'pre'\ncode = React.createFactory 'code'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'file-text'\n mixins: [PureRenderMixin]\n\n propTypes:\n file: T.instanceOf(Immutable.Map)\n\n getInitialState: ->", "response": "loading: true\n text: null\n\n componentDidMount: ->\n @loadTextContent()\n\n loadTextContent: ->\n # file server rejects X-Socket-Id, so bypass api.get\n # and X-Requested-With is added by reqwest by default\n reqwest\n url: @props.file.get('downloadUrl')\n method: 'get'\n type: 'text'\n success: (resp) =>\n # text, html, css and JSON supported\n @setState text: resp.responseText, loading: false\n error: (resp) =>\n failedText = \"#{lang.getText('text-download-failed')}: #{@props.file.get('fileName')}\"\n @setState text: failedText, loading: false\n\n renderCode: ->\n result = hljs.highlightAuto (@state.text or '')\n pre {},\n code\n className: result.language", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "dangerouslySetInnerHTML:\n __html: result.value\n\n render: ->\n\n div className: 'file-text',\n if @state.loading\n LoadingIndicator()\n else\n div className: 'text-container',\n @renderCode()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 51, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndangerouslySetInnerHTML:\n __html: result.value\n\n render: ->\n\n div className: 'file-text',\n if @state.loading\n LoadingIndicator()\n else\n div className: 'text-container',\n @renderCode()\n```", "response": "({\n dangerouslySetInnerHTML: {\n __html: result.value\n },\n render: function() {\n return div({\n className: 'file-text'\n }, this.state.loading ? LoadingIndicator() : div({\n className: 'text-container'\n }, this.renderCode()));\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 51, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n dangerouslySetInnerHTML: {\n __html: result.value\n },\n render: function() {\n return div({\n className: 'file-text'\n }, this.state.loading ? LoadingIndicator() : div({\n className: 'text-container'\n }, this.renderCode()));\n }\n});\n```", "response": "dangerouslySetInnerHTML:\n __html: result.value\n\n render: ->\n\n div className: 'file-text',\n if @state.loading\n LoadingIndicator()\n else\n div className: 'text-container',\n @renderCode()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 51, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-web/client/app/file-text.coffee:2:completion", "type": "completion", "prompt": "dangerouslySetInnerHTML:\n __html: result.value\n\n render: ->", "response": "div className: 'file-text',\n if @state.loading\n LoadingIndicator()\n else\n div className: 'text-container',\n @renderCode()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/file-text.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/file-text.coffee", "line_start": 51, "line_end": 61} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).\n # `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpperCase() is \"XML\" and version is \"1.0\"\n return true\n\n return false", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).\n # `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpperCase() is \"XML\" and version is \"1.0\"\n return true\n\n return false\n```", "response": "// Implements the DOMImplementation interface\nvar XMLDOMImplementation;\n\nmodule.exports = XMLDOMImplementation = class XMLDOMImplementation {\n // Tests if the DOM implementation implements a specific feature.\n\n // `feature` The package name of the feature to test. In Level 1, the\n // legal values are \"HTML\" and \"XML\" (case-insensitive).\n // `version` This is the version number of the package name to test.\n // In Level 1, this is the string \"1.0\". If the version is\n // not specified, supporting any version of the feature will\n // cause the method to return true.\n hasFeature(feature, version) {\n if (feature.toUpperCase() === \"XML\" && version === \"1.0\") {\n return true;\n }\n return false;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Implements the DOMImplementation interface\nvar XMLDOMImplementation;\n\nmodule.exports = XMLDOMImplementation = class XMLDOMImplementation {\n // Tests if the DOM implementation implements a specific feature.\n\n // `feature` The package name of the feature to test. In Level 1, the\n // legal values are \"HTML\" and \"XML\" (case-insensitive).\n // `version` This is the version number of the package name to test.\n // In Level 1, this is the string \"1.0\". If the version is\n // not specified, supporting any version of the feature will\n // cause the method to return true.\n hasFeature(feature, version) {\n if (feature.toUpperCase() === \"XML\" && version === \"1.0\") {\n return true;\n }\n return false;\n }\n\n};\n```", "response": "# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).\n # `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpperCase() is \"XML\" and version is \"1.0\"\n return true\n\n return false", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:completion", "type": "completion", "prompt": "# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).", "response": "# `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpperCase() is \"XML\" and version is \"1.0\"\n return true\n\n return false", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "6f18c8edefd0f3ed1192e4129fb1b032b8c9918f", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/6f18c8edefd0f3ed1192e4129fb1b032b8c9918f/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).\n # `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpper() is \"XML\" and version is \"1.0\"\n return true\n\n return false", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).\n # `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpper() is \"XML\" and version is \"1.0\"\n return true\n\n return false\n```", "response": "// Implements the DOMImplementation interface\nvar XMLDOMImplementation;\n\nmodule.exports = XMLDOMImplementation = class XMLDOMImplementation {\n // Tests if the DOM implementation implements a specific feature.\n\n // `feature` The package name of the feature to test. In Level 1, the\n // legal values are \"HTML\" and \"XML\" (case-insensitive).\n // `version` This is the version number of the package name to test.\n // In Level 1, this is the string \"1.0\". If the version is\n // not specified, supporting any version of the feature will\n // cause the method to return true.\n hasFeature(feature, version) {\n if (feature.toUpper() === \"XML\" && version === \"1.0\") {\n return true;\n }\n return false;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Implements the DOMImplementation interface\nvar XMLDOMImplementation;\n\nmodule.exports = XMLDOMImplementation = class XMLDOMImplementation {\n // Tests if the DOM implementation implements a specific feature.\n\n // `feature` The package name of the feature to test. In Level 1, the\n // legal values are \"HTML\" and \"XML\" (case-insensitive).\n // `version` This is the version number of the package name to test.\n // In Level 1, this is the string \"1.0\". If the version is\n // not specified, supporting any version of the feature will\n // cause the method to return true.\n hasFeature(feature, version) {\n if (feature.toUpper() === \"XML\" && version === \"1.0\") {\n return true;\n }\n return false;\n }\n\n};\n```", "response": "# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).\n # `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpper() is \"XML\" and version is \"1.0\"\n return true\n\n return false", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "oozcitak/xmlbuilder-js:src/XMLDOMImplementation.coffee:1:completion", "type": "completion", "prompt": "# Implements the DOMImplementation interface\nmodule.exports = class XMLDOMImplementation\n\n\n # Tests if the DOM implementation implements a specific feature.\n #\n # `feature` The package name of the feature to test. In Level 1, the\n # legal values are \"HTML\" and \"XML\" (case-insensitive).", "response": "# `version` This is the version number of the package name to test.\n # In Level 1, this is the string \"1.0\". If the version is\n # not specified, supporting any version of the feature will\n # cause the method to return true.\n hasFeature: (feature, version) ->\n if feature.toUpper() is \"XML\" and version is \"1.0\"\n return true\n\n return false", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLDOMImplementation.coffee", "license": "MIT", "commit": "b3f243ffbeb47486162b212d976fe7e97918e6dc", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLDOMImplementation.coffee", "line_start": 1, "line_end": 17} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "xdescribe 'Actions: room', ->\n\n beforeEach ->\n @action = require 'actions/room'\n @api = require 'network/api'\n\n describe 'Method: fetch', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.readone, 'get').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.fetch(roomId)\n expect(@api.rooms.readone.get).toHaveBeenCalledWith config\n\n describe 'Method: roomJoin', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.join, 'post').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomJoin(roomId)\n expect(@api.rooms.join.post).toHaveBeenCalledWith config\n\n describe 'Method: roomLeave', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.leave, 'post').and.callThrough()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 1, "line_end": 39} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nxdescribe 'Actions: room', ->\n\n beforeEach ->\n @action = require 'actions/room'\n @api = require 'network/api'\n\n describe 'Method: fetch', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.readone, 'get').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.fetch(roomId)\n expect(@api.rooms.readone.get).toHaveBeenCalledWith config\n\n describe 'Method: roomJoin', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.join, 'post').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomJoin(roomId)\n expect(@api.rooms.join.post).toHaveBeenCalledWith config\n\n describe 'Method: roomLeave', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.leave, 'post').and.callThrough()\n```", "response": "xdescribe('Actions: room', function() {\n beforeEach(function() {\n this.action = require('actions/room');\n return this.api = require('network/api');\n });\n describe('Method: fetch', function() {\n return it('should call api', function() {\n var config, roomId, userStore;\n userStore = require('store/user');\n spyOn(userStore, 'get').and.returnValue({});\n spyOn(this.api.rooms.readone, 'get').and.callThrough();\n roomId = 1;\n config = {\n pathParams: {\n id: roomId\n }\n };\n this.action.fetch(roomId);\n return expect(this.api.rooms.readone.get).toHaveBeenCalledWith(config);\n });\n });\n describe('Method: roomJoin', function() {\n return it('should call api', function() {\n var config, roomId, userStore;\n userStore = require('store/user');\n spyOn(userStore, 'get').and.returnValue({});\n spyOn(this.api.rooms.join, 'post').and.callThrough();\n roomId = 1;\n config = {\n pathParams: {\n id: roomId\n }\n };\n this.action.roomJoin(roomId);\n return expect(this.api.rooms.join.post).toHaveBeenCalledWith(config);\n });\n });\n return describe('Method: roomLeave', function() {\n return it('should call api', function() {\n var userStore;\n userStore = require('store/user');\n spyOn(userStore, 'get').and.returnValue({});\n return spyOn(this.api.rooms.leave, 'post').and.callThrough();\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 1, "line_end": 39} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nxdescribe('Actions: room', function() {\n beforeEach(function() {\n this.action = require('actions/room');\n return this.api = require('network/api');\n });\n describe('Method: fetch', function() {\n return it('should call api', function() {\n var config, roomId, userStore;\n userStore = require('store/user');\n spyOn(userStore, 'get').and.returnValue({});\n spyOn(this.api.rooms.readone, 'get').and.callThrough();\n roomId = 1;\n config = {\n pathParams: {\n id: roomId\n }\n };\n this.action.fetch(roomId);\n return expect(this.api.rooms.readone.get).toHaveBeenCalledWith(config);\n });\n });\n describe('Method: roomJoin', function() {\n return it('should call api', function() {\n var config, roomId, userStore;\n userStore = require('store/user');\n spyOn(userStore, 'get').and.returnValue({});\n spyOn(this.api.rooms.join, 'post').and.callThrough();\n roomId = 1;\n config = {\n pathParams: {\n id: roomId\n }\n };\n this.action.roomJoin(roomId);\n return expect(this.api.rooms.join.post).toHaveBeenCalledWith(config);\n });\n });\n return describe('Method: roomLeave', function() {\n return it('should call api', function() {\n var userStore;\n userStore = require('store/user');\n spyOn(userStore, 'get').and.returnValue({});\n return spyOn(this.api.rooms.leave, 'post').and.callThrough();\n });\n });\n});\n```", "response": "xdescribe 'Actions: room', ->\n\n beforeEach ->\n @action = require 'actions/room'\n @api = require 'network/api'\n\n describe 'Method: fetch', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.readone, 'get').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.fetch(roomId)\n expect(@api.rooms.readone.get).toHaveBeenCalledWith config\n\n describe 'Method: roomJoin', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.join, 'post').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomJoin(roomId)\n expect(@api.rooms.join.post).toHaveBeenCalledWith config\n\n describe 'Method: roomLeave', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.leave, 'post').and.callThrough()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 1, "line_end": 39} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:1:completion", "type": "completion", "prompt": "xdescribe 'Actions: room', ->\n\n beforeEach ->\n @action = require 'actions/room'\n @api = require 'network/api'\n\n describe 'Method: fetch', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.readone, 'get').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.fetch(roomId)\n expect(@api.rooms.readone.get).toHaveBeenCalledWith config", "response": "describe 'Method: roomJoin', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.join, 'post').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomJoin(roomId)\n expect(@api.rooms.join.post).toHaveBeenCalledWith config\n\n describe 'Method: roomLeave', ->\n it 'should call api', ->\n userStore = require 'store/user'\n spyOn(userStore, 'get').and.returnValue {}\n spyOn(@api.rooms.leave, 'post').and.callThrough()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 1, "line_end": 39} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomLeave(roomId)\n expect(@api.rooms.leave.post).toHaveBeenCalledWith config\n\n describe 'Method: roomInvite', ->\n it 'should call api with email', ->\n spyOn(@api.rooms.invite, 'post').and.callThrough()\n\n roomId = 1\n email = 'test@example.com'\n config =\n pathParams:\n id: roomId\n data:\n email: email\n\n @action.roomInvite(roomId, email)\n expect(@api.rooms.invite.post).toHaveBeenCalledWith config\n\n it 'should call api with userId', ->\n spyOn(@api.rooms.invite, 'post').and.callThrough()\n\n roomId = 1\n userId = '123'\n config =\n pathParams:\n id: roomId\n data:\n _userId: userId\n\n @action.roomInvite(roomId, userId)\n expect(@api.rooms.invite.post).toHaveBeenCalledWith config\n\n describe 'Method: roomCreate', ->\n it 'should call api', ->\n spyOn(@api.rooms.create, 'post').and.callThrough()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 41, "line_end": 80} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:2:completion", "type": "completion", "prompt": "roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomLeave(roomId)\n expect(@api.rooms.leave.post).toHaveBeenCalledWith config\n\n describe 'Method: roomInvite', ->\n it 'should call api with email', ->\n spyOn(@api.rooms.invite, 'post').and.callThrough()\n\n roomId = 1\n email = 'test@example.com'\n config =\n pathParams:\n id: roomId\n data:\n email: email", "response": "@action.roomInvite(roomId, email)\n expect(@api.rooms.invite.post).toHaveBeenCalledWith config\n\n it 'should call api with userId', ->\n spyOn(@api.rooms.invite, 'post').and.callThrough()\n\n roomId = 1\n userId = '123'\n config =\n pathParams:\n id: roomId\n data:\n _userId: userId\n\n @action.roomInvite(roomId, userId)\n expect(@api.rooms.invite.post).toHaveBeenCalledWith config\n\n describe 'Method: roomCreate', ->\n it 'should call api', ->\n spyOn(@api.rooms.create, 'post').and.callThrough()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 41, "line_end": 80} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "data = {}\n config = data: data\n\n @action.roomCreate(data)\n expect(@api.rooms.create.post).toHaveBeenCalledWith config\n\n describe 'Method: roomRemove', ->\n it 'should call api', ->\n spyOn(@api.rooms.remove, 'delete').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomRemove(roomId)\n expect(@api.rooms.remove.delete).toHaveBeenCalledWith config\n\n describe 'Method: roomRemoveMember', ->\n it 'should call api', ->\n spyOn(@api.rooms.removemember, 'post').and.callThrough()\n\n data =\n _roomId: 1\n _userId: 2\n config =\n pathParams:\n id: data._roomId\n data:\n _userId: data._userId\n\n @action.roomRemoveMember(data)\n expect(@api.rooms.removemember.post).toHaveBeenCalledWith config\n\n describe 'Method: roomArchive', ->\n it 'should call api', ->\n spyOn(@api.rooms.archive, 'post').and.callThrough()\n\n roomId = 1\n isArchived = true\n config =\n pathParams:\n id: roomId\n data:\n isArchived: isArchived", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 82, "line_end": 126} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:3:completion", "type": "completion", "prompt": "data = {}\n config = data: data\n\n @action.roomCreate(data)\n expect(@api.rooms.create.post).toHaveBeenCalledWith config\n\n describe 'Method: roomRemove', ->\n it 'should call api', ->\n spyOn(@api.rooms.remove, 'delete').and.callThrough()\n\n roomId = 1\n config =\n pathParams:\n id: roomId\n\n @action.roomRemove(roomId)\n expect(@api.rooms.remove.delete).toHaveBeenCalledWith config\n\n describe 'Method: roomRemoveMember', ->\n it 'should call api', ->\n spyOn(@api.rooms.removemember, 'post').and.callThrough()", "response": "data =\n _roomId: 1\n _userId: 2\n config =\n pathParams:\n id: data._roomId\n data:\n _userId: data._userId\n\n @action.roomRemoveMember(data)\n expect(@api.rooms.removemember.post).toHaveBeenCalledWith config\n\n describe 'Method: roomArchive', ->\n it 'should call api', ->\n spyOn(@api.rooms.archive, 'post').and.callThrough()\n\n roomId = 1\n isArchived = true\n config =\n pathParams:\n id: roomId\n data:\n isArchived: isArchived", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 82, "line_end": 126} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@action.roomArchive(roomId, isArchived)\n expect(@api.rooms.archive.post).toHaveBeenCalledWith config\n\n describe 'Method: roomUpdate', ->\n it 'should call api', ->\n spyOn(@api.rooms.update, 'put').and.callThrough()\n\n roomId = 1\n data = {}\n config =\n pathParams:\n id: roomId\n data: data\n\n @action.roomUpdate(roomId, data)\n expect(@api.rooms.update.put).toHaveBeenCalledWith config\n\n describe 'Method: roomUpdateGuest', ->\n it 'should call api', ->\n spyOn(@api.rooms.guest, 'post').and.callThrough()\n\n roomId = 1\n enabled = true\n config =\n pathParams:\n id: roomId\n data:\n isGuestEnabled: enabled\n\n @action.roomUpdateGuest(roomId, enabled)\n expect(@api.rooms.guest.post).toHaveBeenCalledWith config", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 128, "line_end": 158} +{"id": "jianliaoim/talk-os:talk-web/test/spec/actions/room.spec.coffee:4:completion", "type": "completion", "prompt": "@action.roomArchive(roomId, isArchived)\n expect(@api.rooms.archive.post).toHaveBeenCalledWith config\n\n describe 'Method: roomUpdate', ->\n it 'should call api', ->\n spyOn(@api.rooms.update, 'put').and.callThrough()\n\n roomId = 1\n data = {}\n config =\n pathParams:\n id: roomId\n data: data\n\n @action.roomUpdate(roomId, data)", "response": "expect(@api.rooms.update.put).toHaveBeenCalledWith config\n\n describe 'Method: roomUpdateGuest', ->\n it 'should call api', ->\n spyOn(@api.rooms.guest, 'post').and.callThrough()\n\n roomId = 1\n enabled = true\n config =\n pathParams:\n id: roomId\n data:\n isGuestEnabled: enabled\n\n @action.roomUpdateGuest(roomId, enabled)\n expect(@api.rooms.guest.post).toHaveBeenCalledWith config", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/test/spec/actions/room.spec.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/room.spec.coffee", "line_start": 128, "line_end": 158} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n ### The configuration object ###\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n # base url that site lives on, e.g. '/blog/'\n baseUrl: '/'\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n _restartOnConfChange: true # restart preview server on config change\n\n constructor: (options={}) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n ### The configuration object ###\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from", "response": "views: null\n # built product goes here\n output: './build'\n # base url that site lives on, e.g. '/blog/'\n baseUrl: '/'\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n _restartOnConfChange: true # restart preview server on config change\n\n constructor: (options={}) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/config.coffee", "line_start": 51, "line_end": 69} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->", "response": "### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/config.coffee", "line_start": 51, "line_end": 69} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n ### The configuration object ###\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n # base url that site lives on, e.g. '/blog/'\n baseUrl: '/'\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options={}) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n ### The configuration object ###\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from", "response": "views: null\n # built product goes here\n output: './build'\n # base url that site lives on, e.g. '/blog/'\n baseUrl: '/'\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options={}) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe/src/core/config.coffee", "line_start": 51, "line_end": 68} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "response": "if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/17ca4e1c948e01ac7ffe3734c6c4b8c32751cbbe/src/core/config.coffee", "line_start": 51, "line_end": 68} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n # base url that site lives on, e.g. '/blog/'\n baseUrl: '/'\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n # base url that site lives on, e.g. '/blog/'\n baseUrl: '/'\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "(options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce/src/core/config.coffee", "line_start": 51, "line_end": 67} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "(options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "response": "if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/6f46a5bdc67fabcc8dc4b9fe07946e5794ca4bce/src/core/config.coffee", "line_start": 51, "line_end": 67} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n # base url that site lives on, e.g. '/blog' or 'http://myplace.net/'\n baseUrl: '/'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5bb1d241155512bdc2cf0187c38402106a24eb19", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5bb1d241155512bdc2cf0187c38402106a24eb19/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # modules/files loaded and added to locals, name: module\n require: {}\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n\n # base url that site lives on, e.g. '/blog' or 'http://myplace.net/'\n baseUrl: '/'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5bb1d241155512bdc2cf0187c38402106a24eb19", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5bb1d241155512bdc2cf0187c38402106a24eb19/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5bb1d241155512bdc2cf0187c38402106a24eb19", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5bb1d241155512bdc2cf0187c38402106a24eb19/src/core/config.coffee", "line_start": 51, "line_end": 70} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options\n config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->", "response": "### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5bb1d241155512bdc2cf0187c38402106a24eb19", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5bb1d241155512bdc2cf0187c38402106a24eb19/src/core/config.coffee", "line_start": 51, "line_end": 70} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n # base url that site lives on, e.g. '/blog' or 'http://myplace.net/'\n baseUrl: '/'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "745b4065488534ff898f1b90f08bbbe54f7856cf", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/745b4065488534ff898f1b90f08bbbe54f7856cf/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n\n # base url that site lives on, e.g. '/blog' or 'http://myplace.net/'\n baseUrl: '/'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "745b4065488534ff898f1b90f08bbbe54f7856cf", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/745b4065488534ff898f1b90f08bbbe54f7856cf/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "785ca18837741a3a5b3672b5c58e7cf8455352b6", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/785ca18837741a3a5b3672b5c58e7cf8455352b6/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n @defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of @constructor.defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "785ca18837741a3a5b3672b5c58e7cf8455352b6", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/785ca18837741a3a5b3672b5c58e7cf8455352b6/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "56a3b6e6a46c11d586a523ab430aecbe5f23c0aa", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/56a3b6e6a46c11d586a523ab430aecbe5f23c0aa/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n\n # preview server settings\n hostname: null # INADDR_ANY\n port: 8080\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "56a3b6e6a46c11d586a523ab430aecbe5f23c0aa", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/56a3b6e6a46c11d586a523ab430aecbe5f23c0aa/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "39b9d1036dc97dfe95191f6e1f3761574d14a834", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/39b9d1036dc97dfe95191f6e1f3761574d14a834/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n config = new Config options", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "39b9d1036dc97dfe95191f6e1f3761574d14a834", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/39b9d1036dc97dfe95191f6e1f3761574d14a834/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "39b9d1036dc97dfe95191f6e1f3761574d14a834", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/39b9d1036dc97dfe95191f6e1f3761574d14a834/src/core/config.coffee", "line_start": 51, "line_end": 65} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "config.__filename = path\n callback null, config\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path", "response": "throw new Error \"Config file at '#{ path }' does not exist.\"\n config = new Config readJSONSync path\n config.__filename = path\n return config\n\n### Exports ###\n\nmodule.exports = {Config}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "39b9d1036dc97dfe95191f6e1f3761574d14a834", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/39b9d1036dc97dfe95191f6e1f3761574d14a834/src/core/config.coffee", "line_start": 51, "line_end": 65} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "e54e60223d930ab008398327d7238e0cead4a115", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/e54e60223d930ab008398327d7238e0cead4a115/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n\n\n # options prefixed with _ are undocumented and should generally not be modified\n _fileLimit: 40 # max files to keep open at once\n\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "e54e60223d930ab008398327d7238e0cead4a115", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/e54e60223d930ab008398327d7238e0cead4a115/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "e54e60223d930ab008398327d7238e0cead4a115", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/e54e60223d930ab008398327d7238e0cead4a115/src/core/config.coffee", "line_start": 51, "line_end": 61} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path", "response": "throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "e54e60223d930ab008398327d7238e0cead4a115", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/e54e60223d930ab008398327d7238e0cead4a115/src/core/config.coffee", "line_start": 51, "line_end": 61} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n\n # max files to keep open at once\n fileLimit: 100\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n\n # max files to keep open at once\n fileLimit: 100\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n```", "response": "/* config.coffee */\nvar Config, async, fileExists, fileExistsSync, fs, path, readJSON, readJSONSync;\n\nfs = require('fs');\n\npath = require('path');\n\nasync = require('async');\n\n({readJSON, readJSONSync, fileExists, fileExistsSync} = require('./utils'));\n\nConfig = (function() {\n var defaults;\n\n class Config {\n constructor(options) {\n var defaultValue, option, value;\n for (option in options) {\n value = options[option];\n this[option] = value;\n }\n for (option in defaults) {\n defaultValue = defaults[option];\n if (this[option] == null) {\n this[option] = defaultValue;\n }\n }\n }\n\n };\n\n defaults = {\n // path to the directory containing content's to be scanned\n contents: './contents',\n // list of glob patterns to ignore\n ignore: [],\n // context variables, passed to views/templates\n locals: {},\n // list of modules/files to load as plugins\n plugins: [],\n // list of modules/files loaded and added to locals\n require: [],\n // path to the directory containing the templates\n templates: './templates',\n // directory to load custom views from\n views: null,\n // built product goes here\n output: './build',\n // max files to keep open at once\n fileLimit: 100\n };\n\n return Config;\n\n}).call(this);\n\nConfig.fromFile = function(path, callback) {\n /* Read config from *path* as JSON and *callback* with a Config instance. */\n return async.waterfall([\n function(callback) {\n return fileExists(path,\n function(exists) {\n if (exists) {\n return readJSON(path,\n callback);\n } else {\n return callback(new Error(`Config file at '${path}' does not exist.`));\n }\n });\n },\n function(options,\n callback) {\n return callback(null,\n new Config(options));\n }\n ], callback);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/* config.coffee */\nvar Config, async, fileExists, fileExistsSync, fs, path, readJSON, readJSONSync;\n\nfs = require('fs');\n\npath = require('path');\n\nasync = require('async');\n\n({readJSON, readJSONSync, fileExists, fileExistsSync} = require('./utils'));\n\nConfig = (function() {\n var defaults;\n\n class Config {\n constructor(options) {\n var defaultValue, option, value;\n for (option in options) {\n value = options[option];\n this[option] = value;\n }\n for (option in defaults) {\n defaultValue = defaults[option];\n if (this[option] == null) {\n this[option] = defaultValue;\n }\n }\n }\n\n };\n\n defaults = {\n // path to the directory containing content's to be scanned\n contents: './contents',\n // list of glob patterns to ignore\n ignore: [],\n // context variables, passed to views/templates\n locals: {},\n // list of modules/files to load as plugins\n plugins: [],\n // list of modules/files loaded and added to locals\n require: [],\n // path to the directory containing the templates\n templates: './templates',\n // directory to load custom views from\n views: null,\n // built product goes here\n output: './build',\n // max files to keep open at once\n fileLimit: 100\n };\n\n return Config;\n\n}).call(this);\n\nConfig.fromFile = function(path, callback) {\n /* Read config from *path* as JSON and *callback* with a Config instance. */\n return async.waterfall([\n function(callback) {\n return fileExists(path,\n function(exists) {\n if (exists) {\n return readJSON(path,\n callback);\n } else {\n return callback(new Error(`Config file at '${path}' does not exist.`));\n }\n });\n },\n function(options,\n callback) {\n return callback(null,\n new Config(options));\n }\n ], callback);\n};\n```", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n\n # max files to keep open at once\n fileLimit: 100\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null", "response": "# built product goes here\n output: './build'\n\n\n # max files to keep open at once\n fileLimit: 100\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Config.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 51, "line_end": 60} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config\n```", "response": "Config.fromFileSync = function(path) {\n /* Read config from *path* as JSON return a Config instance. */\n if (!fileExistsSync(path)) {\n throw new Error(`Config file at '${path}' does not exist.`);\n }\n return new Config(readJSONSync(path));\n};\n\n/* Exports */\nexports.Config = Config;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 51, "line_end": 60} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nConfig.fromFileSync = function(path) {\n /* Read config from *path* as JSON return a Config instance. */\n if (!fileExistsSync(path)) {\n throw new Error(`Config file at '${path}' does not exist.`);\n }\n return new Config(readJSONSync(path));\n};\n\n/* Exports */\nexports.Config = Config;\n```", "response": "Config.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 51, "line_end": 60} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "Config.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"", "response": "return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "020ec92b2a97605462720fbc65f38f7ed77aa672", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/020ec92b2a97605462720fbc65f38f7ed77aa672/src/core/config.coffee", "line_start": 51, "line_end": 60} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n```", "response": "/* config.coffee */\nvar Config, async, fileExists, fileExistsSync, fs, path, readJSON, readJSONSync;\n\nfs = require('fs');\n\npath = require('path');\n\nasync = require('async');\n\n({readJSON, readJSONSync, fileExists, fileExistsSync} = require('./utils'));\n\nconsole.log(fileExistsSync);\n\nConfig = (function() {\n var defaults;\n\n class Config {\n constructor(options) {\n var defaultValue, option, value;\n for (option in options) {\n value = options[option];\n this[option] = value;\n }\n for (option in defaults) {\n defaultValue = defaults[option];\n if (this[option] == null) {\n this[option] = defaultValue;\n }\n }\n }\n\n };\n\n defaults = {\n // path to the directory containing content's to be scanned\n contents: './contents',\n // list of glob patterns to ignore\n ignore: [],\n // context variables, passed to views/templates\n locals: {},\n // list of modules/files to load as plugins\n plugins: [],\n // list of modules/files loaded and added to locals\n require: [],\n // path to the directory containing the templates\n templates: './templates',\n // directory to load custom views from\n views: null,\n // built product goes here\n output: './build'\n };\n\n return Config;\n\n}).call(this);\n\nConfig.fromFile = function(path, callback) {\n /* Read config from *path* as JSON and *callback* with a Config instance. */\n return async.waterfall([\n function(callback) {\n return fileExists(path,\n function(exists) {\n if (exists) {\n return readJSON(path,\n callback);\n } else {\n return callback(new Error(`Config file at '${path}' does not exist.`));\n }\n });\n },\n function(options,\n callback) {\n return callback(null,\n new Config(options));\n }\n ], callback);\n};\n\nConfig.fromFileSync = function(path) {};\n\n/* Read config from *path* as JSON return a Config instance. */", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/* config.coffee */\nvar Config, async, fileExists, fileExistsSync, fs, path, readJSON, readJSONSync;\n\nfs = require('fs');\n\npath = require('path');\n\nasync = require('async');\n\n({readJSON, readJSONSync, fileExists, fileExistsSync} = require('./utils'));\n\nconsole.log(fileExistsSync);\n\nConfig = (function() {\n var defaults;\n\n class Config {\n constructor(options) {\n var defaultValue, option, value;\n for (option in options) {\n value = options[option];\n this[option] = value;\n }\n for (option in defaults) {\n defaultValue = defaults[option];\n if (this[option] == null) {\n this[option] = defaultValue;\n }\n }\n }\n\n };\n\n defaults = {\n // path to the directory containing content's to be scanned\n contents: './contents',\n // list of glob patterns to ignore\n ignore: [],\n // context variables, passed to views/templates\n locals: {},\n // list of modules/files to load as plugins\n plugins: [],\n // list of modules/files loaded and added to locals\n require: [],\n // path to the directory containing the templates\n templates: './templates',\n // directory to load custom views from\n views: null,\n // built product goes here\n output: './build'\n };\n\n return Config;\n\n}).call(this);\n\nConfig.fromFile = function(path, callback) {\n /* Read config from *path* as JSON and *callback* with a Config instance. */\n return async.waterfall([\n function(callback) {\n return fileExists(path,\n function(exists) {\n if (exists) {\n return readJSON(path,\n callback);\n } else {\n return callback(new Error(`Config file at '${path}' does not exist.`));\n }\n });\n },\n function(options,\n callback) {\n return callback(null,\n new Config(options));\n }\n ], callback);\n};\n\nConfig.fromFileSync = function(path) {};\n\n/* Read config from *path* as JSON return a Config instance. */\n```", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: null\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from", "response": "views: null\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 51, "line_end": 57} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config\n```", "response": "if (!fileExistsSync(path)) {\n throw new Error(`Config file at '${path}' does not exist.`);\n}\n\nreturn new Config(readJSONSync(path));\n\n/* Exports */\nexports.Config = Config;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 51, "line_end": 57} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (!fileExistsSync(path)) {\n throw new Error(`Config file at '${path}' does not exist.`);\n}\n\nreturn new Config(readJSONSync(path));\n\n/* Exports */\nexports.Config = Config;\n```", "response": "if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path\n\n### Exports ###\n\nexports.Config = Config", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 51, "line_end": 57} +{"id": "jnordberg/wintersmith:src/core/config.coffee:2:completion", "type": "completion", "prompt": "if not fileExistsSync path\n throw new Error \"Config file at '#{ path }' does not exist.\"\n return new Config readJSONSync path", "response": "### Exports ###\n\nexports.Config = Config", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "5ccd1fc28ab1be1774e7bce58d78af553b635b23", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/5ccd1fc28ab1be1774e7bce58d78af553b635b23/src/core/config.coffee", "line_start": 51, "line_end": 57} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: './views'\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "1cad02556f9f384086b05d7d914be5dcacc13294", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: './views'\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###\n```", "response": "/* config.coffee */\nvar Config, async, fileExists, fileExistsSync, fs, path, readJSON, readJSONSync;\n\nfs = require('fs');\n\npath = require('path');\n\nasync = require('async');\n\n({readJSON, readJSONSync, fileExists, fileExistsSync} = require('./utils'));\n\nconsole.log(fileExistsSync);\n\nConfig = (function() {\n var defaults;\n\n class Config {\n constructor(options) {\n var defaultValue, option, value;\n for (option in options) {\n value = options[option];\n this[option] = value;\n }\n for (option in defaults) {\n defaultValue = defaults[option];\n if (this[option] == null) {\n this[option] = defaultValue;\n }\n }\n }\n\n };\n\n defaults = {\n // path to the directory containing content's to be scanned\n contents: './contents',\n // list of glob patterns to ignore\n ignore: [],\n // context variables, passed to views/templates\n locals: {},\n // list of modules/files to load as plugins\n plugins: [],\n // list of modules/files loaded and added to locals\n require: [],\n // path to the directory containing the templates\n templates: './templates',\n // directory to load custom views from\n views: './views',\n // built product goes here\n output: './build'\n };\n\n return Config;\n\n}).call(this);\n\nConfig.fromFile = function(path, callback) {\n /* Read config from *path* as JSON and *callback* with a Config instance. */\n return async.waterfall([\n function(callback) {\n return fileExists(path,\n function(exists) {\n if (exists) {\n return readJSON(path,\n callback);\n } else {\n return callback(new Error(`Config file at '${path}' does not exist.`));\n }\n });\n },\n function(options,\n callback) {\n return callback(null,\n new Config(options));\n }\n ], callback);\n};\n\nConfig.fromFileSync = function(path) {};\n\n/* Read config from *path* as JSON return a Config instance. */", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "1cad02556f9f384086b05d7d914be5dcacc13294", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/* config.coffee */\nvar Config, async, fileExists, fileExistsSync, fs, path, readJSON, readJSONSync;\n\nfs = require('fs');\n\npath = require('path');\n\nasync = require('async');\n\n({readJSON, readJSONSync, fileExists, fileExistsSync} = require('./utils'));\n\nconsole.log(fileExistsSync);\n\nConfig = (function() {\n var defaults;\n\n class Config {\n constructor(options) {\n var defaultValue, option, value;\n for (option in options) {\n value = options[option];\n this[option] = value;\n }\n for (option in defaults) {\n defaultValue = defaults[option];\n if (this[option] == null) {\n this[option] = defaultValue;\n }\n }\n }\n\n };\n\n defaults = {\n // path to the directory containing content's to be scanned\n contents: './contents',\n // list of glob patterns to ignore\n ignore: [],\n // context variables, passed to views/templates\n locals: {},\n // list of modules/files to load as plugins\n plugins: [],\n // list of modules/files loaded and added to locals\n require: [],\n // path to the directory containing the templates\n templates: './templates',\n // directory to load custom views from\n views: './views',\n // built product goes here\n output: './build'\n };\n\n return Config;\n\n}).call(this);\n\nConfig.fromFile = function(path, callback) {\n /* Read config from *path* as JSON and *callback* with a Config instance. */\n return async.waterfall([\n function(callback) {\n return fileExists(path,\n function(exists) {\n if (exists) {\n return readJSON(path,\n callback);\n } else {\n return callback(new Error(`Config file at '${path}' does not exist.`));\n }\n });\n },\n function(options,\n callback) {\n return callback(null,\n new Config(options));\n }\n ], callback);\n};\n\nConfig.fromFileSync = function(path) {};\n\n/* Read config from *path* as JSON return a Config instance. */\n```", "response": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from\n views: './views'\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "1cad02556f9f384086b05d7d914be5dcacc13294", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "jnordberg/wintersmith:src/core/config.coffee:1:completion", "type": "completion", "prompt": "### config.coffee ###\n\nfs = require 'fs'\npath = require 'path'\nasync = require 'async'\n\n{readJSON, readJSONSync, fileExists, fileExistsSync} = require './utils'\nconsole.log fileExistsSync\n\nclass Config\n\n defaults =\n # path to the directory containing content's to be scanned\n contents: './contents'\n # list of glob patterns to ignore\n ignore: []\n # context variables, passed to views/templates\n locals: {}\n # list of modules/files to load as plugins\n plugins: []\n # list of modules/files loaded and added to locals\n require: []\n # path to the directory containing the templates\n templates: './templates'\n # directory to load custom views from", "response": "views: './views'\n # built product goes here\n output: './build'\n\n constructor: (options) ->\n for option, value of options\n this[option] = value\n for option, defaultValue of defaults\n this[option] ?= defaultValue\n\nConfig.fromFile = (path, callback) ->\n ### Read config from *path* as JSON and *callback* with a Config instance. ###\n async.waterfall [\n (callback) ->\n fileExists path, (exists) ->\n if exists\n readJSON path, callback\n else\n callback new Error \"Config file at '#{ path }' does not exist.\"\n (options, callback) ->\n callback null, new Config options\n ], callback\n\nConfig.fromFileSync = (path) ->\n ### Read config from *path* as JSON return a Config instance. ###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/config.coffee", "license": "MIT", "commit": "1cad02556f9f384086b05d7d914be5dcacc13294", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1cad02556f9f384086b05d7d914be5dcacc13294/src/core/config.coffee", "line_start": 1, "line_end": 50} +{"id": "HubSpot/BuckyClient:spitfire.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "hubspot.define 'hubspot.bucky.spitfire', ['_', 'hubspot.bucky.client', 'hubspot.spitfire.client'], (_, Bucky, Spitfire) ->\n monitor = (root='requests') ->\n Spitfire.on 'failure', ->\n Bucky.count \"#{ root }.spitfire.failure\"\n\n Spitfire.on 'success', ->\n Bucky.count \"#{ root }.spitfire.success\"\n\n Spitfire.on 'resolve', ({deferred, timing, resp, options}) ->\n url = Bucky.requests.getFullUrl options.url\n key = Bucky.requests.urlToKey url, (options.type or 'GET'), root\n\n Bucky.timer.send key, (timing.complete - timing.enqueue)\n Bucky.timer.send \"#{ key }.queued\", (timing.request - timing.enqueue)\n Bucky.timer.send \"#{ key }.pending\", (timing.complete - timing.request)\n Bucky.timer.send \"#{ key }.latency\", (timing.complete - timing.request - resp.headers['x-spitfire-duration'])\n\n Bucky.count \"#{ key }.#{ resp.status }\"\n Bucky.count \"#{ key }.spitfire\"\n\n {monitor}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "spitfire.coffee", "license": "MIT", "commit": "7113752556335b6d99201520be92bada2abe2e19", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/7113752556335b6d99201520be92bada2abe2e19/spitfire.coffee", "line_start": 1, "line_end": 21} +{"id": "HubSpot/BuckyClient:spitfire.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nhubspot.define 'hubspot.bucky.spitfire', ['_', 'hubspot.bucky.client', 'hubspot.spitfire.client'], (_, Bucky, Spitfire) ->\n monitor = (root='requests') ->\n Spitfire.on 'failure', ->\n Bucky.count \"#{ root }.spitfire.failure\"\n\n Spitfire.on 'success', ->\n Bucky.count \"#{ root }.spitfire.success\"\n\n Spitfire.on 'resolve', ({deferred, timing, resp, options}) ->\n url = Bucky.requests.getFullUrl options.url\n key = Bucky.requests.urlToKey url, (options.type or 'GET'), root\n\n Bucky.timer.send key, (timing.complete - timing.enqueue)\n Bucky.timer.send \"#{ key }.queued\", (timing.request - timing.enqueue)\n Bucky.timer.send \"#{ key }.pending\", (timing.complete - timing.request)\n Bucky.timer.send \"#{ key }.latency\", (timing.complete - timing.request - resp.headers['x-spitfire-duration'])\n\n Bucky.count \"#{ key }.#{ resp.status }\"\n Bucky.count \"#{ key }.spitfire\"\n\n {monitor}\n```", "response": "hubspot.define('hubspot.bucky.spitfire', ['_', 'hubspot.bucky.client', 'hubspot.spitfire.client'], function(_, Bucky, Spitfire) {\n var monitor;\n monitor = function(root = 'requests') {\n Spitfire.on('failure', function() {\n return Bucky.count(`${root}.spitfire.failure`);\n });\n Spitfire.on('success', function() {\n return Bucky.count(`${root}.spitfire.success`);\n });\n return Spitfire.on('resolve', function({deferred, timing, resp, options}) {\n var key, url;\n url = Bucky.requests.getFullUrl(options.url);\n key = Bucky.requests.urlToKey(url, options.type || 'GET', root);\n Bucky.timer.send(key, timing.complete - timing.enqueue);\n Bucky.timer.send(`${key}.queued`, timing.request - timing.enqueue);\n Bucky.timer.send(`${key}.pending`, timing.complete - timing.request);\n Bucky.timer.send(`${key}.latency`, timing.complete - timing.request - resp.headers['x-spitfire-duration']);\n Bucky.count(`${key}.${resp.status}`);\n return Bucky.count(`${key}.spitfire`);\n });\n };\n return {monitor};\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "HubSpot/BuckyClient", "path": "spitfire.coffee", "license": "MIT", "commit": "7113752556335b6d99201520be92bada2abe2e19", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/7113752556335b6d99201520be92bada2abe2e19/spitfire.coffee", "line_start": 1, "line_end": 21} +{"id": "HubSpot/BuckyClient:spitfire.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nhubspot.define('hubspot.bucky.spitfire', ['_', 'hubspot.bucky.client', 'hubspot.spitfire.client'], function(_, Bucky, Spitfire) {\n var monitor;\n monitor = function(root = 'requests') {\n Spitfire.on('failure', function() {\n return Bucky.count(`${root}.spitfire.failure`);\n });\n Spitfire.on('success', function() {\n return Bucky.count(`${root}.spitfire.success`);\n });\n return Spitfire.on('resolve', function({deferred, timing, resp, options}) {\n var key, url;\n url = Bucky.requests.getFullUrl(options.url);\n key = Bucky.requests.urlToKey(url, options.type || 'GET', root);\n Bucky.timer.send(key, timing.complete - timing.enqueue);\n Bucky.timer.send(`${key}.queued`, timing.request - timing.enqueue);\n Bucky.timer.send(`${key}.pending`, timing.complete - timing.request);\n Bucky.timer.send(`${key}.latency`, timing.complete - timing.request - resp.headers['x-spitfire-duration']);\n Bucky.count(`${key}.${resp.status}`);\n return Bucky.count(`${key}.spitfire`);\n });\n };\n return {monitor};\n});\n```", "response": "hubspot.define 'hubspot.bucky.spitfire', ['_', 'hubspot.bucky.client', 'hubspot.spitfire.client'], (_, Bucky, Spitfire) ->\n monitor = (root='requests') ->\n Spitfire.on 'failure', ->\n Bucky.count \"#{ root }.spitfire.failure\"\n\n Spitfire.on 'success', ->\n Bucky.count \"#{ root }.spitfire.success\"\n\n Spitfire.on 'resolve', ({deferred, timing, resp, options}) ->\n url = Bucky.requests.getFullUrl options.url\n key = Bucky.requests.urlToKey url, (options.type or 'GET'), root\n\n Bucky.timer.send key, (timing.complete - timing.enqueue)\n Bucky.timer.send \"#{ key }.queued\", (timing.request - timing.enqueue)\n Bucky.timer.send \"#{ key }.pending\", (timing.complete - timing.request)\n Bucky.timer.send \"#{ key }.latency\", (timing.complete - timing.request - resp.headers['x-spitfire-duration'])\n\n Bucky.count \"#{ key }.#{ resp.status }\"\n Bucky.count \"#{ key }.spitfire\"\n\n {monitor}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "spitfire.coffee", "license": "MIT", "commit": "7113752556335b6d99201520be92bada2abe2e19", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/7113752556335b6d99201520be92bada2abe2e19/spitfire.coffee", "line_start": 1, "line_end": 21} +{"id": "HubSpot/BuckyClient:spitfire.coffee:1:completion", "type": "completion", "prompt": "hubspot.define 'hubspot.bucky.spitfire', ['_', 'hubspot.bucky.client', 'hubspot.spitfire.client'], (_, Bucky, Spitfire) ->\n monitor = (root='requests') ->\n Spitfire.on 'failure', ->\n Bucky.count \"#{ root }.spitfire.failure\"\n\n Spitfire.on 'success', ->\n Bucky.count \"#{ root }.spitfire.success\"\n\n Spitfire.on 'resolve', ({deferred, timing, resp, options}) ->\n url = Bucky.requests.getFullUrl options.url", "response": "key = Bucky.requests.urlToKey url, (options.type or 'GET'), root\n\n Bucky.timer.send key, (timing.complete - timing.enqueue)\n Bucky.timer.send \"#{ key }.queued\", (timing.request - timing.enqueue)\n Bucky.timer.send \"#{ key }.pending\", (timing.complete - timing.request)\n Bucky.timer.send \"#{ key }.latency\", (timing.complete - timing.request - resp.headers['x-spitfire-duration'])\n\n Bucky.count \"#{ key }.#{ resp.status }\"\n Bucky.count \"#{ key }.spitfire\"\n\n {monitor}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "HubSpot/BuckyClient", "path": "spitfire.coffee", "license": "MIT", "commit": "7113752556335b6d99201520be92bada2abe2e19", "stars": 1725, "source_url": "https://github.com/HubSpot/BuckyClient/blob/7113752556335b6d99201520be92bada2abe2e19/spitfire.coffee", "line_start": 1, "line_end": 21} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()\n\n\t\t\t$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on name, listener\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "4d1f0e38f7f87729adcf7c80bc4242ce73098f46", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/4d1f0e38f7f87729adcf7c80bc4242ce73098f46/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()\n\n\t\t\t$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on name, listener\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]\n```", "response": "/*global define*/\ndefine(['services/services'], function(services) {\n 'use strict';\n return services.factory('message', [\n '$rootScope',\n function($rootScope) {\n var publish,\n subscribe;\n publish = function(name,\n parameters) {\n parameters.timeStamp = new Date();\n return $rootScope.$broadcast(name,\n parameters);\n };\n subscribe = function(name,\n listener) {\n return $rootScope.$on(name,\n listener);\n };\n return {\n publish: publish,\n subscribe: subscribe\n };\n }\n ]);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "4d1f0e38f7f87729adcf7c80bc4242ce73098f46", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/4d1f0e38f7f87729adcf7c80bc4242ce73098f46/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*global define*/\ndefine(['services/services'], function(services) {\n 'use strict';\n return services.factory('message', [\n '$rootScope',\n function($rootScope) {\n var publish,\n subscribe;\n publish = function(name,\n parameters) {\n parameters.timeStamp = new Date();\n return $rootScope.$broadcast(name,\n parameters);\n };\n subscribe = function(name,\n listener) {\n return $rootScope.$on(name,\n listener);\n };\n return {\n publish: publish,\n subscribe: subscribe\n };\n }\n ]);\n});\n```", "response": "###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()\n\n\t\t\t$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on name, listener\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "4d1f0e38f7f87729adcf7c80bc4242ce73098f46", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/4d1f0e38f7f87729adcf7c80bc4242ce73098f46/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:completion", "type": "completion", "prompt": "###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()", "response": "$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on name, listener\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "4d1f0e38f7f87729adcf7c80bc4242ce73098f46", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/4d1f0e38f7f87729adcf7c80bc4242ce73098f46/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()\n\n\t\t\t$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on(name, listener)\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "f71adf9c94b291059af8de342e725937457a8170", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()\n\n\t\t\t$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on(name, listener)\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]\n```", "response": "/*global define*/\ndefine(['services/services'], function(services) {\n 'use strict';\n return services.factory('message', [\n '$rootScope',\n function($rootScope) {\n var publish,\n subscribe;\n publish = function(name,\n parameters) {\n parameters.timeStamp = new Date();\n return $rootScope.$broadcast(name,\n parameters);\n };\n subscribe = function(name,\n listener) {\n return $rootScope.$on(name,\n listener);\n };\n return {\n publish: publish,\n subscribe: subscribe\n };\n }\n ]);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "f71adf9c94b291059af8de342e725937457a8170", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*global define*/\ndefine(['services/services'], function(services) {\n 'use strict';\n return services.factory('message', [\n '$rootScope',\n function($rootScope) {\n var publish,\n subscribe;\n publish = function(name,\n parameters) {\n parameters.timeStamp = new Date();\n return $rootScope.$broadcast(name,\n parameters);\n };\n subscribe = function(name,\n listener) {\n return $rootScope.$on(name,\n listener);\n };\n return {\n publish: publish,\n subscribe: subscribe\n };\n }\n ]);\n});\n```", "response": "###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()\n\n\t\t\t$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on(name, listener)\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "f71adf9c94b291059af8de342e725937457a8170", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "CaryLandholt/AngularFun:scripts/services/message.coffee:1:completion", "type": "completion", "prompt": "###global define###\n\ndefine ['services/services'], (services) ->\n\t'use strict'\n\n\tservices.factory 'message', ['$rootScope', ($rootScope) ->\n\t\tpublish = (name, parameters) ->\n\t\t\tparameters.timeStamp = new Date()", "response": "$rootScope.$broadcast(name, parameters)\n\t\tsubscribe = (name, listener) ->\n\t\t\t$rootScope.$on(name, listener)\n\n\t\tpublish: publish\n\t\tsubscribe: subscribe\n\t]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "CaryLandholt/AngularFun", "path": "scripts/services/message.coffee", "license": "MIT", "commit": "f71adf9c94b291059af8de342e725937457a8170", "stars": 672, "source_url": "https://github.com/CaryLandholt/AngularFun/blob/f71adf9c94b291059af8de342e725937457a8170/scripts/services/message.coffee", "line_start": 1, "line_end": 16} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n----------------------------\\n\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n----------------------------\\n\"\n```", "response": "var align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, result;\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref, results;\n ref = data.files;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n f = ref[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n----------------------------\\n\";\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, result;\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref, results;\n ref = data.files;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n f = ref[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n----------------------------\\n\";\n};\n```", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n----------------------------\\n\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:completion", "type": "completion", "prompt": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->", "response": "if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n----------------------------\\n\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "e26044011821c4e170859362f2de657d64118711", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/e26044011821c4e170859362f2de657d64118711/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "758fa3c69fcb5c53a34bd4b9e4dd80599c461363", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/758fa3c69fcb5c53a34bd4b9e4dd80599c461363/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"\n```", "response": "var align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, result;\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref, results;\n ref = data.files;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n f = ref[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "758fa3c69fcb5c53a34bd4b9e4dd80599c461363", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/758fa3c69fcb5c53a34bd4b9e4dd80599c461363/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, result;\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref, results;\n ref = data.files;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n f = ref[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};\n```", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "758fa3c69fcb5c53a34bd4b9e4dd80599c461363", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/758fa3c69fcb5c53a34bd4b9e4dd80599c461363/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:completion", "type": "completion", "prompt": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->", "response": "if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "758fa3c69fcb5c53a34bd4b9e4dd80599c461363", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/758fa3c69fcb5c53a34bd4b9e4dd80599c461363/src/formatters/simple.coffee", "line_start": 1, "line_end": 47} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"\n```", "response": "var align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n f = ref1[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n f = ref1[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};\n```", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:completion", "type": "completion", "prompt": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]", "response": "if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} \\\n : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cec5975ffe6487f0d64b2c68c39fbcd5e77e13a4/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cf8feb1480250c5d2d884f1daf8c7bd78e09bc29", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cf8feb1480250c5d2d884f1daf8c7bd78e09bc29/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"\n```", "response": "var align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n f = ref1[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cf8feb1480250c5d2d884f1daf8c7bd78e09bc29", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cf8feb1480250c5d2d884f1daf8c7bd78e09bc29/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.BrokenFiles, col)} : ${String(badFiles.length).red}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n f = ref1[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};\n```", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cf8feb1480250c5d2d884f1daf8c7bd78e09bc29", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cf8feb1480250c5d2d884f1daf8c7bd78e09bc29/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:completion", "type": "completion", "prompt": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails", "response": "return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.BrokenFiles, col} : #{String(badFiles.length).red}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "cf8feb1480250c5d2d884f1daf8c7bd78e09bc29", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/cf8feb1480250c5d2d884f1daf8c7bd78e09bc29/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "62d7c17442ac2d0be53745e004475eca79172841", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/62d7c17442ac2d0be53745e004475eca79172841/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"\n```", "response": "var align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.Brokenfiles, col)} : ${badFiles.length}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n f = ref1[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "62d7c17442ac2d0be53745e004475eca79172841", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/62d7c17442ac2d0be53745e004475eca79172841/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar align, col, colors, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\ncolors = {\n source: \"green\",\n comment: \"cyan\",\n empty: \"yellow\"\n};\n\nstat = function(data, options) {\n var c, i, k, n, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var j, len, ref, results;\n ref = options.keys;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n k = ref[j];\n if (!((x = data.stats[k]) != null)) {\n continue;\n }\n n = ((c = colors[k]) != null) && ((i = String(x)[c]) != null) ? i : x;\n results.push(`${align(i18n.en[k], col)} : ${n}`);\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}, fmtOpts) {\n var badFiles, bl, d, f, fileCount, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n fileCount = data.files.length - badFiles.length;\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${fileCount}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.Brokenfiles, col)} : ${badFiles.length}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var j, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n f = ref1[j];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};\n```", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "62d7c17442ac2d0be53745e004475eca79172841", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/62d7c17442ac2d0be53745e004475eca79172841/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:completion", "type": "completion", "prompt": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\ncolors =\n source : \"green\"\n comment : \"cyan\"\n empty : \"yellow\"\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n n = if (c = colors[k])? and (i = String(x)[c])? then i else x\n \"#{align i18n.en[k], col} : #{n}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}, fmtOpts) ->\n\n if options.keys?.length is 1 and not options.reportDetails", "response": "return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n fileCount = data.files.length - badFiles.length\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{fileCount}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "62d7c17442ac2d0be53745e004475eca79172841", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/62d7c17442ac2d0be53745e004475eca79172841/src/formatters/simple.coffee", "line_start": 1, "line_end": 49} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n \"#{align i18n.en[k], col} : #{x}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.files.length - badFiles.length}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/src/formatters/simple.coffee", "line_start": 1, "line_end": 43} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n \"#{align i18n.en[k], col} : #{x}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.files.length - badFiles.length}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"\n```", "response": "var align, col, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\nstat = function(data, options) {\n var k, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var i, len, ref, results;\n ref = options.keys;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n k = ref[i];\n if ((x = data.stats[k]) != null) {\n results.push(`${align(i18n.en[k], col)} : ${x}`);\n }\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}) {\n var badFiles, bl, d, f, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${data.files.length - badFiles.length}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.Brokenfiles, col)} : ${badFiles.length}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var i, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (i = 0, len = ref1.length; i < len; i++) {\n f = ref1[i];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/src/formatters/simple.coffee", "line_start": 1, "line_end": 43} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar align, col, helpers, i18n, sloc, stat;\n\nsloc = require('../sloc');\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\nstat = function(data, options) {\n var k, str, x;\n if (data.badFile) {\n return `${align(i18n.en.Error, col)} : ${i18n.en.BadFile}`;\n }\n str = (function() {\n var i, len, ref, results;\n ref = options.keys;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n k = ref[i];\n if ((x = data.stats[k]) != null) {\n results.push(`${align(i18n.en[k], col)} : ${x}`);\n }\n }\n return results;\n })();\n return str.join('\\n');\n};\n\nmodule.exports = function(data, options = {}) {\n var badFiles, bl, d, f, ref, result;\n if (((ref = options.keys) != null ? ref.length : void 0) === 1 && !options.reportDetails) {\n return data.summary[options.keys[0]];\n }\n if (options.keys == null) {\n options.keys = sloc.keys;\n }\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat({\n stats: data.summary\n }, options);\n badFiles = data.files.filter(function(x) {\n return x.badFile;\n });\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${data.files.length - badFiles.length}`;\n if (bl = badFiles.length > 0) {\n result += `\\n${align(i18n.en.Brokenfiles, col)} : ${badFiles.length}`;\n }\n if (options.details && data.files.length > 1) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var i, len, ref1, results;\n ref1 = data.files;\n results = [];\n for (i = 0, len = ref1.length; i < len; i++) {\n f = ref1[i];\n results.push(`\\n\\n--- ${f.path}\\n\\n${stat(f, options)}`);\n }\n return results;\n })();\n result += d.join('');\n }\n return result += \"\\n\\n------------------------------\\n\";\n};\n```", "response": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n \"#{align i18n.en[k], col} : #{x}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]\n\n if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.files.length - badFiles.length}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/src/formatters/simple.coffee", "line_start": 1, "line_end": 43} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:completion", "type": "completion", "prompt": "sloc = require '../sloc'\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nstat = (data, options) ->\n\n if data.badFile\n return \"#{align i18n.en.Error, col} : #{i18n.en.BadFile}\"\n\n str = for k in options.keys when (x = data.stats[k])?\n \"#{align i18n.en[k], col} : #{x}\"\n\n str.join '\\n'\n\nmodule.exports = (data, options={}) ->\n\n if options.keys?.length is 1 and not options.reportDetails\n return data.summary[options.keys[0]]", "response": "if not options.keys?\n options.keys = sloc.keys\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat {stats: data.summary}, options\n\n badFiles = data.files.filter (x) -> x.badFile\n\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.files.length - badFiles.length}\"\n\n if bl = badFiles.length > 0\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{badFiles.length}\"\n\n if options.details and data.files.length > 1\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for f in data.files\n \"\\n\\n--- #{f.path}\\n\\n#{stat f, options}\"\n\n result += d.join ''\n\n result += \"\\n\\n------------------------------\\n\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "fe70a54fa0187454a16e95088188ef8db85d8151", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/fe70a54fa0187454a16e95088188ef8db85d8151/src/formatters/simple.coffee", "line_start": 1, "line_end": 43} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "i18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nBAD_FILE = i18n.en.BadFile\nBAD_FORMAT = i18n.en.BadFormat\nBAD_DIR = i18n.en.BadDir\n\nstat = (data, options={}) ->\n\n if data.err\n return \"#{align i18n.en.Error, col} : #{data.err}\"\n\n if options.sloc\n return data.sloc\n\n \"\"\"\n #{align i18n.en.loc, col} : #{data.loc}\n #{align i18n.en.sloc, col} : #{data.sloc}\n #{align i18n.en.cloc, col} : #{data.cloc}\n #{align i18n.en.scloc, col} : #{data.scloc}\n #{align i18n.en.mcloc, col} : #{data.mcloc}\n #{align i18n.en.nloc, col} : #{data.nloc}\n \"\"\"\n\nmodule.exports = (data, options) ->\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat data, options\n\n if data.filesRead?\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.filesRead}\"\n\n if data[BAD_FORMAT]\n result += \"\\n#{align i18n.en.UnknownSourceFiles, col} : #{data[BAD_FORMAT]}\"\n\n if data[BAD_FILE]\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{data[BAD_FILE]}\"\n\n if data[BAD_DIR]\n result += \"\\n#{align i18n.en.BrokenDirectories, col} : #{data[BAD_DIR]}\"\n\n if data.details?\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for detail in data.details\n \"\\n--- #{detail.path}\\n\\n#{stat detail, options}\\n\"\n\n result += d.join ''", "source_lang": "", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "eb0a4abec74996bf99b28d7a703f6272e612dc07", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/eb0a4abec74996bf99b28d7a703f6272e612dc07/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ni18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nBAD_FILE = i18n.en.BadFile\nBAD_FORMAT = i18n.en.BadFormat\nBAD_DIR = i18n.en.BadDir\n\nstat = (data, options={}) ->\n\n if data.err\n return \"#{align i18n.en.Error, col} : #{data.err}\"\n\n if options.sloc\n return data.sloc\n\n \"\"\"\n #{align i18n.en.loc, col} : #{data.loc}\n #{align i18n.en.sloc, col} : #{data.sloc}\n #{align i18n.en.cloc, col} : #{data.cloc}\n #{align i18n.en.scloc, col} : #{data.scloc}\n #{align i18n.en.mcloc, col} : #{data.mcloc}\n #{align i18n.en.nloc, col} : #{data.nloc}\n \"\"\"\n\nmodule.exports = (data, options) ->\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat data, options\n\n if data.filesRead?\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.filesRead}\"\n\n if data[BAD_FORMAT]\n result += \"\\n#{align i18n.en.UnknownSourceFiles, col} : #{data[BAD_FORMAT]}\"\n\n if data[BAD_FILE]\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{data[BAD_FILE]}\"\n\n if data[BAD_DIR]\n result += \"\\n#{align i18n.en.BrokenDirectories, col} : #{data[BAD_DIR]}\"\n\n if data.details?\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for detail in data.details\n \"\\n--- #{detail.path}\\n\\n#{stat detail, options}\\n\"\n\n result += d.join ''\n```", "response": "var BAD_DIR, BAD_FILE, BAD_FORMAT, align, col, helpers, i18n, stat;\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\nBAD_FILE = i18n.en.BadFile;\n\nBAD_FORMAT = i18n.en.BadFormat;\n\nBAD_DIR = i18n.en.BadDir;\n\nstat = function(data, options = {}) {\n if (data.err) {\n return `${align(i18n.en.Error, col)} : ${data.err}`;\n }\n if (options.sloc) {\n return data.sloc;\n }\n return `${align(i18n.en.loc, col)} : ${data.loc}\n${align(i18n.en.sloc, col)} : ${data.sloc}\n${align(i18n.en.cloc, col)} : ${data.cloc}\n${align(i18n.en.scloc, col)} : ${data.scloc}\n${align(i18n.en.mcloc, col)} : ${data.mcloc}\n${align(i18n.en.nloc, col)} : ${data.nloc}`;\n};\n\nmodule.exports = function(data, options) {\n var d, detail, result;\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat(data, options);\n if (data.filesRead != null) {\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${data.filesRead}`;\n }\n if (data[BAD_FORMAT]) {\n result += `\\n${align(i18n.en.UnknownSourceFiles, col)} : ${data[BAD_FORMAT]}`;\n }\n if (data[BAD_FILE]) {\n result += `\\n${align(i18n.en.Brokenfiles, col)} : ${data[BAD_FILE]}`;\n }\n if (data[BAD_DIR]) {\n result += `\\n${align(i18n.en.BrokenDirectories, col)} : ${data[BAD_DIR]}`;\n }\n if (data.details != null) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var i, len, ref, results;\n ref = data.details;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n detail = ref[i];\n results.push(`\\n--- ${detail.path}\\n\\n${stat(detail, options)}\\n`);\n }\n return results;\n })();\n return result += d.join('');\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "eb0a4abec74996bf99b28d7a703f6272e612dc07", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/eb0a4abec74996bf99b28d7a703f6272e612dc07/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar BAD_DIR, BAD_FILE, BAD_FORMAT, align, col, helpers, i18n, stat;\n\ni18n = require('../i18n');\n\nhelpers = require('../helpers');\n\nalign = helpers.alignRight;\n\ncol = 20;\n\nBAD_FILE = i18n.en.BadFile;\n\nBAD_FORMAT = i18n.en.BadFormat;\n\nBAD_DIR = i18n.en.BadDir;\n\nstat = function(data, options = {}) {\n if (data.err) {\n return `${align(i18n.en.Error, col)} : ${data.err}`;\n }\n if (options.sloc) {\n return data.sloc;\n }\n return `${align(i18n.en.loc, col)} : ${data.loc}\n${align(i18n.en.sloc, col)} : ${data.sloc}\n${align(i18n.en.cloc, col)} : ${data.cloc}\n${align(i18n.en.scloc, col)} : ${data.scloc}\n${align(i18n.en.mcloc, col)} : ${data.mcloc}\n${align(i18n.en.nloc, col)} : ${data.nloc}`;\n};\n\nmodule.exports = function(data, options) {\n var d, detail, result;\n result = `\\n---------- ${i18n.en.Result} ------------\\n\\n`;\n result += stat(data, options);\n if (data.filesRead != null) {\n result += `\\n\\n${i18n.en.NumberOfFilesRead} : ${data.filesRead}`;\n }\n if (data[BAD_FORMAT]) {\n result += `\\n${align(i18n.en.UnknownSourceFiles, col)} : ${data[BAD_FORMAT]}`;\n }\n if (data[BAD_FILE]) {\n result += `\\n${align(i18n.en.Brokenfiles, col)} : ${data[BAD_FILE]}`;\n }\n if (data[BAD_DIR]) {\n result += `\\n${align(i18n.en.BrokenDirectories, col)} : ${data[BAD_DIR]}`;\n }\n if (data.details != null) {\n result += `\\n\\n---------- ${i18n.en.Details} -----------\\n`;\n d = (function() {\n var i, len, ref, results;\n ref = data.details;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n detail = ref[i];\n results.push(`\\n--- ${detail.path}\\n\\n${stat(detail, options)}\\n`);\n }\n return results;\n })();\n return result += d.join('');\n }\n};\n```", "response": "i18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nBAD_FILE = i18n.en.BadFile\nBAD_FORMAT = i18n.en.BadFormat\nBAD_DIR = i18n.en.BadDir\n\nstat = (data, options={}) ->\n\n if data.err\n return \"#{align i18n.en.Error, col} : #{data.err}\"\n\n if options.sloc\n return data.sloc\n\n \"\"\"\n #{align i18n.en.loc, col} : #{data.loc}\n #{align i18n.en.sloc, col} : #{data.sloc}\n #{align i18n.en.cloc, col} : #{data.cloc}\n #{align i18n.en.scloc, col} : #{data.scloc}\n #{align i18n.en.mcloc, col} : #{data.mcloc}\n #{align i18n.en.nloc, col} : #{data.nloc}\n \"\"\"\n\nmodule.exports = (data, options) ->\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat data, options\n\n if data.filesRead?\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.filesRead}\"\n\n if data[BAD_FORMAT]\n result += \"\\n#{align i18n.en.UnknownSourceFiles, col} : #{data[BAD_FORMAT]}\"\n\n if data[BAD_FILE]\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{data[BAD_FILE]}\"\n\n if data[BAD_DIR]\n result += \"\\n#{align i18n.en.BrokenDirectories, col} : #{data[BAD_DIR]}\"\n\n if data.details?\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for detail in data.details\n \"\\n--- #{detail.path}\\n\\n#{stat detail, options}\\n\"\n\n result += d.join ''", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "eb0a4abec74996bf99b28d7a703f6272e612dc07", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/eb0a4abec74996bf99b28d7a703f6272e612dc07/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "flosse/sloc:src/formatters/simple.coffee:1:completion", "type": "completion", "prompt": "i18n = require '../i18n'\nhelpers = require '../helpers'\nalign = helpers.alignRight\ncol = 20\n\nBAD_FILE = i18n.en.BadFile\nBAD_FORMAT = i18n.en.BadFormat\nBAD_DIR = i18n.en.BadDir\n\nstat = (data, options={}) ->\n\n if data.err\n return \"#{align i18n.en.Error, col} : #{data.err}\"\n\n if options.sloc\n return data.sloc\n\n \"\"\"\n #{align i18n.en.loc, col} : #{data.loc}\n #{align i18n.en.sloc, col} : #{data.sloc}\n #{align i18n.en.cloc, col} : #{data.cloc}\n #{align i18n.en.scloc, col} : #{data.scloc}\n #{align i18n.en.mcloc, col} : #{data.mcloc}\n #{align i18n.en.nloc, col} : #{data.nloc}\n \"\"\"", "response": "module.exports = (data, options) ->\n\n result = \"\\n---------- #{i18n.en.Result} ------------\\n\\n\"\n\n result += stat data, options\n\n if data.filesRead?\n result += \"\\n\\n#{i18n.en.NumberOfFilesRead} : #{data.filesRead}\"\n\n if data[BAD_FORMAT]\n result += \"\\n#{align i18n.en.UnknownSourceFiles, col} : #{data[BAD_FORMAT]}\"\n\n if data[BAD_FILE]\n result += \"\\n#{align i18n.en.Brokenfiles, col} : #{data[BAD_FILE]}\"\n\n if data[BAD_DIR]\n result += \"\\n#{align i18n.en.BrokenDirectories, col} : #{data[BAD_DIR]}\"\n\n if data.details?\n result += \"\\n\\n---------- #{i18n.en.Details} -----------\\n\"\n d = for detail in data.details\n \"\\n--- #{detail.path}\\n\\n#{stat detail, options}\\n\"\n\n result += d.join ''", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "flosse/sloc", "path": "src/formatters/simple.coffee", "license": "MIT", "commit": "eb0a4abec74996bf99b28d7a703f6272e612dc07", "stars": 969, "source_url": "https://github.com/flosse/sloc/blob/eb0a4abec74996bf99b28d7a703f6272e612dc07/src/formatters/simple.coffee", "line_start": 1, "line_end": 50} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'is', (value, test, options) ->\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.comparisons.coffee", "line_start": 1, "line_end": 31} +{"id": "elving/swag:src/swag.comparisons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.addHelper 'is', (value, test, options) ->\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n```", "response": "Swag.addHelper('is', function(value, test, options) {\n if (value && value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('isnt', function(value, test, options) {\n if (!value || value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.comparisons.coffee", "line_start": 1, "line_end": 31} +{"id": "elving/swag:src/swag.comparisons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.addHelper('is', function(value, test, options) {\n if (value && value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('isnt', function(value, test, options) {\n if (!value || value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n```", "response": "Swag.addHelper 'is', (value, test, options) ->\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.comparisons.coffee", "line_start": 1, "line_end": 31} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'is', (value, test, options) ->\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "response": "Swag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "e9c8788dfc9f640038c00eaafe33f4137ff5f465", "stars": 675, "source_url": "https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.comparisons.coffee", "line_start": 1, "line_end": 31} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'is', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.comparisons.coffee", "line_start": 1, "line_end": 47} +{"id": "elving/swag:src/swag.comparisons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.addHelper 'is', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n```", "response": "Swag.addHelper('is', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value && value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('isnt', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (!value || value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gt', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gte', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lt', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lte', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('or', function(testA, testB, options) {\n testA = Utils.result(testA);\n testB = Utils.result(testB);\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('and', function(testA, testB, options) {\n testA = Utils.result(testA);\n testB = Utils.result(testB);\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.comparisons.coffee", "line_start": 1, "line_end": 47} +{"id": "elving/swag:src/swag.comparisons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.addHelper('is', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value && value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('isnt', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (!value || value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gt', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('gte', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lt', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('lte', function(value, test, options) {\n value = Utils.result(value);\n test = Utils.result(test);\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('or', function(testA, testB, options) {\n testA = Utils.result(testA);\n testB = Utils.result(testB);\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n\nSwag.addHelper('and', function(testA, testB, options) {\n testA = Utils.result(testA);\n testB = Utils.result(testB);\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n}, ['safe:string|number', 'safe:string|number']);\n```", "response": "Swag.addHelper 'is', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.comparisons.coffee", "line_start": 1, "line_end": 47} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'is', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value and value is test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'isnt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if not value or value isnt test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'gte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "response": "Swag.addHelper 'lt', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'lte', (value, test, options) ->\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'or', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']\n\nSwag.addHelper 'and', (testA, testB, options) ->\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n, ['safe:string|number', 'safe:string|number']", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "1dab7399e1ac6127c7b2cde8d518f46c85838801", "stars": 675, "source_url": "https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.comparisons.coffee", "line_start": 1, "line_end": 47} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'is', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific value)\n value = Utils.result value\n test = Utils.result test\n if value and value is test then options.fn this else options.inverse this\n else\n Utils.err '{{is}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'isnt', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if not value or value isnt test then options.fn this else options.inverse this\n else\n Utils.err '{{isnt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gt', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n else\n Utils.err '{{gt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gte', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n else\n Utils.err '{{gte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lt', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n else\n Utils.err '{{lt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lte', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n else\n Utils.err '{{lte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'or', (testA, testB, options) ->\n unless (Utils.isHandlebarsSpecific testA) and (Utils.isHandlebarsSpecific testB)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f3be26ec359ce14eb0a45596c591b7a777e4719c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f3be26ec359ce14eb0a45596c591b7a777e4719c/src/swag.comparisons.coffee", "line_start": 1, "line_end": 50} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'is', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific value)\n value = Utils.result value\n test = Utils.result test\n if value and value is test then options.fn this else options.inverse this\n else\n Utils.err '{{is}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'isnt', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if not value or value isnt test then options.fn this else options.inverse this\n else\n Utils.err '{{isnt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gt', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n else\n Utils.err '{{gt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gte', (value, test, options) ->", "response": "unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n else\n Utils.err '{{gte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lt', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n else\n Utils.err '{{lt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lte', (value, test, options) ->\n unless (Utils.isHandlebarsSpecific value) and (Utils.isHandlebarsSpecific test)\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n else\n Utils.err '{{lte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'or', (testA, testB, options) ->\n unless (Utils.isHandlebarsSpecific testA) and (Utils.isHandlebarsSpecific testB)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f3be26ec359ce14eb0a45596c591b7a777e4719c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f3be26ec359ce14eb0a45596c591b7a777e4719c/src/swag.comparisons.coffee", "line_start": 1, "line_end": 50} +{"id": "elving/swag:src/swag.comparisons.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n else\n Utils.err '{{or}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'and', (testA, testB, options) ->\n unless (Utils.isHandlebarsSpecific testA) and (Utils.isHandlebarsSpecific testB)\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n else\n Utils.err '{{and}} takes two arguments (string|number, string|number).'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f3be26ec359ce14eb0a45596c591b7a777e4719c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f3be26ec359ce14eb0a45596c591b7a777e4719c/src/swag.comparisons.coffee", "line_start": 51, "line_end": 63} +{"id": "elving/swag:src/swag.comparisons.coffee:2:completion", "type": "completion", "prompt": "testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n else\n Utils.err '{{or}} takes two arguments (string|number, string|number).'", "response": "Swag.addHelper 'and', (testA, testB, options) ->\n unless (Utils.isHandlebarsSpecific testA) and (Utils.isHandlebarsSpecific testB)\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n else\n Utils.err '{{and}} takes two arguments (string|number, string|number).'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f3be26ec359ce14eb0a45596c591b7a777e4719c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f3be26ec359ce14eb0a45596c591b7a777e4719c/src/swag.comparisons.coffee", "line_start": 51, "line_end": 63} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'is', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined value)\n value = Utils.result value\n test = Utils.result test\n if value is test then options.fn this else options.inverse this\n else\n Utils.err '{{is}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'isnt', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value isnt test then options.fn this else options.inverse this\n else\n Utils.err '{{isnt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gt', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n else\n Utils.err '{{gt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gte', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n else\n Utils.err '{{gte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lt', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n else\n Utils.err '{{lt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lte', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n else\n Utils.err '{{lte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'or', (testA, testB, options) ->\n unless (Utils.isUndefined testA) and (Utils.isUndefined testB)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.comparisons.coffee", "line_start": 1, "line_end": 50} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'is', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined value)\n value = Utils.result value\n test = Utils.result test\n if value is test then options.fn this else options.inverse this\n else\n Utils.err '{{is}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'isnt', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value isnt test then options.fn this else options.inverse this\n else\n Utils.err '{{isnt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gt', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value > test then options.fn this else options.inverse this\n else\n Utils.err '{{gt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'gte', (value, test, options) ->", "response": "unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value >= test then options.fn this else options.inverse this\n else\n Utils.err '{{gte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lt', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value < test then options.fn this else options.inverse this\n else\n Utils.err '{{lt}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'lte', (value, test, options) ->\n unless (Utils.isUndefined value) and (Utils.isUndefined test)\n value = Utils.result value\n test = Utils.result test\n if value <= test then options.fn this else options.inverse this\n else\n Utils.err '{{lte}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'or', (testA, testB, options) ->\n unless (Utils.isUndefined testA) and (Utils.isUndefined testB)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.comparisons.coffee", "line_start": 1, "line_end": 50} +{"id": "elving/swag:src/swag.comparisons.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n else\n Utils.err '{{or}} takes two arguments (string|number, string|number).'\n\nSwag.addHelper 'and', (testA, testB, options) ->\n unless (Utils.isUndefined testA) and (Utils.isUndefined testB)\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n else\n Utils.err '{{and}} takes two arguments (string|number, string|number).'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.comparisons.coffee", "line_start": 51, "line_end": 63} +{"id": "elving/swag:src/swag.comparisons.coffee:2:completion", "type": "completion", "prompt": "testA = Utils.result testA\n testB = Utils.result testB\n if testA or testB then options.fn this else options.inverse this\n else\n Utils.err '{{or}} takes two arguments (string|number, string|number).'", "response": "Swag.addHelper 'and', (testA, testB, options) ->\n unless (Utils.isUndefined testA) and (Utils.isUndefined testB)\n testA = Utils.result testA\n testB = Utils.result testB\n if testA and testB then options.fn this else options.inverse this\n else\n Utils.err '{{and}} takes two arguments (string|number, string|number).'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1", "stars": 675, "source_url": "https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.comparisons.coffee", "line_start": 51, "line_end": 63} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.addHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.addHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)\n```", "response": "Swag.addHelper('is', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('isnt', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.addHelper('is', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('isnt', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.addHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n```", "response": "Swag.addHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Swag.addHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)", "response": "Swag.addHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.addHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "f17d2de491f4ec174ae77b59461eb8c9f823302c", "stars": 675, "source_url": "https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Swag.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nSwag.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)\n```", "response": "Swag.registerHelper('is', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('isnt', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nSwag.registerHelper('is', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('isnt', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nSwag.registerHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n```", "response": "Swag.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Swag.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)", "response": "Swag.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nSwag.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17", "stars": 675, "source_url": "https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Handlebars.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "ec99e1585bc96d513d3e6e77bd37a3738684836e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/ec99e1585bc96d513d3e6e77bd37a3738684836e/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHandlebars.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)\n```", "response": "Handlebars.registerHelper('is', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('isnt', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "ec99e1585bc96d513d3e6e77bd37a3738684836e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/ec99e1585bc96d513d3e6e77bd37a3738684836e/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHandlebars.registerHelper('is', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('isnt', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n```", "response": "Handlebars.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "ec99e1585bc96d513d3e6e77bd37a3738684836e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/ec99e1585bc96d513d3e6e77bd37a3738684836e/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Handlebars.registerHelper 'is', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'isnt', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)", "response": "Handlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "ec99e1585bc96d513d3e6e77bd37a3738684836e", "stars": 675, "source_url": "https://github.com/elving/swag/blob/ec99e1585bc96d513d3e6e77bd37a3738684836e/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Handlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "b74033f61068855c91304cd8185ac5f7405c3169", "stars": 675, "source_url": "https://github.com/elving/swag/blob/b74033f61068855c91304cd8185ac5f7405c3169/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHandlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)\n```", "response": "Handlebars.registerHelper('equal', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('notEqual', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "b74033f61068855c91304cd8185ac5f7405c3169", "stars": 675, "source_url": "https://github.com/elving/swag/blob/b74033f61068855c91304cd8185ac5f7405c3169/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHandlebars.registerHelper('equal', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('notEqual', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('or', function(testA, testB, options) {\n if (testA || testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('and', function(testA, testB, options) {\n if (testA && testB) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n```", "response": "Handlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "b74033f61068855c91304cd8185ac5f7405c3169", "stars": 675, "source_url": "https://github.com/elving/swag/blob/b74033f61068855c91304cd8185ac5f7405c3169/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Handlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)", "response": "Handlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'or', (testA, testB, options) ->\n if testA or testB then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'and', (testA, testB, options) ->\n if testA and testB then options.fn(@) else options.inverse(@)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "b74033f61068855c91304cd8185ac5f7405c3169", "stars": 675, "source_url": "https://github.com/elving/swag/blob/b74033f61068855c91304cd8185ac5f7405c3169/src/swag.comparisons.coffee", "line_start": 1, "line_end": 23} +{"id": "elving/swag:src/swag.comparisons.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Handlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.comparisons.coffee", "line_start": 1, "line_end": 17} +{"id": "elving/swag:src/swag.comparisons.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nHandlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)\n```", "response": "Handlebars.registerHelper('equal', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('notEqual', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.comparisons.coffee", "line_start": 1, "line_end": 17} +{"id": "elving/swag:src/swag.comparisons.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nHandlebars.registerHelper('equal', function(value, test, options) {\n if (value === test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('notEqual', function(value, test, options) {\n if (value !== test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gt', function(value, test, options) {\n if (value > test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('gte', function(value, test, options) {\n if (value >= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lt', function(value, test, options) {\n if (value < test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n\nHandlebars.registerHelper('lte', function(value, test, options) {\n if (value <= test) {\n return options.fn(this);\n } else {\n return options.inverse(this);\n }\n});\n```", "response": "Handlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.comparisons.coffee", "line_start": 1, "line_end": 17} +{"id": "elving/swag:src/swag.comparisons.coffee:1:completion", "type": "completion", "prompt": "Handlebars.registerHelper 'equal', (value, test, options) ->\n if value is test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'notEqual', (value, test, options) ->\n if value isnt test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'gt', (value, test, options) ->\n if value > test then options.fn(@) else options.inverse(@)", "response": "Handlebars.registerHelper 'gte', (value, test, options) ->\n if value >= test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lt', (value, test, options) ->\n if value < test then options.fn(@) else options.inverse(@)\n\nHandlebars.registerHelper 'lte', (value, test, options) ->\n if value <= test then options.fn(@) else options.inverse(@)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "elving/swag", "path": "src/swag.comparisons.coffee", "license": "MIT", "commit": "163af3a070eefe79a32c8239884929e0cae1f589", "stars": 675, "source_url": "https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.comparisons.coffee", "line_start": 1, "line_end": 17} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "throttle = require \"lodash.throttle\"\npath = require \"path\"\n\nmodule.exports =\n enable: ->\n @throttledPlayAudio = throttle @play.bind(this), 100, trailing: false\n\n onInput: (editor, editorElement, cursor) ->\n @throttledPlayAudio()\n\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "5d1989713f4204e3d12cbcc14325622e74b29dc9", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/play-audio.coffee", "line_start": 1, "line_end": 22} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nthrottle = require \"lodash.throttle\"\npath = require \"path\"\n\nmodule.exports =\n enable: ->\n @throttledPlayAudio = throttle @play.bind(this), 100, trailing: false\n\n onInput: (editor, editorElement, cursor) ->\n @throttledPlayAudio()\n\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"\n```", "response": "var path, throttle;\n\nthrottle = require(\"lodash.throttle\");\n\npath = require(\"path\");\n\nmodule.exports = {\n enable: function() {\n return this.throttledPlayAudio = throttle(this.play.bind(this), 100, {\n trailing: false\n });\n },\n onInput: function(editor, editorElement, cursor) {\n return this.throttledPlayAudio();\n },\n play: function() {\n var audio, pathtoaudio;\n if ((this.getConfig(\"audioclip\")) === \"customAudioclip\") {\n pathtoaudio = this.getConfig(\"customAudioclip\");\n } else {\n pathtoaudio = path.join(__dirname, this.getConfig(\"audioclip\"));\n }\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "5d1989713f4204e3d12cbcc14325622e74b29dc9", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/play-audio.coffee", "line_start": 1, "line_end": 22} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar path, throttle;\n\nthrottle = require(\"lodash.throttle\");\n\npath = require(\"path\");\n\nmodule.exports = {\n enable: function() {\n return this.throttledPlayAudio = throttle(this.play.bind(this), 100, {\n trailing: false\n });\n },\n onInput: function(editor, editorElement, cursor) {\n return this.throttledPlayAudio();\n },\n play: function() {\n var audio, pathtoaudio;\n if ((this.getConfig(\"audioclip\")) === \"customAudioclip\") {\n pathtoaudio = this.getConfig(\"customAudioclip\");\n } else {\n pathtoaudio = path.join(__dirname, this.getConfig(\"audioclip\"));\n }\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};\n```", "response": "throttle = require \"lodash.throttle\"\npath = require \"path\"\n\nmodule.exports =\n enable: ->\n @throttledPlayAudio = throttle @play.bind(this), 100, trailing: false\n\n onInput: (editor, editorElement, cursor) ->\n @throttledPlayAudio()\n\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "5d1989713f4204e3d12cbcc14325622e74b29dc9", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/play-audio.coffee", "line_start": 1, "line_end": 22} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:completion", "type": "completion", "prompt": "throttle = require \"lodash.throttle\"\npath = require \"path\"\n\nmodule.exports =\n enable: ->\n @throttledPlayAudio = throttle @play.bind(this), 100, trailing: false\n\n onInput: (editor, editorElement, cursor) ->\n @throttledPlayAudio()\n\n play: ->", "response": "if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "5d1989713f4204e3d12cbcc14325622e74b29dc9", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/play-audio.coffee", "line_start": 1, "line_end": 22} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "path = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "d91f98eeabfe7abef2c0a7df39fe36b41bd62bca", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/d91f98eeabfe7abef2c0a7df39fe36b41bd62bca/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npath = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"\n```", "response": "var path;\n\npath = require(\"path\");\n\nmodule.exports = {\n play: function() {\n var audio, pathtoaudio;\n if ((this.getConfig(\"audioclip\")) === \"customAudioclip\") {\n pathtoaudio = this.getConfig(\"customAudioclip\");\n } else {\n pathtoaudio = path.join(__dirname, this.getConfig(\"audioclip\"));\n }\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "d91f98eeabfe7abef2c0a7df39fe36b41bd62bca", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/d91f98eeabfe7abef2c0a7df39fe36b41bd62bca/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar path;\n\npath = require(\"path\");\n\nmodule.exports = {\n play: function() {\n var audio, pathtoaudio;\n if ((this.getConfig(\"audioclip\")) === \"customAudioclip\") {\n pathtoaudio = this.getConfig(\"customAudioclip\");\n } else {\n pathtoaudio = path.join(__dirname, this.getConfig(\"audioclip\"));\n }\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};\n```", "response": "path = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "d91f98eeabfe7abef2c0a7df39fe36b41bd62bca", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/d91f98eeabfe7abef2c0a7df39fe36b41bd62bca/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:completion", "type": "completion", "prompt": "path = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = @getConfig \"customAudioclip\"\n else", "response": "pathtoaudio = path.join(__dirname, @getConfig \"audioclip\")\n audio = new Audio(pathtoaudio)\n audio.currentTime = 0\n audio.volume = @getConfig \"volume\"\n audio.play()\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "d91f98eeabfe7abef2c0a7df39fe36b41bd62bca", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/d91f98eeabfe7abef2c0a7df39fe36b41bd62bca/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "path = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = path.join(__dirname,\"../audioclips/\" + @getConfig \"customAudioclip\")\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\");\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "9ed74f28817de4ebbb379e148534c64d3e77b027", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/9ed74f28817de4ebbb379e148534c64d3e77b027/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npath = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = path.join(__dirname,\"../audioclips/\" + @getConfig \"customAudioclip\")\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\");\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"\n```", "response": "var path;\n\npath = require(\"path\");\n\nmodule.exports = {\n play: function() {\n var audio, pathtoaudio;\n if ((this.getConfig(\"audioclip\")) === \"customAudioclip\") {\n pathtoaudio = path.join(__dirname, \"../audioclips/\" + this.getConfig(\"customAudioclip\"));\n } else {\n pathtoaudio = path.join(__dirname, this.getConfig(\"audioclip\"));\n }\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "9ed74f28817de4ebbb379e148534c64d3e77b027", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/9ed74f28817de4ebbb379e148534c64d3e77b027/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar path;\n\npath = require(\"path\");\n\nmodule.exports = {\n play: function() {\n var audio, pathtoaudio;\n if ((this.getConfig(\"audioclip\")) === \"customAudioclip\") {\n pathtoaudio = path.join(__dirname, \"../audioclips/\" + this.getConfig(\"customAudioclip\"));\n } else {\n pathtoaudio = path.join(__dirname, this.getConfig(\"audioclip\"));\n }\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};\n```", "response": "path = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = path.join(__dirname,\"../audioclips/\" + @getConfig \"customAudioclip\")\n else\n pathtoaudio = path.join(__dirname, @getConfig \"audioclip\");\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "9ed74f28817de4ebbb379e148534c64d3e77b027", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/9ed74f28817de4ebbb379e148534c64d3e77b027/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:completion", "type": "completion", "prompt": "path = require \"path\"\n\nmodule.exports =\n play: ->\n if (@getConfig \"audioclip\") is \"customAudioclip\"\n pathtoaudio = path.join(__dirname,\"../audioclips/\" + @getConfig \"customAudioclip\")\n else", "response": "pathtoaudio = path.join(__dirname, @getConfig \"audioclip\");\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "9ed74f28817de4ebbb379e148534c64d3e77b027", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/9ed74f28817de4ebbb379e148534c64d3e77b027/lib/play-audio.coffee", "line_start": 1, "line_end": 15} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "path = require \"path\"\n\nmodule.exports =\n play: ->\n pathtoaudio = path.join(__dirname, '../audioclips/gun.wav')\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "67dba5d3011bc0b712d65ba4c430d31e6443716a", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/67dba5d3011bc0b712d65ba4c430d31e6443716a/lib/play-audio.coffee", "line_start": 1, "line_end": 12} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\npath = require \"path\"\n\nmodule.exports =\n play: ->\n pathtoaudio = path.join(__dirname, '../audioclips/gun.wav')\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"\n```", "response": "var path;\n\npath = require(\"path\");\n\nmodule.exports = {\n play: function() {\n var audio, pathtoaudio;\n pathtoaudio = path.join(__dirname, '../audioclips/gun.wav');\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "67dba5d3011bc0b712d65ba4c430d31e6443716a", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/67dba5d3011bc0b712d65ba4c430d31e6443716a/lib/play-audio.coffee", "line_start": 1, "line_end": 12} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar path;\n\npath = require(\"path\");\n\nmodule.exports = {\n play: function() {\n var audio, pathtoaudio;\n pathtoaudio = path.join(__dirname, '../audioclips/gun.wav');\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = this.getConfig(\"volume\");\n return audio.play();\n },\n getConfig: function(config) {\n return atom.config.get(`activate-power-mode.playAudio.${config}`);\n }\n};\n```", "response": "path = require \"path\"\n\nmodule.exports =\n play: ->\n pathtoaudio = path.join(__dirname, '../audioclips/gun.wav')\n audio = new Audio(pathtoaudio);\n audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "67dba5d3011bc0b712d65ba4c430d31e6443716a", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/67dba5d3011bc0b712d65ba4c430d31e6443716a/lib/play-audio.coffee", "line_start": 1, "line_end": 12} +{"id": "JoelBesada/activate-power-mode:lib/play-audio.coffee:1:completion", "type": "completion", "prompt": "path = require \"path\"\n\nmodule.exports =\n play: ->\n pathtoaudio = path.join(__dirname, '../audioclips/gun.wav')\n audio = new Audio(pathtoaudio);", "response": "audio.currentTime = 0;\n audio.volume = @getConfig \"volume\"\n audio.play();\n\n getConfig: (config) ->\n atom.config.get \"activate-power-mode.playAudio.#{config}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "JoelBesada/activate-power-mode", "path": "lib/play-audio.coffee", "license": "MIT", "commit": "67dba5d3011bc0b712d65ba4c430d31e6443716a", "stars": 3570, "source_url": "https://github.com/JoelBesada/activate-power-mode/blob/67dba5d3011bc0b712d65ba4c430d31e6443716a/lib/play-audio.coffee", "line_start": 1, "line_end": 12} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.signInRedirect = ->\n store = recorder.getStore()\n referer = store.getIn ['client', 'referer']\n siteUrl = store.getIn ['client', 'siteUrl']\n window.location.replace (referer or siteUrl)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 19, "line_end": 23} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.signInRedirect = ->\n store = recorder.getStore()\n referer = store.getIn ['client', 'referer']\n siteUrl = store.getIn ['client', 'siteUrl']\n window.location.replace (referer or siteUrl)\n```", "response": "exports.signInRedirect = function() {\n var referer, siteUrl, store;\n store = recorder.getStore();\n referer = store.getIn(['client', 'referer']);\n siteUrl = store.getIn(['client', 'siteUrl']);\n return window.location.replace(referer || siteUrl);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 19, "line_end": 23} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.signInRedirect = function() {\n var referer, siteUrl, store;\n store = recorder.getStore();\n referer = store.getIn(['client', 'referer']);\n siteUrl = store.getIn(['client', 'siteUrl']);\n return window.location.replace(referer || siteUrl);\n};\n```", "response": "exports.signInRedirect = ->\n store = recorder.getStore()\n referer = store.getIn ['client', 'referer']\n siteUrl = store.getIn ['client', 'siteUrl']\n window.location.replace (referer or siteUrl)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 19, "line_end": 23} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:4:completion", "type": "completion", "prompt": "exports.signInRedirect = ->\n store = recorder.getStore()", "response": "referer = store.getIn ['client', 'referer']\n siteUrl = store.getIn ['client', 'siteUrl']\n window.location.replace (referer or siteUrl)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 19, "line_end": 23} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.routeEmailSent = ->\n actions.routeEmailSent()\n exports.storeRefererIntoStorage()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 34, "line_end": 36} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.routeEmailSent = ->\n actions.routeEmailSent()\n exports.storeRefererIntoStorage()\n```", "response": "exports.routeEmailSent = function() {\n actions.routeEmailSent();\n return exports.storeRefererIntoStorage();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 34, "line_end": 36} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.routeEmailSent = function() {\n actions.routeEmailSent();\n return exports.storeRefererIntoStorage();\n};\n```", "response": "exports.routeEmailSent = ->\n actions.routeEmailSent()\n exports.storeRefererIntoStorage()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 34, "line_end": 36} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:13:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.storeRefererIntoStorage = ->\n store = recorder.getStore()\n referer = store.getIn ['client', 'referer']\n if referer # maybe '' or undefined\n LocalStorage.set 'referer', referer\n else\n LocalStorage.remove 'referer'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 50, "line_end": 56} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:13:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.storeRefererIntoStorage = ->\n store = recorder.getStore()\n referer = store.getIn ['client', 'referer']\n if referer # maybe '' or undefined\n LocalStorage.set 'referer', referer\n else\n LocalStorage.remove 'referer'\n```", "response": "exports.storeRefererIntoStorage = function() {\n var referer, store;\n store = recorder.getStore();\n referer = store.getIn(['client', 'referer']);\n if (referer) { // maybe '' or undefined\n return LocalStorage.set('referer', referer);\n } else {\n return LocalStorage.remove('referer');\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 50, "line_end": 56} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:13:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.storeRefererIntoStorage = function() {\n var referer, store;\n store = recorder.getStore();\n referer = store.getIn(['client', 'referer']);\n if (referer) { // maybe '' or undefined\n return LocalStorage.set('referer', referer);\n } else {\n return LocalStorage.remove('referer');\n }\n};\n```", "response": "exports.storeRefererIntoStorage = ->\n store = recorder.getStore()\n referer = store.getIn ['client', 'referer']\n if referer # maybe '' or undefined\n LocalStorage.set 'referer', referer\n else\n LocalStorage.remove 'referer'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 50, "line_end": 56} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:13:completion", "type": "completion", "prompt": "exports.storeRefererIntoStorage = ->\n store = recorder.getStore()\n referer = store.getIn ['client', 'referer']", "response": "if referer # maybe '' or undefined\n LocalStorage.set 'referer', referer\n else\n LocalStorage.remove 'referer'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 50, "line_end": 56} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:14:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.takeRefererFromStorage = ->\n referer = LocalStorage.get('referer') or null\n LocalStorage.remove 'referer'\n return referer", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 58, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:14:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.takeRefererFromStorage = ->\n referer = LocalStorage.get('referer') or null\n LocalStorage.remove 'referer'\n return referer\n```", "response": "exports.takeRefererFromStorage = function() {\n var referer;\n referer = LocalStorage.get('referer') || null;\n LocalStorage.remove('referer');\n return referer;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 58, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:14:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.takeRefererFromStorage = function() {\n var referer;\n referer = LocalStorage.get('referer') || null;\n LocalStorage.remove('referer');\n return referer;\n};\n```", "response": "exports.takeRefererFromStorage = ->\n referer = LocalStorage.get('referer') or null\n LocalStorage.remove 'referer'\n return referer", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 58, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:14:completion", "type": "completion", "prompt": "exports.takeRefererFromStorage = ->\n referer = LocalStorage.get('referer') or null", "response": "LocalStorage.remove 'referer'\n return referer", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 58, "line_end": 61} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:15:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.redirectThirdPartyAuth = (urlPath) ->\n exports.storeRefererIntoStorage()\n\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from teambition\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n\n location.replace urlPath", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 63, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:15:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.redirectThirdPartyAuth = (urlPath) ->\n exports.storeRefererIntoStorage()\n\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from teambition\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n\n location.replace urlPath\n```", "response": "exports.redirectThirdPartyAuth = function(urlPath) {\n var cookieConfigs, ref;\n exports.storeRefererIntoStorage();\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'login', cookieConfigs);\n cookie.set('trackingPageLabel', \"from teambition\", cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return location.replace(urlPath);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 63, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:15:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.redirectThirdPartyAuth = function(urlPath) {\n var cookieConfigs, ref;\n exports.storeRefererIntoStorage();\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'login', cookieConfigs);\n cookie.set('trackingPageLabel', \"from teambition\", cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return location.replace(urlPath);\n};\n```", "response": "exports.redirectThirdPartyAuth = (urlPath) ->\n exports.storeRefererIntoStorage()\n\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from teambition\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n\n location.replace urlPath", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 63, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:15:completion", "type": "completion", "prompt": "exports.redirectThirdPartyAuth = (urlPath) ->\n exports.storeRefererIntoStorage()\n\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'", "response": "cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from teambition\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n\n location.replace urlPath", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 63, "line_end": 72} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:20:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.redirectBind = (refer) ->\n # both \"change\" and \"bind\" are using this same API\n location.replace \"#{config.accountUrl}/union/#{refer}?next_url=#{encodeURIComponent window.location}&method=bind\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 86, "line_end": 88} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:20:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.redirectBind = (refer) ->\n # both \"change\" and \"bind\" are using this same API\n location.replace \"#{config.accountUrl}/union/#{refer}?next_url=#{encodeURIComponent window.location}&method=bind\"\n```", "response": "exports.redirectBind = function(refer) {\n // both \"change\" and \"bind\" are using this same API\n return location.replace(`${config.accountUrl}/union/${refer}?next_url=${encodeURIComponent(window.location)}&method=bind`);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 86, "line_end": 88} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:20:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.redirectBind = function(refer) {\n // both \"change\" and \"bind\" are using this same API\n return location.replace(`${config.accountUrl}/union/${refer}?next_url=${encodeURIComponent(window.location)}&method=bind`);\n};\n```", "response": "exports.redirectBind = (refer) ->\n # both \"change\" and \"bind\" are using this same API\n location.replace \"#{config.accountUrl}/union/#{refer}?next_url=#{encodeURIComponent window.location}&method=bind\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 86, "line_end": 88} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:22:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.logInRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 93, "line_end": 99} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:22:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.logInRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()\n```", "response": "exports.logInRedirectWithData = function(account) {\n var cookieConfigs, ref;\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'login', cookieConfigs);\n cookie.set('trackingPageLabel', `from ${account}`, cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return exports.signInRedirect();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 93, "line_end": 99} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:22:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.logInRedirectWithData = function(account) {\n var cookieConfigs, ref;\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'login', cookieConfigs);\n cookie.set('trackingPageLabel', `from ${account}`, cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return exports.signInRedirect();\n};\n```", "response": "exports.logInRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 93, "line_end": 99} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:22:completion", "type": "completion", "prompt": "exports.logInRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'", "response": "cookie.set 'trackingPage', 'login', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 93, "line_end": 99} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:23:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.registerRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'register', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 101, "line_end": 107} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:23:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.registerRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'register', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()\n```", "response": "exports.registerRedirectWithData = function(account) {\n var cookieConfigs, ref;\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'register', cookieConfigs);\n cookie.set('trackingPageLabel', `from ${account}`, cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return exports.signInRedirect();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 101, "line_end": 107} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:23:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.registerRedirectWithData = function(account) {\n var cookieConfigs, ref;\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'register', cookieConfigs);\n cookie.set('trackingPageLabel', `from ${account}`, cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return exports.signInRedirect();\n};\n```", "response": "exports.registerRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'register', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 101, "line_end": 107} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:23:completion", "type": "completion", "prompt": "exports.registerRedirectWithData = (account) ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'", "response": "cookie.set 'trackingPage', 'register', cookieConfigs\n cookie.set 'trackingPageLabel', \"from #{account}\", cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 101, "line_end": 107} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:24:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.loginDirectWithData = ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'direct login', cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 109, "line_end": 114} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:24:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.loginDirectWithData = ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'direct login', cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()\n```", "response": "exports.loginDirectWithData = function() {\n var cookieConfigs, ref;\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'direct login', cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return exports.signInRedirect();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 109, "line_end": 114} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:24:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.loginDirectWithData = function() {\n var cookieConfigs, ref;\n cookieConfigs = {\n domain: config.cookieDomain,\n expires: 7,\n path: '/'\n };\n cookie.set('trackingPage', 'direct login', cookieConfigs);\n cookie.set('trackingPageTime', (ref = window.performance) != null ? ref.timing.navigationStart : void 0, cookieConfigs);\n return exports.signInRedirect();\n};\n```", "response": "exports.loginDirectWithData = ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'\n cookie.set 'trackingPage', 'direct login', cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 109, "line_end": 114} +{"id": "jianliaoim/talk-os:talk-account/client/controllers/index.coffee:24:completion", "type": "completion", "prompt": "exports.loginDirectWithData = ->\n cookieConfigs =\n domain: config.cookieDomain, expires: 7, path: '/'", "response": "cookie.set 'trackingPage', 'direct login', cookieConfigs\n cookie.set 'trackingPageTime', window.performance?.timing.navigationStart, cookieConfigs\n exports.signInRedirect()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-account/client/controllers/index.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/controllers/index.coffee", "line_start": 109, "line_end": 114} +{"id": "linemanjs/lineman:tasks/learn-about-lineman-plugin.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (grunt) ->\n installDirections = (name) -> \"\"\"\n To install the plugin, just run:\n\n $ npm install --save-dev lineman-less\n\n Then try `lineman run` again.\n \"\"\"\n\n pluginNotices =\n \"lineman-less\": (name) -> \"\"\"\n It looks like you've added a Less file to your project. In order for\n Lineman to compile Less, you should install the lineman-less plugin.\n\n #{installDirections(name)}\n\n Please note that lineman-less does *not* concatenate all your Less files.\n It looks for \"#{grunt.config(\"files.less.main\") || 'app/css/main.less'}\" as the main less file,\n from which all other less files should be @import'ed. You\n can import any file relative to either \"app/css/\" or \"vendor/css\".\n\n \"\"\"\n default: (name) -> \"\"\"\n\n There is a lineman plugin named \"#{name}\" that provides this functionality.\n\n #{installDirections(name)}\n\n \"\"\"\n\n grunt.registerTask \"learnAboutLinemanPlugin\", \"notify users that a plugin exists for given behavior\", (name) ->\n grunt.warn(pluginNotices[name]?(name) || pluginNotices.default(name))", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/learn-about-lineman-plugin.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/learn-about-lineman-plugin.coffee", "line_start": 1, "line_end": 32} +{"id": "linemanjs/lineman:tasks/learn-about-lineman-plugin.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (grunt) ->\n installDirections = (name) -> \"\"\"\n To install the plugin, just run:\n\n $ npm install --save-dev lineman-less\n\n Then try `lineman run` again.\n \"\"\"\n\n pluginNotices =\n \"lineman-less\": (name) -> \"\"\"\n It looks like you've added a Less file to your project. In order for\n Lineman to compile Less, you should install the lineman-less plugin.\n\n #{installDirections(name)}\n\n Please note that lineman-less does *not* concatenate all your Less files.\n It looks for \"#{grunt.config(\"files.less.main\") || 'app/css/main.less'}\" as the main less file,\n from which all other less files should be @import'ed. You\n can import any file relative to either \"app/css/\" or \"vendor/css\".\n\n \"\"\"\n default: (name) -> \"\"\"\n\n There is a lineman plugin named \"#{name}\" that provides this functionality.\n\n #{installDirections(name)}\n\n \"\"\"\n\n grunt.registerTask \"learnAboutLinemanPlugin\", \"notify users that a plugin exists for given behavior\", (name) ->\n grunt.warn(pluginNotices[name]?(name) || pluginNotices.default(name))\n```", "response": "module.exports = function(grunt) {\n var installDirections, pluginNotices;\n installDirections = function(name) {\n return `To install the plugin, just run:\n\n$ npm install --save-dev lineman-less\n\nThen try \\`lineman run\\` again.`;\n };\n pluginNotices = {\n \"lineman-less\": function(name) {\n return `It looks like you've added a Less file to your project. In order for\nLineman to compile Less, you should install the lineman-less plugin.\n\n${installDirections(name)}\n\nPlease note that lineman-less does *not* concatenate all your Less files.\nIt looks for \"${grunt.config(\"files.less.main\") || 'app/css/main.less'}\" as the main less file,\nfrom which all other less files should be @import'ed. You\ncan import any file relative to either \"app/css/\" or \"vendor/css\".\n`;\n },\n default: function(name) {\n return `\nThere is a lineman plugin named \"${name}\" that provides this functionality.\n\n${installDirections(name)}\n`;\n }\n };\n return grunt.registerTask(\"learnAboutLinemanPlugin\", \"notify users that a plugin exists for given behavior\", function(name) {\n return grunt.warn((typeof pluginNotices[name] === \"function\" ? pluginNotices[name](name) : void 0) || pluginNotices.default(name));\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/learn-about-lineman-plugin.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/learn-about-lineman-plugin.coffee", "line_start": 1, "line_end": 32} +{"id": "linemanjs/lineman:tasks/learn-about-lineman-plugin.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function(grunt) {\n var installDirections, pluginNotices;\n installDirections = function(name) {\n return `To install the plugin, just run:\n\n$ npm install --save-dev lineman-less\n\nThen try \\`lineman run\\` again.`;\n };\n pluginNotices = {\n \"lineman-less\": function(name) {\n return `It looks like you've added a Less file to your project. In order for\nLineman to compile Less, you should install the lineman-less plugin.\n\n${installDirections(name)}\n\nPlease note that lineman-less does *not* concatenate all your Less files.\nIt looks for \"${grunt.config(\"files.less.main\") || 'app/css/main.less'}\" as the main less file,\nfrom which all other less files should be @import'ed. You\ncan import any file relative to either \"app/css/\" or \"vendor/css\".\n`;\n },\n default: function(name) {\n return `\nThere is a lineman plugin named \"${name}\" that provides this functionality.\n\n${installDirections(name)}\n`;\n }\n };\n return grunt.registerTask(\"learnAboutLinemanPlugin\", \"notify users that a plugin exists for given behavior\", function(name) {\n return grunt.warn((typeof pluginNotices[name] === \"function\" ? pluginNotices[name](name) : void 0) || pluginNotices.default(name));\n });\n};\n```", "response": "module.exports = (grunt) ->\n installDirections = (name) -> \"\"\"\n To install the plugin, just run:\n\n $ npm install --save-dev lineman-less\n\n Then try `lineman run` again.\n \"\"\"\n\n pluginNotices =\n \"lineman-less\": (name) -> \"\"\"\n It looks like you've added a Less file to your project. In order for\n Lineman to compile Less, you should install the lineman-less plugin.\n\n #{installDirections(name)}\n\n Please note that lineman-less does *not* concatenate all your Less files.\n It looks for \"#{grunt.config(\"files.less.main\") || 'app/css/main.less'}\" as the main less file,\n from which all other less files should be @import'ed. You\n can import any file relative to either \"app/css/\" or \"vendor/css\".\n\n \"\"\"\n default: (name) -> \"\"\"\n\n There is a lineman plugin named \"#{name}\" that provides this functionality.\n\n #{installDirections(name)}\n\n \"\"\"\n\n grunt.registerTask \"learnAboutLinemanPlugin\", \"notify users that a plugin exists for given behavior\", (name) ->\n grunt.warn(pluginNotices[name]?(name) || pluginNotices.default(name))", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/learn-about-lineman-plugin.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/learn-about-lineman-plugin.coffee", "line_start": 1, "line_end": 32} +{"id": "linemanjs/lineman:tasks/learn-about-lineman-plugin.coffee:1:completion", "type": "completion", "prompt": "module.exports = (grunt) ->\n installDirections = (name) -> \"\"\"\n To install the plugin, just run:\n\n $ npm install --save-dev lineman-less\n\n Then try `lineman run` again.\n \"\"\"\n\n pluginNotices =\n \"lineman-less\": (name) -> \"\"\"\n It looks like you've added a Less file to your project. In order for\n Lineman to compile Less, you should install the lineman-less plugin.\n\n #{installDirections(name)}", "response": "Please note that lineman-less does *not* concatenate all your Less files.\n It looks for \"#{grunt.config(\"files.less.main\") || 'app/css/main.less'}\" as the main less file,\n from which all other less files should be @import'ed. You\n can import any file relative to either \"app/css/\" or \"vendor/css\".\n\n \"\"\"\n default: (name) -> \"\"\"\n\n There is a lineman plugin named \"#{name}\" that provides this functionality.\n\n #{installDirections(name)}\n\n \"\"\"\n\n grunt.registerTask \"learnAboutLinemanPlugin\", \"notify users that a plugin exists for given behavior\", (name) ->\n grunt.warn(pluginNotices[name]?(name) || pluginNotices.default(name))", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/learn-about-lineman-plugin.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/learn-about-lineman-plugin.coffee", "line_start": 1, "line_end": 32} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')\n\n projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the supportedFiletypes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSupportedFiletypes')\n\n projectElement.supportedFiletypes.getModel().setText('foo, bar')\n projectElement.supportedFiletypes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSupportedFiletypes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')\n\n projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the supportedFiletypes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSupportedFiletypes')\n\n projectElement.supportedFiletypes.getModel().setText('foo, bar')\n projectElement.supportedFiletypes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSupportedFiletypes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n```", "response": "var change;\n\n({change} = require('./helpers/events'));\n\ndescribe('ColorProjectElement', function() {\n var pigments, project, projectElement;\n [pigments, project, projectElement] = [];\n beforeEach(function() {\n var jasmineContent;\n jasmineContent = document.body.querySelector('#jasmine-content');\n return waitsForPromise(function() {\n return atom.packages.activatePackage('pigments').then(function(pkg) {\n pigments = pkg.mainModule;\n project = pigments.getProject();\n projectElement = atom.views.getView(project);\n return jasmineContent.appendChild(projectElement);\n });\n });\n });\n it('is bound to the ColorProject model', function() {\n return expect(projectElement).toExist();\n });\n describe('typing in the sourceNames input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setSourceNames');\n projectElement.sourceNames.getModel().setText('foo, bar');\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSourceNames).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n describe('typing in the supportedFiletypes input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setSupportedFiletypes');\n projectElement.supportedFiletypes.getModel().setText('foo, bar');\n projectElement.supportedFiletypes.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSupportedFiletypes).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n return describe('typing in the searchNames input', function() {\n return it('update the search names in the project', function() {\n spyOn(project, 'setSearchNames');\n projectElement.searchNames.getModel().setText('foo, bar');\n return projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar change;\n\n({change} = require('./helpers/events'));\n\ndescribe('ColorProjectElement', function() {\n var pigments, project, projectElement;\n [pigments, project, projectElement] = [];\n beforeEach(function() {\n var jasmineContent;\n jasmineContent = document.body.querySelector('#jasmine-content');\n return waitsForPromise(function() {\n return atom.packages.activatePackage('pigments').then(function(pkg) {\n pigments = pkg.mainModule;\n project = pigments.getProject();\n projectElement = atom.views.getView(project);\n return jasmineContent.appendChild(projectElement);\n });\n });\n });\n it('is bound to the ColorProject model', function() {\n return expect(projectElement).toExist();\n });\n describe('typing in the sourceNames input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setSourceNames');\n projectElement.sourceNames.getModel().setText('foo, bar');\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSourceNames).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n describe('typing in the supportedFiletypes input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setSupportedFiletypes');\n projectElement.supportedFiletypes.getModel().setText('foo, bar');\n projectElement.supportedFiletypes.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSupportedFiletypes).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n return describe('typing in the searchNames input', function() {\n return it('update the search names in the project', function() {\n spyOn(project, 'setSearchNames');\n projectElement.searchNames.getModel().setText('foo, bar');\n return projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n });\n });\n});\n```", "response": "{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')\n\n projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the supportedFiletypes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSupportedFiletypes')\n\n projectElement.supportedFiletypes.getModel().setText('foo, bar')\n projectElement.supportedFiletypes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSupportedFiletypes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:completion", "type": "completion", "prompt": "{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')", "response": "projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the supportedFiletypes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSupportedFiletypes')\n\n projectElement.supportedFiletypes.getModel().setText('foo, bar')\n projectElement.supportedFiletypes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSupportedFiletypes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredScopes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredScopes')\n\n projectElement.ignoredScopes.getModel().setText('foo, bar')\n projectElement.ignoredScopes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredScopes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'changing the sass implementation', ->\n it 'update the setting in the project', ->\n spyOn(project, 'setSassShadeAndTintImplementation')\n\n projectElement.sassShadeAndTintImplementation.selectedIndex = 1\n change(projectElement.sassShadeAndTintImplementation)\n\n expect(project.setSassShadeAndTintImplementation).toHaveBeenCalledWith('compass')\n\n describe 'toggling on the includeThemes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIncludeThemes')\n\n projectElement.includeThemes.checked = true\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(true)\n\n projectElement.includeThemes.checked = false\n change(projectElement.includeThemes)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 43, "line_end": 82} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:2:completion", "type": "completion", "prompt": "expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredScopes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredScopes')\n\n projectElement.ignoredScopes.getModel().setText('foo, bar')\n projectElement.ignoredScopes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredScopes).toHaveBeenCalledWith(['foo','bar'])", "response": "describe 'changing the sass implementation', ->\n it 'update the setting in the project', ->\n spyOn(project, 'setSassShadeAndTintImplementation')\n\n projectElement.sassShadeAndTintImplementation.selectedIndex = 1\n change(projectElement.sassShadeAndTintImplementation)\n\n expect(project.setSassShadeAndTintImplementation).toHaveBeenCalledWith('compass')\n\n describe 'toggling on the includeThemes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIncludeThemes')\n\n projectElement.includeThemes.checked = true\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(true)\n\n projectElement.includeThemes.checked = false\n change(projectElement.includeThemes)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 43, "line_end": 82} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(project.setIncludeThemes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSourceNames checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSourceNames')\n\n projectElement.ignoreGlobalSourceNames.checked = true\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSourceNames.checked = false\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSupportedFiletypes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSupportedFiletypes')\n\n projectElement.ignoreGlobalSupportedFiletypes.checked = true\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSupportedFiletypes.checked = false\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredNames checkbox', ->\n it 'update the ignored names in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredNames')\n\n projectElement.ignoreGlobalIgnoredNames.checked = true\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredNames.checked = false\n change(projectElement.ignoreGlobalIgnoredNames)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 84, "line_end": 124} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:3:completion", "type": "completion", "prompt": "expect(project.setIncludeThemes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSourceNames checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSourceNames')\n\n projectElement.ignoreGlobalSourceNames.checked = true\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSourceNames.checked = false\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSupportedFiletypes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSupportedFiletypes')", "response": "projectElement.ignoreGlobalSupportedFiletypes.checked = true\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSupportedFiletypes.checked = false\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredNames checkbox', ->\n it 'update the ignored names in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredNames')\n\n projectElement.ignoreGlobalIgnoredNames.checked = true\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredNames.checked = false\n change(projectElement.ignoreGlobalIgnoredNames)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 84, "line_end": 124} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredScopes checkbox', ->\n it 'update the ignored scopes in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredScopes')\n\n projectElement.ignoreGlobalIgnoredScopes.checked = true\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredScopes.checked = false\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSearchNames checkbox', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setIgnoreGlobalSearchNames')\n\n projectElement.ignoreGlobalSearchNames.checked = true\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSearchNames.checked = false\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(false)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 126, "line_end": 154} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:4:completion", "type": "completion", "prompt": "expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredScopes checkbox', ->\n it 'update the ignored scopes in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredScopes')\n\n projectElement.ignoreGlobalIgnoredScopes.checked = true\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredScopes.checked = false\n change(projectElement.ignoreGlobalIgnoredScopes)", "response": "expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSearchNames checkbox', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setIgnoreGlobalSearchNames')\n\n projectElement.ignoreGlobalSearchNames.checked = true\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSearchNames.checked = false\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(false)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/spec/color-project-element-spec.coffee", "line_start": 126, "line_end": 154} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredScopes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredScopes')\n\n projectElement.ignoredScopes.getModel().setText('foo, bar')\n projectElement.ignoredScopes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredScopes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'toggling on the includeThemes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIncludeThemes')\n\n projectElement.includeThemes.checked = true\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(true)\n\n projectElement.includeThemes.checked = false\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSourceNames checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSourceNames')\n\n projectElement.ignoreGlobalSourceNames.checked = true\n change(projectElement.ignoreGlobalSourceNames)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "c99fce031776bbd5810d7fba95bad14eee6c0d94", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c99fce031776bbd5810d7fba95bad14eee6c0d94/spec/color-project-element-spec.coffee", "line_start": 43, "line_end": 82} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:2:completion", "type": "completion", "prompt": "expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredScopes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredScopes')\n\n projectElement.ignoredScopes.getModel().setText('foo, bar')\n projectElement.ignoredScopes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredScopes).toHaveBeenCalledWith(['foo','bar'])", "response": "describe 'toggling on the includeThemes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIncludeThemes')\n\n projectElement.includeThemes.checked = true\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(true)\n\n projectElement.includeThemes.checked = false\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSourceNames checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSourceNames')\n\n projectElement.ignoreGlobalSourceNames.checked = true\n change(projectElement.ignoreGlobalSourceNames)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "c99fce031776bbd5810d7fba95bad14eee6c0d94", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c99fce031776bbd5810d7fba95bad14eee6c0d94/spec/color-project-element-spec.coffee", "line_start": 43, "line_end": 82} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSourceNames.checked = false\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSupportedFiletypes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSupportedFiletypes')\n\n projectElement.ignoreGlobalSupportedFiletypes.checked = true\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSupportedFiletypes.checked = false\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredNames checkbox', ->\n it 'update the ignored names in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredNames')\n\n projectElement.ignoreGlobalIgnoredNames.checked = true\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredNames.checked = false\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredScopes checkbox', ->\n it 'update the ignored scopes in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredScopes')\n\n projectElement.ignoreGlobalIgnoredScopes.checked = true\n change(projectElement.ignoreGlobalIgnoredScopes)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "c99fce031776bbd5810d7fba95bad14eee6c0d94", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c99fce031776bbd5810d7fba95bad14eee6c0d94/spec/color-project-element-spec.coffee", "line_start": 84, "line_end": 124} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:3:completion", "type": "completion", "prompt": "expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSourceNames.checked = false\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSupportedFiletypes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSupportedFiletypes')\n\n projectElement.ignoreGlobalSupportedFiletypes.checked = true\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSupportedFiletypes.checked = false\n change(projectElement.ignoreGlobalSupportedFiletypes)\n\n expect(project.setIgnoreGlobalSupportedFiletypes).toHaveBeenCalledWith(false)", "response": "describe 'toggling on the ignoreGlobalIgnoredNames checkbox', ->\n it 'update the ignored names in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredNames')\n\n projectElement.ignoreGlobalIgnoredNames.checked = true\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredNames.checked = false\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredScopes checkbox', ->\n it 'update the ignored scopes in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredScopes')\n\n projectElement.ignoreGlobalIgnoredScopes.checked = true\n change(projectElement.ignoreGlobalIgnoredScopes)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "c99fce031776bbd5810d7fba95bad14eee6c0d94", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c99fce031776bbd5810d7fba95bad14eee6c0d94/spec/color-project-element-spec.coffee", "line_start": 84, "line_end": 124} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredScopes.checked = false\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSearchNames checkbox', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setIgnoreGlobalSearchNames')\n\n projectElement.ignoreGlobalSearchNames.checked = true\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSearchNames.checked = false\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(false)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "c99fce031776bbd5810d7fba95bad14eee6c0d94", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c99fce031776bbd5810d7fba95bad14eee6c0d94/spec/color-project-element-spec.coffee", "line_start": 126, "line_end": 145} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:4:completion", "type": "completion", "prompt": "expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredScopes.checked = false\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSearchNames checkbox', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setIgnoreGlobalSearchNames')", "response": "projectElement.ignoreGlobalSearchNames.checked = true\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSearchNames.checked = false\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(false)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "c99fce031776bbd5810d7fba95bad14eee6c0d94", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c99fce031776bbd5810d7fba95bad14eee6c0d94/spec/color-project-element-spec.coffee", "line_start": 126, "line_end": 145} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')\n\n projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')\n\n projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n```", "response": "var change;\n\n({change} = require('./helpers/events'));\n\ndescribe('ColorProjectElement', function() {\n var pigments, project, projectElement;\n [pigments, project, projectElement] = [];\n beforeEach(function() {\n var jasmineContent;\n jasmineContent = document.body.querySelector('#jasmine-content');\n return waitsForPromise(function() {\n return atom.packages.activatePackage('pigments').then(function(pkg) {\n pigments = pkg.mainModule;\n project = pigments.getProject();\n projectElement = atom.views.getView(project);\n return jasmineContent.appendChild(projectElement);\n });\n });\n });\n it('is bound to the ColorProject model', function() {\n return expect(projectElement).toExist();\n });\n describe('typing in the sourceNames input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setSourceNames');\n projectElement.sourceNames.getModel().setText('foo, bar');\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSourceNames).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n describe('typing in the searchNames input', function() {\n return it('update the search names in the project', function() {\n spyOn(project, 'setSearchNames');\n projectElement.searchNames.getModel().setText('foo, bar');\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSearchNames).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n return describe('typing in the ignoredNames input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setIgnoredNames');\n projectElement.ignoredNames.getModel().setText('foo, bar');\n return projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar change;\n\n({change} = require('./helpers/events'));\n\ndescribe('ColorProjectElement', function() {\n var pigments, project, projectElement;\n [pigments, project, projectElement] = [];\n beforeEach(function() {\n var jasmineContent;\n jasmineContent = document.body.querySelector('#jasmine-content');\n return waitsForPromise(function() {\n return atom.packages.activatePackage('pigments').then(function(pkg) {\n pigments = pkg.mainModule;\n project = pigments.getProject();\n projectElement = atom.views.getView(project);\n return jasmineContent.appendChild(projectElement);\n });\n });\n });\n it('is bound to the ColorProject model', function() {\n return expect(projectElement).toExist();\n });\n describe('typing in the sourceNames input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setSourceNames');\n projectElement.sourceNames.getModel().setText('foo, bar');\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSourceNames).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n describe('typing in the searchNames input', function() {\n return it('update the search names in the project', function() {\n spyOn(project, 'setSearchNames');\n projectElement.searchNames.getModel().setText('foo, bar');\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n return expect(project.setSearchNames).toHaveBeenCalledWith(['foo', 'bar']);\n });\n });\n return describe('typing in the ignoredNames input', function() {\n return it('update the source names in the project', function() {\n spyOn(project, 'setIgnoredNames');\n projectElement.ignoredNames.getModel().setText('foo, bar');\n return projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing');\n });\n });\n});\n```", "response": "{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')\n\n projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:1:completion", "type": "completion", "prompt": "{change} = require './helpers/events'\n\ndescribe 'ColorProjectElement', ->\n [pigments, project, projectElement] = []\n\n beforeEach ->\n jasmineContent = document.body.querySelector('#jasmine-content')\n\n waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->\n pigments = pkg.mainModule\n project = pigments.getProject()\n projectElement = atom.views.getView(project)\n jasmineContent.appendChild(projectElement)\n\n it 'is bound to the ColorProject model', ->\n expect(projectElement).toExist()\n\n describe 'typing in the sourceNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setSourceNames')", "response": "projectElement.sourceNames.getModel().setText('foo, bar')\n projectElement.sourceNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSourceNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the searchNames input', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setSearchNames')\n\n projectElement.searchNames.getModel().setText('foo, bar')\n projectElement.searchNames.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setSearchNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredNames input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredNames')\n\n projectElement.ignoredNames.getModel().setText('foo, bar')\n projectElement.ignoredNames.getModel().getBuffer().emitter.emit('did-stop-changing')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(project.setIgnoredNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredScopes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredScopes')\n\n projectElement.ignoredScopes.getModel().setText('foo, bar')\n projectElement.ignoredScopes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredScopes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'toggling on the includeThemes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIncludeThemes')\n\n projectElement.includeThemes.checked = true\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(true)\n\n projectElement.includeThemes.checked = false\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSourceNames checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSourceNames')\n\n projectElement.ignoreGlobalSourceNames.checked = true\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSourceNames.checked = false\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredNames checkbox', ->\n it 'update the ignored names in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredNames')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 43, "line_end": 84} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:2:completion", "type": "completion", "prompt": "expect(project.setIgnoredNames).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'typing in the ignoredScopes input', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoredScopes')\n\n projectElement.ignoredScopes.getModel().setText('foo, bar')\n projectElement.ignoredScopes.getModel().getBuffer().emitter.emit('did-stop-changing')\n\n expect(project.setIgnoredScopes).toHaveBeenCalledWith(['foo','bar'])\n\n describe 'toggling on the includeThemes checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIncludeThemes')\n\n projectElement.includeThemes.checked = true\n change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(true)\n\n projectElement.includeThemes.checked = false", "response": "change(projectElement.includeThemes)\n\n expect(project.setIncludeThemes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSourceNames checkbox', ->\n it 'update the source names in the project', ->\n spyOn(project, 'setIgnoreGlobalSourceNames')\n\n projectElement.ignoreGlobalSourceNames.checked = true\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSourceNames.checked = false\n change(projectElement.ignoreGlobalSourceNames)\n\n expect(project.setIgnoreGlobalSourceNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredNames checkbox', ->\n it 'update the ignored names in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredNames')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 43, "line_end": 84} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "projectElement.ignoreGlobalIgnoredNames.checked = true\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredNames.checked = false\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredScopes checkbox', ->\n it 'update the ignored scopes in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredScopes')\n\n projectElement.ignoreGlobalIgnoredScopes.checked = true\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredScopes.checked = false\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSearchNames checkbox', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setIgnoreGlobalSearchNames')\n\n projectElement.ignoreGlobalSearchNames.checked = true\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSearchNames.checked = false\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(false)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 86, "line_end": 122} +{"id": "abe33/atom-pigments:spec/color-project-element-spec.coffee:3:completion", "type": "completion", "prompt": "projectElement.ignoreGlobalIgnoredNames.checked = true\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalIgnoredNames.checked = false\n change(projectElement.ignoreGlobalIgnoredNames)\n\n expect(project.setIgnoreGlobalIgnoredNames).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalIgnoredScopes checkbox', ->\n it 'update the ignored scopes in the project', ->\n spyOn(project, 'setIgnoreGlobalIgnoredScopes')\n\n projectElement.ignoreGlobalIgnoredScopes.checked = true\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(true)", "response": "projectElement.ignoreGlobalIgnoredScopes.checked = false\n change(projectElement.ignoreGlobalIgnoredScopes)\n\n expect(project.setIgnoreGlobalIgnoredScopes).toHaveBeenCalledWith(false)\n\n describe 'toggling on the ignoreGlobalSearchNames checkbox', ->\n it 'update the search names in the project', ->\n spyOn(project, 'setIgnoreGlobalSearchNames')\n\n projectElement.ignoreGlobalSearchNames.checked = true\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(true)\n\n projectElement.ignoreGlobalSearchNames.checked = false\n change(projectElement.ignoreGlobalSearchNames)\n\n expect(project.setIgnoreGlobalSearchNames).toHaveBeenCalledWith(false)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "spec/color-project-element-spec.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-project-element-spec.coffee", "line_start": 86, "line_end": 122} +{"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "task 'test', 'run each of the unit tests', ->\n for test in test_files\n fs.readFile test, (err, code) -> eval coffee.compile code", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee", "line_start": 1, "line_end": 3} +{"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ntask 'test', 'run each of the unit tests', ->\n for test in test_files\n fs.readFile test, (err, code) -> eval coffee.compile code\n```", "response": "task('test', 'run each of the unit tests', function() {\n var i, len, results, test;\n results = [];\n for (i = 0, len = test_files.length; i < len; i++) {\n test = test_files[i];\n results.push(fs.readFile(test, function(err, code) {\n return eval(coffee.compile(code));\n }));\n }\n return results;\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee", "line_start": 1, "line_end": 3} +{"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ntask('test', 'run each of the unit tests', function() {\n var i, len, results, test;\n results = [];\n for (i = 0, len = test_files.length; i < len; i++) {\n test = test_files[i];\n results.push(fs.readFile(test, function(err, code) {\n return eval(coffee.compile(code));\n }));\n }\n return results;\n});\n```", "response": "task 'test', 'run each of the unit tests', ->\n for test in test_files\n fs.readFile test, (err, code) -> eval coffee.compile code", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/cake_tasks.coffee", "line_start": 1, "line_end": 3} +{"id": "jianliaoim/talk-os:talk-web/client/actions/group.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "recorder = require 'actions-recorder'\n\nquery = require '../query'\ndispatcher = require '../dispatcher'\n\nnotifyActions = require '../actions/notify'\n\nlang = require '../locales/lang'\n\napi = require '../network/api'\n\n# expose methods\n\nexports.create = (data, success, fail) ->\n # data : _teamId, name, _memberIds\n\n api.groups.create.post(data: data)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/create'\n data: resp\n success? resp\n .catch (error) ->\n fail? error\n\n\nexports.update = (_groupId, data, success, fail) ->\n # data: name, addMembers, removeMembers\n\n config =\n pathParams:\n id: _groupId\n data: data\n\n api.groups.update.put(config)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/update'\n data: resp\n success? resp\n .catch (error) ->\n fail? error\n\nexports.read = (_teamId, success, fail) ->\n config =\n queryParams: { _teamId }\n\n api.groups.read.get(config)\n .then (resp) ->\n dispatcher.handleViewAction", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/group.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/group.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/actions/group.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrecorder = require 'actions-recorder'\n\nquery = require '../query'\ndispatcher = require '../dispatcher'\n\nnotifyActions = require '../actions/notify'\n\nlang = require '../locales/lang'\n\napi = require '../network/api'\n\n# expose methods\n\nexports.create = (data, success, fail) ->\n # data : _teamId, name, _memberIds\n\n api.groups.create.post(data: data)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/create'\n data: resp\n success? resp\n .catch (error) ->\n fail? error\n\n\nexports.update = (_groupId, data, success, fail) ->\n # data: name, addMembers, removeMembers\n\n config =\n pathParams:\n id: _groupId\n data: data\n\n api.groups.update.put(config)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/update'\n data: resp\n success? resp\n .catch (error) ->\n fail? error\n\nexports.read = (_teamId, success, fail) ->\n config =\n queryParams: { _teamId }\n\n api.groups.read.get(config)\n .then (resp) ->\n dispatcher.handleViewAction\n```", "response": "var api, dispatcher, lang, notifyActions, query, recorder;\n\nrecorder = require('actions-recorder');\n\nquery = require('../query');\n\ndispatcher = require('../dispatcher');\n\nnotifyActions = require('../actions/notify');\n\nlang = require('../locales/lang');\n\napi = require('../network/api');\n\n// expose methods\nexports.create = function(data, success, fail) {\n // data : _teamId, name, _memberIds\n return api.groups.create.post({\n data: data\n }).then(function(resp) {\n dispatcher.handleViewAction({\n type: 'group/create',\n data: resp\n });\n return typeof success === \"function\" ? success(resp) : void 0;\n }).catch(function(error) {\n return typeof fail === \"function\" ? fail(error) : void 0;\n });\n};\n\nexports.update = function(_groupId, data, success, fail) {\n var config;\n // data: name, addMembers, removeMembers\n config = {\n pathParams: {\n id: _groupId\n },\n data: data\n };\n return api.groups.update.put(config).then(function(resp) {\n dispatcher.handleViewAction({\n type: 'group/update',\n data: resp\n });\n return typeof success === \"function\" ? success(resp) : void 0;\n }).catch(function(error) {\n return typeof fail === \"function\" ? fail(error) : void 0;\n });\n};\n\nexports.read = function(_teamId, success, fail) {\n var config;\n config = {\n queryParams: {_teamId}\n };\n return api.groups.read.get(config).then(function(resp) {\n return dispatcher.handleViewAction;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/group.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/group.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/actions/group.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar api, dispatcher, lang, notifyActions, query, recorder;\n\nrecorder = require('actions-recorder');\n\nquery = require('../query');\n\ndispatcher = require('../dispatcher');\n\nnotifyActions = require('../actions/notify');\n\nlang = require('../locales/lang');\n\napi = require('../network/api');\n\n// expose methods\nexports.create = function(data, success, fail) {\n // data : _teamId, name, _memberIds\n return api.groups.create.post({\n data: data\n }).then(function(resp) {\n dispatcher.handleViewAction({\n type: 'group/create',\n data: resp\n });\n return typeof success === \"function\" ? success(resp) : void 0;\n }).catch(function(error) {\n return typeof fail === \"function\" ? fail(error) : void 0;\n });\n};\n\nexports.update = function(_groupId, data, success, fail) {\n var config;\n // data: name, addMembers, removeMembers\n config = {\n pathParams: {\n id: _groupId\n },\n data: data\n };\n return api.groups.update.put(config).then(function(resp) {\n dispatcher.handleViewAction({\n type: 'group/update',\n data: resp\n });\n return typeof success === \"function\" ? success(resp) : void 0;\n }).catch(function(error) {\n return typeof fail === \"function\" ? fail(error) : void 0;\n });\n};\n\nexports.read = function(_teamId, success, fail) {\n var config;\n config = {\n queryParams: {_teamId}\n };\n return api.groups.read.get(config).then(function(resp) {\n return dispatcher.handleViewAction;\n });\n};\n```", "response": "recorder = require 'actions-recorder'\n\nquery = require '../query'\ndispatcher = require '../dispatcher'\n\nnotifyActions = require '../actions/notify'\n\nlang = require '../locales/lang'\n\napi = require '../network/api'\n\n# expose methods\n\nexports.create = (data, success, fail) ->\n # data : _teamId, name, _memberIds\n\n api.groups.create.post(data: data)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/create'\n data: resp\n success? resp\n .catch (error) ->\n fail? error\n\n\nexports.update = (_groupId, data, success, fail) ->\n # data: name, addMembers, removeMembers\n\n config =\n pathParams:\n id: _groupId\n data: data\n\n api.groups.update.put(config)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/update'\n data: resp\n success? resp\n .catch (error) ->\n fail? error\n\nexports.read = (_teamId, success, fail) ->\n config =\n queryParams: { _teamId }\n\n api.groups.read.get(config)\n .then (resp) ->\n dispatcher.handleViewAction", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/group.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/group.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/actions/group.coffee:1:completion", "type": "completion", "prompt": "recorder = require 'actions-recorder'\n\nquery = require '../query'\ndispatcher = require '../dispatcher'\n\nnotifyActions = require '../actions/notify'\n\nlang = require '../locales/lang'\n\napi = require '../network/api'\n\n# expose methods\n\nexports.create = (data, success, fail) ->\n # data : _teamId, name, _memberIds\n\n api.groups.create.post(data: data)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/create'\n data: resp\n success? resp\n .catch (error) ->\n fail? error", "response": "exports.update = (_groupId, data, success, fail) ->\n # data: name, addMembers, removeMembers\n\n config =\n pathParams:\n id: _groupId\n data: data\n\n api.groups.update.put(config)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/update'\n data: resp\n success? resp\n .catch (error) ->\n fail? error\n\nexports.read = (_teamId, success, fail) ->\n config =\n queryParams: { _teamId }\n\n api.groups.read.get(config)\n .then (resp) ->\n dispatcher.handleViewAction", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/group.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/group.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-web/client/actions/group.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "type: 'group/read'\n data:\n _teamId: _teamId\n groups: resp\n success? resp\n .catch (error) ->\n fail? error\n\nexports.remove = (_groupId, success, fail) ->\n config =\n pathParams:\n id: _groupId\n\n api.groups.remove.delete(config)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/remove'\n data: resp\n success? resp\n .catch (error) ->\n fail? error", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/group.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/group.coffee", "line_start": 51, "line_end": 71} +{"id": "jianliaoim/talk-os:talk-web/client/actions/group.coffee:2:completion", "type": "completion", "prompt": "type: 'group/read'\n data:\n _teamId: _teamId\n groups: resp\n success? resp\n .catch (error) ->\n fail? error\n\nexports.remove = (_groupId, success, fail) ->\n config =", "response": "pathParams:\n id: _groupId\n\n api.groups.remove.delete(config)\n .then (resp) ->\n dispatcher.handleViewAction\n type: 'group/remove'\n data: resp\n success? resp\n .catch (error) ->\n fail? error", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/actions/group.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/group.coffee", "line_start": 51, "line_end": 71} +{"id": "octoblu/meshblu:test/publishConfig-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "async = require 'async'\nPublishConfig = require '../lib/publishConfig'\nSubscriber = require '../lib/Subscriber'\nDatabase = require './test-database'\nclearCache = require '../lib/clearCache'\n\ndescribe 'PublishConfig', ->\n beforeEach (done) ->\n uuids = [\n 'uuid-device-being-configged'\n 'uuid-interested-device'\n 'uuid-uninterested-device'\n ]\n async.each uuids, clearCache, done\n\n beforeEach (done) ->\n Database.open (error, @database) => done error\n\n beforeEach (done) ->\n @database.devices.insert\n uuid: 'uuid-device-being-configged'\n meshblu:\n configForward: [\n {uuid: 'uuid-interested-device'}\n {uuid: 'uuid-uninterested-device'}\n ]\n , done\n\n beforeEach ->\n @sut = new PublishConfig\n uuid: 'uuid-device-being-configged'\n config: {foo: 'bar'}\n database: @database\n\n describe 'when called', ->\n beforeEach (done)->\n subscriber = new Subscriber namespace: 'meshblu'\n subscriber.once 'message', (type, @message) =>\n\n subscriber.subscribe 'config', 'uuid-device-being-configged', =>\n @sut.publish done", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/publishConfig-spec.coffee", "license": "MIT", "commit": "04b90646685343d0bffd0da135582e4accf29efe", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/04b90646685343d0bffd0da135582e4accf29efe/test/publishConfig-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "octoblu/meshblu:test/publishConfig-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nasync = require 'async'\nPublishConfig = require '../lib/publishConfig'\nSubscriber = require '../lib/Subscriber'\nDatabase = require './test-database'\nclearCache = require '../lib/clearCache'\n\ndescribe 'PublishConfig', ->\n beforeEach (done) ->\n uuids = [\n 'uuid-device-being-configged'\n 'uuid-interested-device'\n 'uuid-uninterested-device'\n ]\n async.each uuids, clearCache, done\n\n beforeEach (done) ->\n Database.open (error, @database) => done error\n\n beforeEach (done) ->\n @database.devices.insert\n uuid: 'uuid-device-being-configged'\n meshblu:\n configForward: [\n {uuid: 'uuid-interested-device'}\n {uuid: 'uuid-uninterested-device'}\n ]\n , done\n\n beforeEach ->\n @sut = new PublishConfig\n uuid: 'uuid-device-being-configged'\n config: {foo: 'bar'}\n database: @database\n\n describe 'when called', ->\n beforeEach (done)->\n subscriber = new Subscriber namespace: 'meshblu'\n subscriber.once 'message', (type, @message) =>\n\n subscriber.subscribe 'config', 'uuid-device-being-configged', =>\n @sut.publish done\n```", "response": "var Database, PublishConfig, Subscriber, async, clearCache;\n\nasync = require('async');\n\nPublishConfig = require('../lib/publishConfig');\n\nSubscriber = require('../lib/Subscriber');\n\nDatabase = require('./test-database');\n\nclearCache = require('../lib/clearCache');\n\ndescribe('PublishConfig', function() {\n beforeEach(function(done) {\n var uuids;\n uuids = ['uuid-device-being-configged', 'uuid-interested-device', 'uuid-uninterested-device'];\n return async.each(uuids, clearCache, done);\n });\n beforeEach(function(done) {\n return Database.open((error, database) => {\n this.database = database;\n return done(error);\n });\n });\n beforeEach(function(done) {\n return this.database.devices.insert({\n uuid: 'uuid-device-being-configged',\n meshblu: {\n configForward: [\n {\n uuid: 'uuid-interested-device'\n },\n {\n uuid: 'uuid-uninterested-device'\n }\n ]\n }\n }, done);\n });\n beforeEach(function() {\n return this.sut = new PublishConfig({\n uuid: 'uuid-device-being-configged',\n config: {\n foo: 'bar'\n },\n database: this.database\n });\n });\n return describe('when called', function() {\n return beforeEach(function(done) {\n var subscriber;\n subscriber = new Subscriber({\n namespace: 'meshblu'\n });\n subscriber.once('message', (type, message) => {\n this.message = message;\n });\n return subscriber.subscribe('config', 'uuid-device-being-configged', () => {\n return this.sut.publish(done);\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "test/publishConfig-spec.coffee", "license": "MIT", "commit": "04b90646685343d0bffd0da135582e4accf29efe", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/04b90646685343d0bffd0da135582e4accf29efe/test/publishConfig-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "octoblu/meshblu:test/publishConfig-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Database, PublishConfig, Subscriber, async, clearCache;\n\nasync = require('async');\n\nPublishConfig = require('../lib/publishConfig');\n\nSubscriber = require('../lib/Subscriber');\n\nDatabase = require('./test-database');\n\nclearCache = require('../lib/clearCache');\n\ndescribe('PublishConfig', function() {\n beforeEach(function(done) {\n var uuids;\n uuids = ['uuid-device-being-configged', 'uuid-interested-device', 'uuid-uninterested-device'];\n return async.each(uuids, clearCache, done);\n });\n beforeEach(function(done) {\n return Database.open((error, database) => {\n this.database = database;\n return done(error);\n });\n });\n beforeEach(function(done) {\n return this.database.devices.insert({\n uuid: 'uuid-device-being-configged',\n meshblu: {\n configForward: [\n {\n uuid: 'uuid-interested-device'\n },\n {\n uuid: 'uuid-uninterested-device'\n }\n ]\n }\n }, done);\n });\n beforeEach(function() {\n return this.sut = new PublishConfig({\n uuid: 'uuid-device-being-configged',\n config: {\n foo: 'bar'\n },\n database: this.database\n });\n });\n return describe('when called', function() {\n return beforeEach(function(done) {\n var subscriber;\n subscriber = new Subscriber({\n namespace: 'meshblu'\n });\n subscriber.once('message', (type, message) => {\n this.message = message;\n });\n return subscriber.subscribe('config', 'uuid-device-being-configged', () => {\n return this.sut.publish(done);\n });\n });\n });\n});\n```", "response": "async = require 'async'\nPublishConfig = require '../lib/publishConfig'\nSubscriber = require '../lib/Subscriber'\nDatabase = require './test-database'\nclearCache = require '../lib/clearCache'\n\ndescribe 'PublishConfig', ->\n beforeEach (done) ->\n uuids = [\n 'uuid-device-being-configged'\n 'uuid-interested-device'\n 'uuid-uninterested-device'\n ]\n async.each uuids, clearCache, done\n\n beforeEach (done) ->\n Database.open (error, @database) => done error\n\n beforeEach (done) ->\n @database.devices.insert\n uuid: 'uuid-device-being-configged'\n meshblu:\n configForward: [\n {uuid: 'uuid-interested-device'}\n {uuid: 'uuid-uninterested-device'}\n ]\n , done\n\n beforeEach ->\n @sut = new PublishConfig\n uuid: 'uuid-device-being-configged'\n config: {foo: 'bar'}\n database: @database\n\n describe 'when called', ->\n beforeEach (done)->\n subscriber = new Subscriber namespace: 'meshblu'\n subscriber.once 'message', (type, @message) =>\n\n subscriber.subscribe 'config', 'uuid-device-being-configged', =>\n @sut.publish done", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/publishConfig-spec.coffee", "license": "MIT", "commit": "04b90646685343d0bffd0da135582e4accf29efe", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/04b90646685343d0bffd0da135582e4accf29efe/test/publishConfig-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "octoblu/meshblu:test/publishConfig-spec.coffee:1:completion", "type": "completion", "prompt": "async = require 'async'\nPublishConfig = require '../lib/publishConfig'\nSubscriber = require '../lib/Subscriber'\nDatabase = require './test-database'\nclearCache = require '../lib/clearCache'\n\ndescribe 'PublishConfig', ->\n beforeEach (done) ->\n uuids = [\n 'uuid-device-being-configged'\n 'uuid-interested-device'\n 'uuid-uninterested-device'\n ]\n async.each uuids, clearCache, done\n\n beforeEach (done) ->\n Database.open (error, @database) => done error\n\n beforeEach (done) ->\n @database.devices.insert", "response": "uuid: 'uuid-device-being-configged'\n meshblu:\n configForward: [\n {uuid: 'uuid-interested-device'}\n {uuid: 'uuid-uninterested-device'}\n ]\n , done\n\n beforeEach ->\n @sut = new PublishConfig\n uuid: 'uuid-device-being-configged'\n config: {foo: 'bar'}\n database: @database\n\n describe 'when called', ->\n beforeEach (done)->\n subscriber = new Subscriber namespace: 'meshblu'\n subscriber.once 'message', (type, @message) =>\n\n subscriber.subscribe 'config', 'uuid-device-being-configged', =>\n @sut.publish done", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/publishConfig-spec.coffee", "license": "MIT", "commit": "04b90646685343d0bffd0da135582e4accf29efe", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/04b90646685343d0bffd0da135582e4accf29efe/test/publishConfig-spec.coffee", "line_start": 1, "line_end": 41} +{"id": "meltingice/psd.js:lib/psd/layer_info/fill_opacity.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "LayerInfo = require '../layer_info.coffee'\n\nmodule.exports = class FillOpacity extends LayerInfo\n @shouldParse: (key) -> key is 'iOpa'\n\n parse: ->\n @value = @file.readByte()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/fill_opacity.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/fill_opacity.coffee", "line_start": 1, "line_end": 7} +{"id": "meltingice/psd.js:lib/psd/layer_info/fill_opacity.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nLayerInfo = require '../layer_info.coffee'\n\nmodule.exports = class FillOpacity extends LayerInfo\n @shouldParse: (key) -> key is 'iOpa'\n\n parse: ->\n @value = @file.readByte()\n```", "response": "var FillOpacity, LayerInfo;\n\nLayerInfo = require('../layer_info.coffee');\n\nmodule.exports = FillOpacity = class FillOpacity extends LayerInfo {\n static shouldParse(key) {\n return key === 'iOpa';\n }\n\n parse() {\n return this.value = this.file.readByte();\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/fill_opacity.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/fill_opacity.coffee", "line_start": 1, "line_end": 7} +{"id": "meltingice/psd.js:lib/psd/layer_info/fill_opacity.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar FillOpacity, LayerInfo;\n\nLayerInfo = require('../layer_info.coffee');\n\nmodule.exports = FillOpacity = class FillOpacity extends LayerInfo {\n static shouldParse(key) {\n return key === 'iOpa';\n }\n\n parse() {\n return this.value = this.file.readByte();\n }\n\n};\n```", "response": "LayerInfo = require '../layer_info.coffee'\n\nmodule.exports = class FillOpacity extends LayerInfo\n @shouldParse: (key) -> key is 'iOpa'\n\n parse: ->\n @value = @file.readByte()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/fill_opacity.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/fill_opacity.coffee", "line_start": 1, "line_end": 7} +{"id": "meltingice/psd.js:lib/psd/layer_info/fill_opacity.coffee:1:completion", "type": "completion", "prompt": "LayerInfo = require '../layer_info.coffee'\n\nmodule.exports = class FillOpacity extends LayerInfo", "response": "@shouldParse: (key) -> key is 'iOpa'\n\n parse: ->\n @value = @file.readByte()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/fill_opacity.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/fill_opacity.coffee", "line_start": 1, "line_end": 7} +{"id": "Pagedraw/pagedraw:src/recommended_pagedraw_json.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "## Single source of truth for our pagedraw.json recommendations\n\nexports.recommended_pagedraw_json_for_app_id = (app_id, filepath_prefix) ->\n \"\"\"\n {\"app\": \"#{app_id}\", \"managed_folders\": [\"#{if filepath_prefix.endsWith('/') then filepath_prefix else filepath_prefix + '/'}\"] }\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/recommended_pagedraw_json.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/recommended_pagedraw_json.coffee", "line_start": 1, "line_end": 6} +{"id": "Pagedraw/pagedraw:src/recommended_pagedraw_json.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n## Single source of truth for our pagedraw.json recommendations\n\nexports.recommended_pagedraw_json_for_app_id = (app_id, filepath_prefix) ->\n \"\"\"\n {\"app\": \"#{app_id}\", \"managed_folders\": [\"#{if filepath_prefix.endsWith('/') then filepath_prefix else filepath_prefix + '/'}\"] }\n \"\"\"\n```", "response": "//# Single source of truth for our pagedraw.json recommendations\nexports.recommended_pagedraw_json_for_app_id = function(app_id, filepath_prefix) {\n return `{\"app\": \"${app_id}\", \"managed_folders\": [\"${filepath_prefix.endsWith('/') ? filepath_prefix : filepath_prefix + '/'}\"] }`;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/recommended_pagedraw_json.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/recommended_pagedraw_json.coffee", "line_start": 1, "line_end": 6} +{"id": "Pagedraw/pagedraw:src/recommended_pagedraw_json.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n//# Single source of truth for our pagedraw.json recommendations\nexports.recommended_pagedraw_json_for_app_id = function(app_id, filepath_prefix) {\n return `{\"app\": \"${app_id}\", \"managed_folders\": [\"${filepath_prefix.endsWith('/') ? filepath_prefix : filepath_prefix + '/'}\"] }`;\n};\n```", "response": "## Single source of truth for our pagedraw.json recommendations\n\nexports.recommended_pagedraw_json_for_app_id = (app_id, filepath_prefix) ->\n \"\"\"\n {\"app\": \"#{app_id}\", \"managed_folders\": [\"#{if filepath_prefix.endsWith('/') then filepath_prefix else filepath_prefix + '/'}\"] }\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/recommended_pagedraw_json.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/recommended_pagedraw_json.coffee", "line_start": 1, "line_end": 6} +{"id": "Pagedraw/pagedraw:src/recommended_pagedraw_json.coffee:1:completion", "type": "completion", "prompt": "## Single source of truth for our pagedraw.json recommendations\n\nexports.recommended_pagedraw_json_for_app_id = (app_id, filepath_prefix) ->", "response": "\"\"\"\n {\"app\": \"#{app_id}\", \"managed_folders\": [\"#{if filepath_prefix.endsWith('/') then filepath_prefix else filepath_prefix + '/'}\"] }\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/recommended_pagedraw_json.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/recommended_pagedraw_json.coffee", "line_start": 1, "line_end": 6} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template._houston_change_password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_change_password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()\n\n Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate._houston_change_password.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate._houston_change_password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_change_password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()\n\n Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate._houston_change_password.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template._houston_change_password.helpers({\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_change_password.events({\n 'submit #houston-change-password-form': function(e) {\n var current_password, new_password;\n e.preventDefault();\n current_password = $('input[name=\"houston-current-password\"]').val();\n new_password = $('input[name=\"houston-new-password\"]').val();\n return Accounts.changePassword(current_password, new_password, function(error) {\n if (error != null) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n });\n }\n});\n\nTemplate._houston_change_password.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate._houston_change_password.helpers({\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate._houston_change_password.events({\n 'submit #houston-change-password-form': function(e) {\n var current_password, new_password;\n e.preventDefault();\n current_password = $('input[name=\"houston-current-password\"]').val();\n new_password = $('input[name=\"houston-new-password\"]').val();\n return Accounts.changePassword(current_password, new_password, function(error) {\n if (error != null) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n });\n }\n});\n\nTemplate._houston_change_password.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template._houston_change_password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_change_password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()\n\n Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate._houston_change_password.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:completion", "type": "completion", "prompt": "Template._houston_change_password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate._houston_change_password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()", "response": "Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate._houston_change_password.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "581357048f3577f0487ed598e26eaf063c813183", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Template.password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate.password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()\n\n Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate.password.rendered = ->\n $(window).unbind('scroll')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "3f9d71d3b19f7770abaaef85e8d836d9122d71b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3f9d71d3b19f7770abaaef85e8d836d9122d71b7/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTemplate.password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate.password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()\n\n Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate.password.rendered = ->\n $(window).unbind('scroll')\n```", "response": "Template.password.helpers({\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate.password.events({\n 'submit #houston-change-password-form': function(e) {\n var current_password, new_password;\n e.preventDefault();\n current_password = $('input[name=\"houston-current-password\"]').val();\n new_password = $('input[name=\"houston-new-password\"]').val();\n return Accounts.changePassword(current_password, new_password, function(error) {\n if (error != null) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n });\n }\n});\n\nTemplate.password.rendered = function() {\n return $(window).unbind('scroll');\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "3f9d71d3b19f7770abaaef85e8d836d9122d71b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3f9d71d3b19f7770abaaef85e8d836d9122d71b7/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nTemplate.password.helpers({\n admin_user_exists: function() {\n return admin_user_exists();\n }\n});\n\nTemplate.password.events({\n 'submit #houston-change-password-form': function(e) {\n var current_password, new_password;\n e.preventDefault();\n current_password = $('input[name=\"houston-current-password\"]').val();\n new_password = $('input[name=\"houston-new-password\"]').val();\n return Accounts.changePassword(current_password, new_password, function(error) {\n if (error != null) {\n return alert(error);\n } else {\n return Houston._go('home');\n }\n });\n }\n});\n\nTemplate.password.rendered = function() {\n return $(window).unbind('scroll');\n};\n```", "response": "Template.password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate.password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()\n\n Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate.password.rendered = ->\n $(window).unbind('scroll')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "3f9d71d3b19f7770abaaef85e8d836d9122d71b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3f9d71d3b19f7770abaaef85e8d836d9122d71b7/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "gterrono/houston:client/admin_change_password.coffee:1:completion", "type": "completion", "prompt": "Template.password.helpers(\n admin_user_exists: -> admin_user_exists()\n)\n\nTemplate.password.events(\n 'submit #houston-change-password-form': (e) ->\n e.preventDefault()\n current_password = $('input[name=\"houston-current-password\"]').val()\n new_password = $('input[name=\"houston-new-password\"]').val()", "response": "Accounts.changePassword(current_password, new_password, (error) ->\n if error?\n alert(error)\n else\n Houston._go('home')\n )\n)\n\nTemplate.password.rendered = ->\n $(window).unbind('scroll')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gterrono/houston", "path": "client/admin_change_password.coffee", "license": "MIT", "commit": "3f9d71d3b19f7770abaaef85e8d836d9122d71b7", "stars": 802, "source_url": "https://github.com/gterrono/houston/blob/3f9d71d3b19f7770abaaef85e8d836d9122d71b7/client/admin_change_password.coffee", "line_start": 1, "line_end": 20} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteSuggestionsFromValue', (@autocompleteSuggestionsFromValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n if @autocompleteSuggestionsFromValue\n line.match(/(?:#[a-fA-F0-9]*|rgb.+)$/)?[0] ?\n line.match(new RegExp(\"(#{variablesRegExp})$\"))?[0] ?\n line.match(/:\\s*([^\\s].+)$/)?[1] ?\n line.match(/^\\s*([^\\s].+)$/)?[1] ?\n ''\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/pigments-provider.coffee", "line_start": 6, "line_end": 55} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:completion", "type": "completion", "prompt": "class PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteSuggestionsFromValue', (@autocompleteSuggestionsFromValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed", "response": "prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n if @autocompleteSuggestionsFromValue\n line.match(/(?:#[a-fA-F0-9]*|rgb.+)$/)?[0] ?\n line.match(new RegExp(\"(#{variablesRegExp})$\"))?[0] ?\n line.match(/:\\s*([^\\s].+)$/)?[1] ?\n line.match(/^\\s*([^\\s].+)$/)?[1] ?\n ''\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/pigments-provider.coffee", "line_start": 6, "line_end": 55} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "line.match(new RegExp(\"(#{variablesRegExp})$\"))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n _ ?= require 'underscore-plus'\n\n re = ///^#{_.escapeRegExp(prefix).replace(/,\\s*/, '\\\\s*,\\\\s*')}///\n\n suggestions = []\n matchesColorValue = (v) ->\n res = re.test(v.value)\n res ||= v.color.suggestionValues.some((s) -> re.test(s)) if v.color?\n res\n\n matchedVariables = variables.filter (v) =>\n not v.isAlternate and re.test(v.name) or\n (@autocompleteSuggestionsFromValue and matchesColorValue(v))\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/pigments-provider.coffee", "line_start": 56, "line_end": 95} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:3:completion", "type": "completion", "prompt": "line.match(new RegExp(\"(#{variablesRegExp})$\"))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n _ ?= require 'underscore-plus'\n\n re = ///^#{_.escapeRegExp(prefix).replace(/,\\s*/, '\\\\s*,\\\\s*')}///\n\n suggestions = []\n matchesColorValue = (v) ->\n res = re.test(v.value)\n res ||= v.color.suggestionValues.some((s) -> re.test(s)) if v.color?\n res\n\n matchedVariables = variables.filter (v) =>\n not v.isAlternate and re.test(v.name) or\n (@autocompleteSuggestionsFromValue and matchesColorValue(v))\n\n matchedVariables.forEach (v) =>", "response": "if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/pigments-provider.coffee", "line_start": 56, "line_end": 95} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteSuggestionsFromValue', (@autocompleteSuggestionsFromValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n if @autocompleteSuggestionsFromValue\n line.match(/^\\s*([^\\s].+)$/)?[1] or ''\n else\n variablesRegExp ?= require('./regexes').variables\n\n line.match(new RegExp(\"(#{variablesRegExp})$\"))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "182761b8e1bfb1448dd403b3d2dc46583fa1a0cf", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/182761b8e1bfb1448dd403b3d2dc46583fa1a0cf/lib/pigments-provider.coffee", "line_start": 6, "line_end": 55} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:completion", "type": "completion", "prompt": "class PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteSuggestionsFromValue', (@autocompleteSuggestionsFromValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed", "response": "prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n if @autocompleteSuggestionsFromValue\n line.match(/^\\s*([^\\s].+)$/)?[1] or ''\n else\n variablesRegExp ?= require('./regexes').variables\n\n line.match(new RegExp(\"(#{variablesRegExp})$\"))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "182761b8e1bfb1448dd403b3d2dc46583fa1a0cf", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/182761b8e1bfb1448dd403b3d2dc46583fa1a0cf/lib/pigments-provider.coffee", "line_start": 6, "line_end": 55} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return [] unless variables?\n\n _ ?= require 'underscore-plus'\n\n re = ///^#{_.escapeRegExp(prefix).replace(/,\\s*/, '\\\\s*,\\\\s*')}///\n\n suggestions = []\n matchesColorValue = (v) ->\n res = re.test(v.value)\n res ||= v.color.suggestionValues.some((s) -> re.test(s)) if v.color?\n res\n\n matchedVariables = variables.filter (v) =>\n not v.isAlternate and re.test(v.name) or\n (@autocompleteSuggestionsFromValue and matchesColorValue(v))\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "182761b8e1bfb1448dd403b3d2dc46583fa1a0cf", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/182761b8e1bfb1448dd403b3d2dc46583fa1a0cf/lib/pigments-provider.coffee", "line_start": 56, "line_end": 92} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:3:completion", "type": "completion", "prompt": "return [] unless variables?\n\n _ ?= require 'underscore-plus'\n\n re = ///^#{_.escapeRegExp(prefix).replace(/,\\s*/, '\\\\s*,\\\\s*')}///\n\n suggestions = []\n matchesColorValue = (v) ->\n res = re.test(v.value)\n res ||= v.color.suggestionValues.some((s) -> re.test(s)) if v.color?\n res\n\n matchedVariables = variables.filter (v) =>\n not v.isAlternate and re.test(v.name) or\n (@autocompleteSuggestionsFromValue and matchesColorValue(v))\n\n matchedVariables.forEach (v) =>\n if v.isColor", "response": "color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "182761b8e1bfb1448dd403b3d2dc46583fa1a0cf", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/182761b8e1bfb1448dd403b3d2dc46583fa1a0cf/lib/pigments-provider.coffee", "line_start": 56, "line_end": 92} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteSuggestionsFromValue', (@autocompleteSuggestionsFromValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n\n regexp = [variablesRegExp]\n\n regexp.push(\"#[a-fA-F0-9]+\") if @autocompleteSuggestionsFromValue\n\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(\"(#{regexp.join('|')})$\"))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "03fec27e3f525f6ad452862324fe30e4ef7d279b", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/03fec27e3f525f6ad452862324fe30e4ef7d279b/lib/pigments-provider.coffee", "line_start": 6, "line_end": 55} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:completion", "type": "completion", "prompt": "class PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteSuggestionsFromValue', (@autocompleteSuggestionsFromValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed", "response": "prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n\n regexp = [variablesRegExp]\n\n regexp.push(\"#[a-fA-F0-9]+\") if @autocompleteSuggestionsFromValue\n\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(\"(#{regexp.join('|')})$\"))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "03fec27e3f525f6ad452862324fe30e4ef7d279b", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/03fec27e3f525f6ad452862324fe30e4ef7d279b/lib/pigments-provider.coffee", "line_start": 6, "line_end": 55} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return [] unless variables?\n\n _ ?= require 'underscore-plus'\n\n suggestions = []\n\n matchedVariables = variables.filter (v) =>\n not v.isAlternate and\n ///^#{_.escapeRegExp prefix}///.test(v.name) or\n (@autocompleteSuggestionsFromValue and ///^#{_.escapeRegExp prefix}///.test(\"##{v.color?.hex}\"))\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "03fec27e3f525f6ad452862324fe30e4ef7d279b", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/03fec27e3f525f6ad452862324fe30e4ef7d279b/lib/pigments-provider.coffee", "line_start": 56, "line_end": 87} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:3:completion", "type": "completion", "prompt": "return [] unless variables?\n\n _ ?= require 'underscore-plus'\n\n suggestions = []\n\n matchedVariables = variables.filter (v) =>\n not v.isAlternate and\n ///^#{_.escapeRegExp prefix}///.test(v.name) or\n (@autocompleteSuggestionsFromValue and ///^#{_.escapeRegExp prefix}///.test(\"##{v.color?.hex}\"))\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue", "response": "suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "03fec27e3f525f6ad452862324fe30e4ef7d279b", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/03fec27e3f525f6ad452862324fe30e4ef7d279b/lib/pigments-provider.coffee", "line_start": 56, "line_end": 87} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "[\n CompositeDisposable, variablesRegExp, _\n] = []\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n[\n CompositeDisposable, variablesRegExp, _\n] = []\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n```", "response": "var CompositeDisposable, PigmentsProvider, _, variablesRegExp;\n\n[CompositeDisposable, variablesRegExp, _] = [];\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n if (CompositeDisposable == null) {\n CompositeDisposable = require('atom').CompositeDisposable;\n }\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToColorValue', (extendAutocompleteToColorValue) => {\n this.extendAutocompleteToColorValue = extendAutocompleteToColorValue;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n if (variablesRegExp == null) {\n variablesRegExp = require('./regexes').variables;\n }\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n if (variables == null) {\n return [];\n }\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable, PigmentsProvider, _, variablesRegExp;\n\n[CompositeDisposable, variablesRegExp, _] = [];\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n if (CompositeDisposable == null) {\n CompositeDisposable = require('atom').CompositeDisposable;\n }\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToColorValue', (extendAutocompleteToColorValue) => {\n this.extendAutocompleteToColorValue = extendAutocompleteToColorValue;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n if (variablesRegExp == null) {\n variablesRegExp = require('./regexes').variables;\n }\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n if (variables == null) {\n return [];\n }\n }\n\n};\n```", "response": "[\n CompositeDisposable, variablesRegExp, _\n] = []\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:completion", "type": "completion", "prompt": "[\n CompositeDisposable, variablesRegExp, _\n] = []\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n CompositeDisposable ?= require('atom').CompositeDisposable\n\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()", "response": "getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n variablesRegExp ?= require('./regexes').variables\n\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ ?= require 'underscore-plus'\n\n suggestions = []\n\n matchedVariables = variables.filter (v) ->\n not v.isAlternate and ///^#{_.escapeRegExp prefix}///.test(v.name)\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/pigments-provider.coffee", "line_start": 51, "line_end": 79} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:completion", "type": "completion", "prompt": "_ ?= require 'underscore-plus'\n\n suggestions = []\n\n matchedVariables = variables.filter (v) ->\n not v.isAlternate and ///^#{_.escapeRegExp prefix}///.test(v.name)\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {", "response": "text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5fba3c03cd5e7a260656947c6cd1a6541fe9f2a8/lib/pigments-provider.coffee", "line_start": 51, "line_end": 79} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "09851f3fc20143e14997168ecf740abeb0137d6e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/09851f3fc20143e14997168ecf740abeb0137d6e/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) ->\n```", "response": "var CompositeDisposable, PigmentsProvider, Range, _, variablesRegExp;\n\n_ = require('underscore-plus');\n\n({CompositeDisposable, Range} = require('atom'));\n\n({\n variables: variablesRegExp\n} = require('./regexes'));\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToColorValue', (extendAutocompleteToColorValue) => {\n this.extendAutocompleteToColorValue = extendAutocompleteToColorValue;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n var matchedVariables, suggestions;\n if (variables == null) {\n return [];\n }\n suggestions = [];\n return matchedVariables = variables.filter(function(v) {});\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "09851f3fc20143e14997168ecf740abeb0137d6e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/09851f3fc20143e14997168ecf740abeb0137d6e/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable, PigmentsProvider, Range, _, variablesRegExp;\n\n_ = require('underscore-plus');\n\n({CompositeDisposable, Range} = require('atom'));\n\n({\n variables: variablesRegExp\n} = require('./regexes'));\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToColorValue', (extendAutocompleteToColorValue) => {\n this.extendAutocompleteToColorValue = extendAutocompleteToColorValue;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n var matchedVariables, suggestions;\n if (variables == null) {\n return [];\n }\n suggestions = [];\n return matchedVariables = variables.filter(function(v) {});\n }\n\n};\n```", "response": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "09851f3fc20143e14997168ecf740abeb0137d6e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/09851f3fc20143e14997168ecf740abeb0137d6e/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:completion", "type": "completion", "prompt": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->", "response": "return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "09851f3fc20143e14997168ecf740abeb0137d6e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/09851f3fc20143e14997168ecf740abeb0137d6e/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "not v.isAlternate and ///^#{_.escapeRegExp prefix}///.test(v.name)\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "09851f3fc20143e14997168ecf740abeb0137d6e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/09851f3fc20143e14997168ecf740abeb0137d6e/lib/pigments-provider.coffee", "line_start": 51, "line_end": 73} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:completion", "type": "completion", "prompt": "not v.isAlternate and ///^#{_.escapeRegExp prefix}///.test(v.name)\n\n matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML", "response": "replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "09851f3fc20143e14997168ecf740abeb0137d6e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/09851f3fc20143e14997168ecf740abeb0137d6e/lib/pigments-provider.coffee", "line_start": 51, "line_end": 73} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name\n```", "response": "var CompositeDisposable, PigmentsProvider, Range, _, variablesRegExp;\n\n_ = require('underscore-plus');\n\n({CompositeDisposable, Range} = require('atom'));\n\n({\n variables: variablesRegExp\n} = require('./regexes'));\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToColorValue', (extendAutocompleteToColorValue) => {\n this.extendAutocompleteToColorValue = extendAutocompleteToColorValue;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n var matchedVariables, suggestions;\n if (variables == null) {\n return [];\n }\n suggestions = [];\n return matchedVariables = variables.filter(function(v) {\n return RegExp(`^${_.escapeRegExp(prefix)}`).test(v.name);\n });\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable, PigmentsProvider, Range, _, variablesRegExp;\n\n_ = require('underscore-plus');\n\n({CompositeDisposable, Range} = require('atom'));\n\n({\n variables: variablesRegExp\n} = require('./regexes'));\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToColorValue', (extendAutocompleteToColorValue) => {\n this.extendAutocompleteToColorValue = extendAutocompleteToColorValue;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n var matchedVariables, suggestions;\n if (variables == null) {\n return [];\n }\n suggestions = [];\n return matchedVariables = variables.filter(function(v) {\n return RegExp(`^${_.escapeRegExp(prefix)}`).test(v.name);\n });\n }\n\n};\n```", "response": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:completion", "type": "completion", "prompt": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToColorValue', (@extendAutocompleteToColorValue) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->", "response": "return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 51, "line_end": 72} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmatchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions\n```", "response": "matchedVariables.forEach((v) => {\n var color, rightLabelHTML;\n if (v.isColor) {\n color = v.color.alpha === 1 ? '#' + v.color.hex : v.color.toCSS();\n rightLabelHTML = ``;\n if (this.extendAutocompleteToColorValue) {\n rightLabelHTML = `${color} ${rightLabelHTML}`;\n }\n return suggestions.push({\n text: v.name,\n rightLabelHTML,\n replacementPrefix: prefix,\n className: 'color-suggestion'\n });\n } else {\n return suggestions.push({\n text: v.name,\n rightLabel: v.value,\n replacementPrefix: prefix,\n className: 'pigments-suggestion'\n });\n }\n});\n\nsuggestions;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 51, "line_end": 72} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmatchedVariables.forEach((v) => {\n var color, rightLabelHTML;\n if (v.isColor) {\n color = v.color.alpha === 1 ? '#' + v.color.hex : v.color.toCSS();\n rightLabelHTML = ``;\n if (this.extendAutocompleteToColorValue) {\n rightLabelHTML = `${color} ${rightLabelHTML}`;\n }\n return suggestions.push({\n text: v.name,\n rightLabelHTML,\n replacementPrefix: prefix,\n className: 'color-suggestion'\n });\n } else {\n return suggestions.push({\n text: v.name,\n rightLabel: v.value,\n replacementPrefix: prefix,\n className: 'pigments-suggestion'\n });\n }\n});\n\nsuggestions;\n```", "response": "matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 51, "line_end": 72} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:completion", "type": "completion", "prompt": "matchedVariables.forEach (v) =>\n if v.isColor\n color = if v.color.alpha == 1 then '#' + v.color.hex else v.color.toCSS();\n rightLabelHTML = \"\"\n rightLabelHTML = \"#{color} #{rightLabelHTML}\" if @extendAutocompleteToColorValue\n\n suggestions.push {\n text: v.name\n rightLabelHTML\n replacementPrefix: prefix", "response": "className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "3a86e258043194b8c4f58b7636ca5dfe0b1418cb", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/3a86e258043194b8c4f58b7636ca5dfe0b1418cb/lib/pigments-provider.coffee", "line_start": 51, "line_end": 72} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name\n```", "response": "var CompositeDisposable, PigmentsProvider, Range, _, variablesRegExp;\n\n_ = require('underscore-plus');\n\n({CompositeDisposable, Range} = require('atom'));\n\n({\n variables: variablesRegExp\n} = require('./regexes'));\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n var matchedVariables, suggestions;\n if (variables == null) {\n return [];\n }\n suggestions = [];\n return matchedVariables = variables.filter(function(v) {\n return RegExp(`^${_.escapeRegExp(prefix)}`).test(v.name);\n });\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar CompositeDisposable, PigmentsProvider, Range, _, variablesRegExp;\n\n_ = require('underscore-plus');\n\n({CompositeDisposable, Range} = require('atom'));\n\n({\n variables: variablesRegExp\n} = require('./regexes'));\n\nmodule.exports = PigmentsProvider = class PigmentsProvider {\n constructor(pigments) {\n this.pigments = pigments;\n this.subscriptions = new CompositeDisposable();\n this.selector = atom.config.get('pigments.autocompleteScopes').join(',');\n this.subscriptions.add(atom.config.observe('pigments.autocompleteScopes', (scopes) => {\n return this.selector = scopes.join(',');\n }));\n this.subscriptions.add(atom.config.observe('pigments.extendAutocompleteToVariables', (extendAutocompleteToVariables) => {\n this.extendAutocompleteToVariables = extendAutocompleteToVariables;\n }));\n }\n\n dispose() {\n this.disposed = true;\n this.subscriptions.dispose();\n return this.pigments = null;\n }\n\n getProject() {\n if (this.disposed) {\n return;\n }\n return this.pigments.getProject();\n }\n\n getSuggestions({editor, bufferPosition}) {\n var prefix, project, suggestions, variables;\n if (this.disposed) {\n return;\n }\n prefix = this.getPrefix(editor, bufferPosition);\n project = this.getProject();\n if (!(prefix != null ? prefix.length : void 0)) {\n return;\n }\n if (project == null) {\n return;\n }\n if (this.extendAutocompleteToVariables) {\n variables = project.getVariables();\n } else {\n variables = project.getColorVariables();\n }\n suggestions = this.findSuggestionsForPrefix(variables, prefix);\n return suggestions;\n }\n\n getPrefix(editor, bufferPosition) {\n var line, ref;\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition]);\n return ((ref = line.match(new RegExp(variablesRegExp + '$'))) != null ? ref[0] : void 0) || '';\n }\n\n findSuggestionsForPrefix(variables, prefix) {\n var matchedVariables, suggestions;\n if (variables == null) {\n return [];\n }\n suggestions = [];\n return matchedVariables = variables.filter(function(v) {\n return RegExp(`^${_.escapeRegExp(prefix)}`).test(v.name);\n });\n }\n\n};\n```", "response": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:completion", "type": "completion", "prompt": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n\n dispose: ->\n @disposed = true\n @subscriptions.dispose()\n @pigments = null\n\n getProject: ->\n return if @disposed\n @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->", "response": "return if @disposed\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "matchedVariables.forEach (v) ->\n if v.isColor\n suggestions.push {\n text: v.name\n rightLabelHTML: \"\"\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 51, "line_end": 67} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmatchedVariables.forEach (v) ->\n if v.isColor\n suggestions.push {\n text: v.name\n rightLabelHTML: \"\"\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions\n```", "response": "matchedVariables.forEach(function(v) {\n if (v.isColor) {\n return suggestions.push({\n text: v.name,\n rightLabelHTML: ``,\n replacementPrefix: prefix,\n className: 'color-suggestion'\n });\n } else {\n return suggestions.push({\n text: v.name,\n rightLabel: v.value,\n replacementPrefix: prefix,\n className: 'pigments-suggestion'\n });\n }\n});\n\nsuggestions;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 51, "line_end": 67} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmatchedVariables.forEach(function(v) {\n if (v.isColor) {\n return suggestions.push({\n text: v.name,\n rightLabelHTML: ``,\n replacementPrefix: prefix,\n className: 'color-suggestion'\n });\n } else {\n return suggestions.push({\n text: v.name,\n rightLabel: v.value,\n replacementPrefix: prefix,\n className: 'pigments-suggestion'\n });\n }\n});\n\nsuggestions;\n```", "response": "matchedVariables.forEach (v) ->\n if v.isColor\n suggestions.push {\n text: v.name\n rightLabelHTML: \"\"\n replacementPrefix: prefix\n className: 'color-suggestion'\n }\n else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 51, "line_end": 67} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:2:completion", "type": "completion", "prompt": "matchedVariables.forEach (v) ->\n if v.isColor\n suggestions.push {\n text: v.name\n rightLabelHTML: \"\"\n replacementPrefix: prefix\n className: 'color-suggestion'\n }", "response": "else\n suggestions.push {\n text: v.name\n rightLabel: v.value\n replacementPrefix: prefix\n className: 'pigments-suggestion'\n }\n\n suggestions", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "14d2d26e2807638e84d89a5e4d46e1e049356d61", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/14d2d26e2807638e84d89a5e4d46e1e049356d61/lib/pigments-provider.coffee", "line_start": 51, "line_end": 67} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n\n dispose: ->\n @subscriptions.dispose()\n @pigments = null\n\n getProject: -> @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?\n\n if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name\n\n matchedVariables.forEach (v) ->\n if v.isColor\n suggestions.push {\n text: v.name", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "abe33/atom-pigments:lib/pigments-provider.coffee:1:completion", "type": "completion", "prompt": "_ = require 'underscore-plus'\n{CompositeDisposable, Range} = require 'atom'\n{variables: variablesRegExp} = require './regexes'\n\nmodule.exports =\nclass PigmentsProvider\n constructor: (@pigments) ->\n @subscriptions = new CompositeDisposable\n @selector = atom.config.get('pigments.autocompleteScopes').join(',')\n\n @subscriptions.add atom.config.observe 'pigments.autocompleteScopes', (scopes) =>\n @selector = scopes.join(',')\n @subscriptions.add atom.config.observe 'pigments.extendAutocompleteToVariables', (@extendAutocompleteToVariables) =>\n\n dispose: ->\n @subscriptions.dispose()\n @pigments = null\n\n getProject: -> @pigments.getProject()\n\n getSuggestions: ({editor, bufferPosition}) ->\n prefix = @getPrefix(editor, bufferPosition)\n project = @getProject()\n return unless prefix?.length\n return unless project?", "response": "if @extendAutocompleteToVariables\n variables = project.getVariables()\n else\n variables = project.getColorVariables()\n\n suggestions = @findSuggestionsForPrefix(variables, prefix)\n suggestions\n\n getPrefix: (editor, bufferPosition) ->\n line = editor.getTextInRange([[bufferPosition.row, 0], bufferPosition])\n\n line.match(new RegExp(variablesRegExp + '$'))?[0] or ''\n\n findSuggestionsForPrefix: (variables, prefix) ->\n return [] unless variables?\n\n suggestions = []\n\n matchedVariables = variables.filter (v) -> ///^#{_.escapeRegExp prefix}///.test v.name\n\n matchedVariables.forEach (v) ->\n if v.isColor\n suggestions.push {\n text: v.name", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/pigments-provider.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/pigments-provider.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector.Selecter)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.input.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.input.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.input.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.input.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.input.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.input.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexpect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector.Selecter)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.input.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.input.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.input.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.input.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.input.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.input.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n```", "response": "var assert, expect;\n\nexpect = chai.expect;\n\nassert = chai.assert;\n\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector.Selecter);\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector);\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector);\n return expect(engine.input.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.input.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.input.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.input.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.input.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.input.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.input.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n return expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar assert, expect;\n\nexpect = chai.expect;\n\nassert = chai.assert;\n\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector.Selecter);\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector);\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector);\n return expect(engine.input.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.input.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.input.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.input.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.input.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.input.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.input.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n return expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n });\n });\n});\n```", "response": "expect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector.Selecter)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.input.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.input.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.input.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.input.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.input.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.input.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:completion", "type": "completion", "prompt": "expect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector.Selecter)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', 'div'])).to.be.an.instanceof(engine.input.Selector)\n expect(engine.input.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.input.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.input.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.input.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.input.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')", "response": "expect(engine.input.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.input.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.input.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.input.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.input.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.input.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.input.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.input.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{expect} = chai\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "6a63309b1f8130d1e894376c799115b26b037983", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a63309b1f8130d1e894376c799115b26b037983/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{expect} = chai\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n```", "response": "var expect;\n\n({expect} = chai);\n\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n return expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "6a63309b1f8130d1e894376c799115b26b037983", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a63309b1f8130d1e894376c799115b26b037983/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar expect;\n\n({expect} = chai);\n\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n return expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n });\n });\n});\n```", "response": "{expect} = chai\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "6a63309b1f8130d1e894376c799115b26b037983", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a63309b1f8130d1e894376c799115b26b037983/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:completion", "type": "completion", "prompt": "{expect} = chai\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')", "response": "expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "6a63309b1f8130d1e894376c799115b26b037983", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6a63309b1f8130d1e894376c799115b26b037983/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexpect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n```", "response": "var assert, expect;\n\nexpect = chai.expect;\n\nassert = chai.assert;\n\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n return expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar assert, expect;\n\nexpect = chai.expect;\n\nassert = chai.assert;\n\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n return expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n });\n });\n});\n```", "response": "expect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:completion", "type": "completion", "prompt": "expect = chai.expect\nassert = chai.assert\n\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')", "response": "expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/46d7f4fab6d9b171a2f3e5b2ebc1dd21cfd2fadd/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "13326bc09a304dcc434839b06f28601134e5f2c1", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n```", "response": "describe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(void 0);\n return expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(void 0);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "13326bc09a304dcc434839b06f28601134e5f2c1", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(void 0);\n return expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(void 0);\n });\n });\n});\n```", "response": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "13326bc09a304dcc434839b06f28601134e5f2c1", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:completion", "type": "completion", "prompt": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['tag', ['&'], 'h1']).path).to.eql('&h1')\n\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')", "response": "it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "13326bc09a304dcc434839b06f28601134e5f2c1", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/13326bc09a304dcc434839b06f28601134e5f2c1/spec/selectors.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:spec/selectors.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "d720219bbc9b30190271321a31dd8e2509e1ac81", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d720219bbc9b30190271321a31dd8e2509e1ac81/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "gss/engine:spec/selectors.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)\n```", "response": "describe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(void 0);\n return expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(void 0);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "d720219bbc9b30190271321a31dd8e2509e1ac81", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d720219bbc9b30190271321a31dd8e2509e1ac81/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "gss/engine:spec/selectors.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile();\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(void 0);\n return expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(void 0);\n });\n });\n});\n```", "response": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "d720219bbc9b30190271321a31dd8e2509e1ac81", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d720219bbc9b30190271321a31dd8e2509e1ac81/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "gss/engine:spec/selectors.coffee:1:completion", "type": "completion", "prompt": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile()\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')", "response": "it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "d720219bbc9b30190271321a31dd8e2509e1ac81", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d720219bbc9b30190271321a31dd8e2509e1ac81/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "gss/engine:spec/selectors.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile(true)\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "5aa596c9cf990a0b753a83e89c00cd4175422b77", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/5aa596c9cf990a0b753a83e89c00cd4175422b77/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "gss/engine:spec/selectors.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndescribe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile(true)\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)\n```", "response": "describe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile(true);\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(void 0);\n return expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(void 0);\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "5aa596c9cf990a0b753a83e89c00cd4175422b77", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/5aa596c9cf990a0b753a83e89c00cd4175422b77/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "gss/engine:spec/selectors.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndescribe('Selectors', function() {\n var engine;\n engine = null;\n before(function() {\n var container;\n container = document.createElement('div');\n engine = new GSS(container);\n return engine.compile(true);\n });\n return describe('dispatched by argument types', function() {\n it('should create command instance for each operation', function() {\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector);\n return expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier);\n });\n it('should have absolute and relative path set for each command', function() {\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div');\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active');\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em');\n return expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]');\n });\n it('should group commands by tags', function() {\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button');\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button');\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active');\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active');\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active');\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ');\n return expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active');\n });\n return it('should group elements in comma', function() {\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~');\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(void 0);\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(void 0);\n return expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(void 0);\n });\n });\n});\n```", "response": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile(true)\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')\n\n it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "5aa596c9cf990a0b753a83e89c00cd4175422b77", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/5aa596c9cf990a0b753a83e89c00cd4175422b77/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "gss/engine:spec/selectors.coffee:1:completion", "type": "completion", "prompt": "describe 'Selectors', ->\n engine = null\n before ->\n container = document.createElement('div')\n engine = new GSS(container)\n engine.compile(true)\n\n describe 'dispatched by argument types', ->\n it 'should create command instance for each operation', ->\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector.Selecter)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', 'div'])).to.be.an.instanceof(engine.document.Selector)\n expect(engine.document.Command(['tag', ['tag', 'div'], 'div'])).to.be.an.instanceof(engine.document.Selector.Qualifier)\n\n it 'should have absolute and relative path set for each command', ->\n expect(engine.document.Command(['tag', 'div']).path).to.eql('div')\n expect(engine.document.Command(['tag', 'h1']).key).to.eql('h1')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).path).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).key).to.eql('.active')\n\n expect(engine.document.Command(['tag', ['+', ['.', ['tag', 'p'], 'active']], 'em']).path).to.eql('p.active+em')\n\n expect(engine.document.Command(['[*=]', ['+', ['.', ['tag', 'p'], 'active']], 'em', 'v']).path).to.eql('p.active+[em*=\"v\"]')", "response": "it 'should group commands by tags', ->\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).selector).to.eql(' #button')\n expect(engine.document.Command(['#', [' ', ['.', ['tag', ['>'], 'p'], 'active']], 'button']).path).to.eql('>p.active #button')\n expect(engine.document.Command(['.', ['tag', 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).path).to.eql('~~p.active')\n expect(engine.document.Command(['.', ['tag', ['~~'], 'p'], 'active']).selector).to.eql('p.active')\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command(['!~', ['.', ['tag', ['~~'], 'p'], 'active']]).path).to.eql('~~p.active!~')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).head.command.path).to.eql('~~ p.active')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).tail.command.path).to.eql('~~ ')\n expect(engine.document.Command(['.', ['tag', [' ', ['~~']], 'p'], 'active']).selector).to.eql(' p.active')\n\n it 'should group elements in comma', ->\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).selector).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).tail.command.path).to.eql('p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active']]).head.command.path).to.eql('p.active')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).selector).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['tag', 'p']]).path).to.eql('p.active,p')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).path).to.eql('p.active,p~~')\n expect(engine.document.Command([',', ['.', ['tag', 'p'], 'active'], ['~~', ['tag', 'p']]]).selector).to.eql(undefined)\n\n expect(engine.document.Command([',', ['.', ['~~'], 'active'], ['.', ['++'], 'active']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', [' ', ['$']], 'b']]).selector).to.eql(undefined)\n expect(engine.document.Command([',', ['.', 'a'], ['.', ['$'], 'b']]).selector).to.eql(undefined)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "spec/selectors.coffee", "license": "MIT", "commit": "5aa596c9cf990a0b753a83e89c00cd4175422b77", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/5aa596c9cf990a0b753a83e89c00cd4175422b77/spec/selectors.coffee", "line_start": 1, "line_end": 49} +{"id": "meltingice/psd.js:lib/psd/layer_info/metadata_setting.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "LayerInfo = require '../layer_info.coffee'\nDescriptor = require '../descriptor.coffee'\n\nmodule.exports = class LayerId extends LayerInfo\n @shouldParse: (key) -> key is 'shmd'\n\n parse: ->\n count = @file.readInt()\n\n for i in [0...count]\n @file.seek 4, true\n\n key = @file.readString(4)\n\n copyOnSheetDup = @file.readByte()\n @file.seek 3, true #padding\n\n len = @file.readInt()\n end = @file.tell() + len\n\n @parseLayerComps() if key is 'cmls'\n\n @file.seek end\n\n parseLayerComps: ->\n @file.seek 4, true\n @data.layerComp = new Descriptor(@file).parse()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/metadata_setting.coffee", "license": "MIT", "commit": "7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167/lib/psd/layer_info/metadata_setting.coffee", "line_start": 1, "line_end": 27} +{"id": "meltingice/psd.js:lib/psd/layer_info/metadata_setting.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nLayerInfo = require '../layer_info.coffee'\nDescriptor = require '../descriptor.coffee'\n\nmodule.exports = class LayerId extends LayerInfo\n @shouldParse: (key) -> key is 'shmd'\n\n parse: ->\n count = @file.readInt()\n\n for i in [0...count]\n @file.seek 4, true\n\n key = @file.readString(4)\n\n copyOnSheetDup = @file.readByte()\n @file.seek 3, true #padding\n\n len = @file.readInt()\n end = @file.tell() + len\n\n @parseLayerComps() if key is 'cmls'\n\n @file.seek end\n\n parseLayerComps: ->\n @file.seek 4, true\n @data.layerComp = new Descriptor(@file).parse()\n```", "response": "var Descriptor, LayerId, LayerInfo;\n\nLayerInfo = require('../layer_info.coffee');\n\nDescriptor = require('../descriptor.coffee');\n\nmodule.exports = LayerId = class LayerId extends LayerInfo {\n static shouldParse(key) {\n return key === 'shmd';\n }\n\n parse() {\n var copyOnSheetDup, count, end, i, j, key, len, ref, results;\n count = this.file.readInt();\n results = [];\n for (i = j = 0, ref = count; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {\n this.file.seek(4, true);\n key = this.file.readString(4);\n copyOnSheetDup = this.file.readByte();\n this.file.seek(3, true); //padding\n len = this.file.readInt();\n end = this.file.tell() + len;\n if (key === 'cmls') {\n this.parseLayerComps();\n }\n results.push(this.file.seek(end));\n }\n return results;\n }\n\n parseLayerComps() {\n this.file.seek(4, true);\n return this.data.layerComp = new Descriptor(this.file).parse();\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/metadata_setting.coffee", "license": "MIT", "commit": "7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167/lib/psd/layer_info/metadata_setting.coffee", "line_start": 1, "line_end": 27} +{"id": "meltingice/psd.js:lib/psd/layer_info/metadata_setting.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Descriptor, LayerId, LayerInfo;\n\nLayerInfo = require('../layer_info.coffee');\n\nDescriptor = require('../descriptor.coffee');\n\nmodule.exports = LayerId = class LayerId extends LayerInfo {\n static shouldParse(key) {\n return key === 'shmd';\n }\n\n parse() {\n var copyOnSheetDup, count, end, i, j, key, len, ref, results;\n count = this.file.readInt();\n results = [];\n for (i = j = 0, ref = count; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {\n this.file.seek(4, true);\n key = this.file.readString(4);\n copyOnSheetDup = this.file.readByte();\n this.file.seek(3, true); //padding\n len = this.file.readInt();\n end = this.file.tell() + len;\n if (key === 'cmls') {\n this.parseLayerComps();\n }\n results.push(this.file.seek(end));\n }\n return results;\n }\n\n parseLayerComps() {\n this.file.seek(4, true);\n return this.data.layerComp = new Descriptor(this.file).parse();\n }\n\n};\n```", "response": "LayerInfo = require '../layer_info.coffee'\nDescriptor = require '../descriptor.coffee'\n\nmodule.exports = class LayerId extends LayerInfo\n @shouldParse: (key) -> key is 'shmd'\n\n parse: ->\n count = @file.readInt()\n\n for i in [0...count]\n @file.seek 4, true\n\n key = @file.readString(4)\n\n copyOnSheetDup = @file.readByte()\n @file.seek 3, true #padding\n\n len = @file.readInt()\n end = @file.tell() + len\n\n @parseLayerComps() if key is 'cmls'\n\n @file.seek end\n\n parseLayerComps: ->\n @file.seek 4, true\n @data.layerComp = new Descriptor(@file).parse()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/metadata_setting.coffee", "license": "MIT", "commit": "7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167/lib/psd/layer_info/metadata_setting.coffee", "line_start": 1, "line_end": 27} +{"id": "meltingice/psd.js:lib/psd/layer_info/metadata_setting.coffee:1:completion", "type": "completion", "prompt": "LayerInfo = require '../layer_info.coffee'\nDescriptor = require '../descriptor.coffee'\n\nmodule.exports = class LayerId extends LayerInfo\n @shouldParse: (key) -> key is 'shmd'\n\n parse: ->\n count = @file.readInt()\n\n for i in [0...count]\n @file.seek 4, true\n\n key = @file.readString(4)", "response": "copyOnSheetDup = @file.readByte()\n @file.seek 3, true #padding\n\n len = @file.readInt()\n end = @file.tell() + len\n\n @parseLayerComps() if key is 'cmls'\n\n @file.seek end\n\n parseLayerComps: ->\n @file.seek 4, true\n @data.layerComp = new Descriptor(@file).parse()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/metadata_setting.coffee", "license": "MIT", "commit": "7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7b0442b02937ada2ca2d46ac7a2fb3ad6ec67167/lib/psd/layer_info/metadata_setting.coffee", "line_start": 1, "line_end": 27} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "debug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\nlogError = require 'logError'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis\n .multi()\n .incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return logError error if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "1b93806a9321e5dda42d3d937968cab3d88ac39e", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/1b93806a9321e5dda42d3d937968cab3d88ac39e/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 43} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndebug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\nlogError = require 'logError'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis\n .multi()\n .incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return logError error if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END\n```", "response": "var RedisThrottle, debug, logError, moment, redis;\n\ndebug = require('debug')('meshblu:RedisThrottle');\n\nmoment = require('moment');\n\nredis = require('./redis');\n\nlogError = require('logError');\n\n/*\n THIS DOESN'T WORK YET!!\n*/\nRedisThrottle = class RedisThrottle {\n constructor(name, rate) {\n this.rateLimit = this.rateLimit.bind(this);\n this.name = name;\n this.rate = rate;\n debug('constructor', this.name, this.rate);\n }\n\n rateLimit(id = \"\", callback = function() {}) {\n var key;\n key = `${this.name}:${id}:${moment().unix()}`;\n debug('rateLimit', callback);\n return redis.get(key, (error, value) => {\n if (value > 10) {\n return;\n }\n return redis.multi().incr(key, 1).expire(key, 10).exec((error) => {\n if (error != null) {\n return logError(error);\n }\n return callback();\n });\n });\n }\n\n};\n\nmodule.exports = RedisThrottle;\n\n// FUNCTION LIMIT_API_CALL(ip)\n// ts = CURRENT_UNIX_TIME()\n// keyname = ip+\":\"+ts\n// current = GET(keyname)\n// IF current != NULL AND current > 10 THEN\n// ERROR \"too many requests per second\"\n// ELSE\n// MULTI\n// INCR(keyname,1)\n// EXPIRE(keyname,10)\n// EXEC\n// PERFORM_API_CALL()\n// END", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "1b93806a9321e5dda42d3d937968cab3d88ac39e", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/1b93806a9321e5dda42d3d937968cab3d88ac39e/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 43} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar RedisThrottle, debug, logError, moment, redis;\n\ndebug = require('debug')('meshblu:RedisThrottle');\n\nmoment = require('moment');\n\nredis = require('./redis');\n\nlogError = require('logError');\n\n/*\n THIS DOESN'T WORK YET!!\n*/\nRedisThrottle = class RedisThrottle {\n constructor(name, rate) {\n this.rateLimit = this.rateLimit.bind(this);\n this.name = name;\n this.rate = rate;\n debug('constructor', this.name, this.rate);\n }\n\n rateLimit(id = \"\", callback = function() {}) {\n var key;\n key = `${this.name}:${id}:${moment().unix()}`;\n debug('rateLimit', callback);\n return redis.get(key, (error, value) => {\n if (value > 10) {\n return;\n }\n return redis.multi().incr(key, 1).expire(key, 10).exec((error) => {\n if (error != null) {\n return logError(error);\n }\n return callback();\n });\n });\n }\n\n};\n\nmodule.exports = RedisThrottle;\n\n// FUNCTION LIMIT_API_CALL(ip)\n// ts = CURRENT_UNIX_TIME()\n// keyname = ip+\":\"+ts\n// current = GET(keyname)\n// IF current != NULL AND current > 10 THEN\n// ERROR \"too many requests per second\"\n// ELSE\n// MULTI\n// INCR(keyname,1)\n// EXPIRE(keyname,10)\n// EXEC\n// PERFORM_API_CALL()\n// END\n```", "response": "debug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\nlogError = require 'logError'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis\n .multi()\n .incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return logError error if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "1b93806a9321e5dda42d3d937968cab3d88ac39e", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/1b93806a9321e5dda42d3d937968cab3d88ac39e/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 43} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:completion", "type": "completion", "prompt": "debug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\nlogError = require 'logError'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis", "response": ".multi()\n .incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return logError error if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "1b93806a9321e5dda42d3d937968cab3d88ac39e", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/1b93806a9321e5dda42d3d937968cab3d88ac39e/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 43} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "debug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis\n .multi()\n .incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return console.error error.stack if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "3062961ddc051199277be35d6164d656b8329d6a", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 42} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndebug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis\n .multi()\n .incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return console.error error.stack if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END\n```", "response": "var RedisThrottle, debug, moment, redis;\n\ndebug = require('debug')('meshblu:RedisThrottle');\n\nmoment = require('moment');\n\nredis = require('./redis');\n\n/*\n THIS DOESN'T WORK YET!!\n*/\nRedisThrottle = class RedisThrottle {\n constructor(name, rate) {\n this.rateLimit = this.rateLimit.bind(this);\n this.name = name;\n this.rate = rate;\n debug('constructor', this.name, this.rate);\n }\n\n rateLimit(id = \"\", callback = function() {}) {\n var key;\n key = `${this.name}:${id}:${moment().unix()}`;\n debug('rateLimit', callback);\n return redis.get(key, (error, value) => {\n if (value > 10) {\n return;\n }\n return redis.multi().incr(key, 1).expire(key, 10).exec((error) => {\n if (error != null) {\n return console.error(error.stack);\n }\n return callback();\n });\n });\n }\n\n};\n\nmodule.exports = RedisThrottle;\n\n// FUNCTION LIMIT_API_CALL(ip)\n// ts = CURRENT_UNIX_TIME()\n// keyname = ip+\":\"+ts\n// current = GET(keyname)\n// IF current != NULL AND current > 10 THEN\n// ERROR \"too many requests per second\"\n// ELSE\n// MULTI\n// INCR(keyname,1)\n// EXPIRE(keyname,10)\n// EXEC\n// PERFORM_API_CALL()\n// END", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "3062961ddc051199277be35d6164d656b8329d6a", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 42} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar RedisThrottle, debug, moment, redis;\n\ndebug = require('debug')('meshblu:RedisThrottle');\n\nmoment = require('moment');\n\nredis = require('./redis');\n\n/*\n THIS DOESN'T WORK YET!!\n*/\nRedisThrottle = class RedisThrottle {\n constructor(name, rate) {\n this.rateLimit = this.rateLimit.bind(this);\n this.name = name;\n this.rate = rate;\n debug('constructor', this.name, this.rate);\n }\n\n rateLimit(id = \"\", callback = function() {}) {\n var key;\n key = `${this.name}:${id}:${moment().unix()}`;\n debug('rateLimit', callback);\n return redis.get(key, (error, value) => {\n if (value > 10) {\n return;\n }\n return redis.multi().incr(key, 1).expire(key, 10).exec((error) => {\n if (error != null) {\n return console.error(error.stack);\n }\n return callback();\n });\n });\n }\n\n};\n\nmodule.exports = RedisThrottle;\n\n// FUNCTION LIMIT_API_CALL(ip)\n// ts = CURRENT_UNIX_TIME()\n// keyname = ip+\":\"+ts\n// current = GET(keyname)\n// IF current != NULL AND current > 10 THEN\n// ERROR \"too many requests per second\"\n// ELSE\n// MULTI\n// INCR(keyname,1)\n// EXPIRE(keyname,10)\n// EXEC\n// PERFORM_API_CALL()\n// END\n```", "response": "debug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis\n .multi()\n .incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return console.error error.stack if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "3062961ddc051199277be35d6164d656b8329d6a", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 42} +{"id": "octoblu/meshblu:lib/RedisThrottle.coffee:1:completion", "type": "completion", "prompt": "debug = require('debug')('meshblu:RedisThrottle')\nmoment = require 'moment'\nredis = require './redis'\n\n###\n THIS DOESN'T WORK YET!!\n###\n\nclass RedisThrottle\n constructor: (@name, @rate) ->\n debug 'constructor', @name, @rate\n\n rateLimit: (id=\"\", callback=->) =>\n key = \"#{@name}:#{id}:#{moment().unix()}\"\n debug 'rateLimit', callback\n\n redis.get key, (error, value) =>\n return if value > 10\n\n redis\n .multi()", "response": ".incr(key, 1)\n .expire(key, 10)\n .exec (error) =>\n return console.error error.stack if error?\n callback()\n\nmodule.exports = RedisThrottle\n\n# FUNCTION LIMIT_API_CALL(ip)\n# ts = CURRENT_UNIX_TIME()\n# keyname = ip+\":\"+ts\n# current = GET(keyname)\n# IF current != NULL AND current > 10 THEN\n# ERROR \"too many requests per second\"\n# ELSE\n# MULTI\n# INCR(keyname,1)\n# EXPIRE(keyname,10)\n# EXEC\n# PERFORM_API_CALL()\n# END", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "lib/RedisThrottle.coffee", "license": "MIT", "commit": "3062961ddc051199277be35d6164d656b8329d6a", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/RedisThrottle.coffee", "line_start": 1, "line_end": 42} +{"id": "nevir/groc:lib/languages.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n multiLineComment: ['/*', '*', '*/']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:\n nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "58626adda48d38c20aeb82d81abad4cc9e459512", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/58626adda48d38c20aeb82d81abad4cc9e459512/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "nevir/groc:lib/languages.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n multiLineComment: ['/*', '*', '*/']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:\n nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'\n```", "response": "var LANGUAGES;\n\nmodule.exports = LANGUAGES = {\n Markdown: {\n nameMatchers: ['.md'],\n commentsOnly: true\n },\n C: {\n nameMatchers: ['.c', '.h'],\n pygmentsLexer: 'c',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n CSharp: {\n nameMatchers: ['.cs'],\n pygmentsLexer: 'csharp',\n singleLineComment: ['//'],\n multiLineComment: ['/*', '*', '*/'],\n ignorePrefix: '}'\n },\n 'C++': {\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx'],\n pygmentsLexer: 'cpp',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Clojure: {\n nameMatchers: ['.clj'],\n pygmentsLexer: 'clojure',\n singleLineComment: [';;'],\n ignorePrefix: '}'\n },\n CoffeeScript: {\n nameMatchers: ['.coffee', 'Cakefile'],\n pygmentsLexer: 'coffee-script',\n singleLineComment: ['#'],\n ignorePrefix: '}'\n },\n Go: {\n nameMatchers: ['.go'],\n pygmentsLexer: 'go',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Handlebars: {\n nameMatchers: ['.handlebars', '.hbs'],\n pygmentsLexer: 'html', // TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', // HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!',\n '',\n '}}' // Actual handlebars block comments\n ],\n ignorePrefix: '#'\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "58626adda48d38c20aeb82d81abad4cc9e459512", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/58626adda48d38c20aeb82d81abad4cc9e459512/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "nevir/groc:lib/languages.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar LANGUAGES;\n\nmodule.exports = LANGUAGES = {\n Markdown: {\n nameMatchers: ['.md'],\n commentsOnly: true\n },\n C: {\n nameMatchers: ['.c', '.h'],\n pygmentsLexer: 'c',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n CSharp: {\n nameMatchers: ['.cs'],\n pygmentsLexer: 'csharp',\n singleLineComment: ['//'],\n multiLineComment: ['/*', '*', '*/'],\n ignorePrefix: '}'\n },\n 'C++': {\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx'],\n pygmentsLexer: 'cpp',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Clojure: {\n nameMatchers: ['.clj'],\n pygmentsLexer: 'clojure',\n singleLineComment: [';;'],\n ignorePrefix: '}'\n },\n CoffeeScript: {\n nameMatchers: ['.coffee', 'Cakefile'],\n pygmentsLexer: 'coffee-script',\n singleLineComment: ['#'],\n ignorePrefix: '}'\n },\n Go: {\n nameMatchers: ['.go'],\n pygmentsLexer: 'go',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Handlebars: {\n nameMatchers: ['.handlebars', '.hbs'],\n pygmentsLexer: 'html', // TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', // HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!',\n '',\n '}}' // Actual handlebars block comments\n ],\n ignorePrefix: '#'\n }\n};\n```", "response": "module.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n multiLineComment: ['/*', '*', '*/']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:\n nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "58626adda48d38c20aeb82d81abad4cc9e459512", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/58626adda48d38c20aeb82d81abad4cc9e459512/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "nevir/groc:lib/languages.coffee:1:completion", "type": "completion", "prompt": "module.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n multiLineComment: ['/*', '*', '*/']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:", "response": "nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "58626adda48d38c20aeb82d81abad4cc9e459512", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/58626adda48d38c20aeb82d81abad4cc9e459512/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "nevir/groc:lib/languages.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:\n nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "ad86edafa7a9fb72a8ee61b09d20a58abf5104f8", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/ad86edafa7a9fb72a8ee61b09d20a58abf5104f8/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "nevir/groc:lib/languages.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:\n nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'\n```", "response": "var LANGUAGES;\n\nmodule.exports = LANGUAGES = {\n Markdown: {\n nameMatchers: ['.md'],\n commentsOnly: true\n },\n C: {\n nameMatchers: ['.c', '.h'],\n pygmentsLexer: 'c',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n CSharp: {\n nameMatchers: ['.cs'],\n pygmentsLexer: 'csharp',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n 'C++': {\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx'],\n pygmentsLexer: 'cpp',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Clojure: {\n nameMatchers: ['.clj'],\n pygmentsLexer: 'clojure',\n singleLineComment: [';;'],\n ignorePrefix: '}'\n },\n CoffeeScript: {\n nameMatchers: ['.coffee', 'Cakefile'],\n pygmentsLexer: 'coffee-script',\n singleLineComment: ['#'],\n ignorePrefix: '}'\n },\n Go: {\n nameMatchers: ['.go'],\n pygmentsLexer: 'go',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Handlebars: {\n nameMatchers: ['.handlebars', '.hbs'],\n pygmentsLexer: 'html', // TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', // HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!',\n '',\n '}}' // Actual handlebars block comments\n ],\n ignorePrefix: '#'\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "ad86edafa7a9fb72a8ee61b09d20a58abf5104f8", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/ad86edafa7a9fb72a8ee61b09d20a58abf5104f8/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "nevir/groc:lib/languages.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar LANGUAGES;\n\nmodule.exports = LANGUAGES = {\n Markdown: {\n nameMatchers: ['.md'],\n commentsOnly: true\n },\n C: {\n nameMatchers: ['.c', '.h'],\n pygmentsLexer: 'c',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n CSharp: {\n nameMatchers: ['.cs'],\n pygmentsLexer: 'csharp',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n 'C++': {\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx'],\n pygmentsLexer: 'cpp',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Clojure: {\n nameMatchers: ['.clj'],\n pygmentsLexer: 'clojure',\n singleLineComment: [';;'],\n ignorePrefix: '}'\n },\n CoffeeScript: {\n nameMatchers: ['.coffee', 'Cakefile'],\n pygmentsLexer: 'coffee-script',\n singleLineComment: ['#'],\n ignorePrefix: '}'\n },\n Go: {\n nameMatchers: ['.go'],\n pygmentsLexer: 'go',\n singleLineComment: ['//'],\n ignorePrefix: '}'\n },\n Handlebars: {\n nameMatchers: ['.handlebars', '.hbs'],\n pygmentsLexer: 'html', // TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', // HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!',\n '',\n '}}' // Actual handlebars block comments\n ],\n ignorePrefix: '#'\n }\n};\n```", "response": "module.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:\n nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "ad86edafa7a9fb72a8ee61b09d20a58abf5104f8", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/ad86edafa7a9fb72a8ee61b09d20a58abf5104f8/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "nevir/groc:lib/languages.coffee:1:completion", "type": "completion", "prompt": "module.exports = LANGUAGES =\n Markdown:\n nameMatchers: ['.md']\n commentsOnly: true\n\n C:\n nameMatchers: ['.c', '.h']\n pygmentsLexer: 'c'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n CSharp:\n nameMatchers: ['.cs']\n pygmentsLexer: 'csharp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n 'C++':\n nameMatchers: ['.cpp', '.hpp', '.c++', '.h++', '.cc', '.hh', '.cxx', '.hxx']\n pygmentsLexer: 'cpp'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Clojure:", "response": "nameMatchers: ['.clj']\n pygmentsLexer: 'clojure'\n singleLineComment: [';;']\n ignorePrefix: '}'\n\n CoffeeScript:\n nameMatchers: ['.coffee', 'Cakefile']\n pygmentsLexer: 'coffee-script'\n singleLineComment: ['#']\n ignorePrefix: '}'\n\n Go:\n nameMatchers: ['.go']\n pygmentsLexer: 'go'\n singleLineComment: ['//']\n ignorePrefix: '}'\n\n Handlebars:\n nameMatchers: ['.handlebars', '.hbs']\n pygmentsLexer: 'html' # TODO: is there a handlebars/mustache lexer? Nope. Lame.\n multiLineComment: [\n '', # HTML block comments go first, for code highlighting / segment splitting purposes\n '{{!', '', '}}' # Actual handlebars block comments\n ]\n ignorePrefix: '#'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nevir/groc", "path": "lib/languages.coffee", "license": "MIT", "commit": "ad86edafa7a9fb72a8ee61b09d20a58abf5104f8", "stars": 579, "source_url": "https://github.com/nevir/groc/blob/ad86edafa7a9fb72a8ee61b09d20a58abf5104f8/lib/languages.coffee", "line_start": 3, "line_end": 52} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n level: 'error'\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/helpers.coffee", "line_start": 1, "line_end": 23} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n level: 'error'\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )\n```", "response": "// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar winston;\n\nwinston = require('winston');\n\nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n },\n logger: new winston.Logger({\n transports: [\n new winston.transports.Console({\n level: 'error',\n colorize: true,\n timestamp: function() {\n return new Date().toLocaleString();\n },\n prettyPrint: true\n })\n ]\n })\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/helpers.coffee", "line_start": 1, "line_end": 23} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar winston;\n\nwinston = require('winston');\n\nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n },\n logger: new winston.Logger({\n transports: [\n new winston.transports.Console({\n level: 'error',\n colorize: true,\n timestamp: function() {\n return new Date().toLocaleString();\n },\n prettyPrint: true\n })\n ]\n })\n};\n```", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n level: 'error'\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/helpers.coffee", "line_start": 1, "line_end": 23} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:completion", "type": "completion", "prompt": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()", "response": "logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n level: 'error'\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/helpers.coffee", "line_start": 1, "line_end": 23} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "cb4b8c59c23585743d92af2759d97a5d7680610d", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/cb4b8c59c23585743d92af2759d97a5d7680610d/src/helpers.coffee", "line_start": 1, "line_end": 22} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )\n```", "response": "// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar winston;\n\nwinston = require('winston');\n\nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n },\n logger: new winston.Logger({\n transports: [\n new winston.transports.Console({\n colorize: true,\n timestamp: function() {\n return new Date().toLocaleString();\n },\n prettyPrint: true\n })\n ]\n })\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "cb4b8c59c23585743d92af2759d97a5d7680610d", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/cb4b8c59c23585743d92af2759d97a5d7680610d/src/helpers.coffee", "line_start": 1, "line_end": 22} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar winston;\n\nwinston = require('winston');\n\nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n },\n logger: new winston.Logger({\n transports: [\n new winston.transports.Console({\n colorize: true,\n timestamp: function() {\n return new Date().toLocaleString();\n },\n prettyPrint: true\n })\n ]\n })\n};\n```", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "cb4b8c59c23585743d92af2759d97a5d7680610d", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/cb4b8c59c23585743d92af2759d97a5d7680610d/src/helpers.coffee", "line_start": 1, "line_end": 22} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:completion", "type": "completion", "prompt": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()", "response": "logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: ->\n new Date().toLocaleString()\n prettyPrint: true\n )\n ]\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "cb4b8c59c23585743d92af2759d97a5d7680610d", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/cb4b8c59c23585743d92af2759d97a5d7680610d/src/helpers.coffee", "line_start": 1, "line_end": 22} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: true\n prettyPrint: true\n )\n ]\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4a2a8264e418f773f720c5f4e83facfdf6b20d1b", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4a2a8264e418f773f720c5f4e83facfdf6b20d1b/src/helpers.coffee", "line_start": 1, "line_end": 21} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: true\n prettyPrint: true\n )\n ]\n )\n```", "response": "// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar winston;\n\nwinston = require('winston');\n\nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n },\n logger: new winston.Logger({\n transports: [\n new winston.transports.Console({\n colorize: true,\n timestamp: true,\n prettyPrint: true\n })\n ]\n })\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4a2a8264e418f773f720c5f4e83facfdf6b20d1b", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4a2a8264e418f773f720c5f4e83facfdf6b20d1b/src/helpers.coffee", "line_start": 1, "line_end": 21} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar winston;\n\nwinston = require('winston');\n\nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n },\n logger: new winston.Logger({\n transports: [\n new winston.transports.Console({\n colorize: true,\n timestamp: true,\n prettyPrint: true\n })\n ]\n })\n};\n```", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: true\n prettyPrint: true\n )\n ]\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4a2a8264e418f773f720c5f4e83facfdf6b20d1b", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4a2a8264e418f773f720c5f4e83facfdf6b20d1b/src/helpers.coffee", "line_start": 1, "line_end": 21} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:completion", "type": "completion", "prompt": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nwinston = require 'winston'\n\nmodule.exports =\n extractType: (target) ->", "response": "Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\n logger: new (winston.Logger) (\n transports: [\n new (winston.transports.Console)(\n colorize: true\n timestamp: true\n prettyPrint: true\n )\n ]\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "4a2a8264e418f773f720c5f4e83facfdf6b20d1b", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4a2a8264e418f773f720c5f4e83facfdf6b20d1b/src/helpers.coffee", "line_start": 1, "line_end": 21} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/helpers.coffee", "line_start": 1, "line_end": 9} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n```", "response": "// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/helpers.coffee", "line_start": 1, "line_end": 9} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// parsing source\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nmodule.exports = {\n extractType: function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n }\n};\n```", "response": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/helpers.coffee", "line_start": 1, "line_end": 9} +{"id": "outsideris/popularconvention:src/helpers.coffee:1:completion", "type": "completion", "prompt": "# parsing source\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.", "response": "# \n\nmodule.exports =\n extractType: (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/helpers.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/helpers.coffee", "line_start": 1, "line_end": 9} +{"id": "oozcitak/xmlbuilder-js:test/basic/text.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'Text Processing:', ->\n test 'Escape \"', ->\n eq(\n xml('test8', {}, {}, { headless: true }).ele('node', '\"').end()\n '\"'\n )\n\n test 'Text node with empty string', ->\n eq(\n xml('test9', {}, {}, { headless: true }).text('').end()\n ''\n )\n\n test 'Text node with empty string (pretty print)', ->\n eq(\n xml('test10', {}, {}, { headless: true }).text('').end()\n ''\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/text.coffee", "line_start": 1, "line_end": 18} +{"id": "oozcitak/xmlbuilder-js:test/basic/text.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'Text Processing:', ->\n test 'Escape \"', ->\n eq(\n xml('test8', {}, {}, { headless: true }).ele('node', '\"').end()\n '\"'\n )\n\n test 'Text node with empty string', ->\n eq(\n xml('test9', {}, {}, { headless: true }).text('').end()\n ''\n )\n\n test 'Text node with empty string (pretty print)', ->\n eq(\n xml('test10', {}, {}, { headless: true }).text('').end()\n ''\n )\n```", "response": "suite('Text Processing:', function() {\n test('Escape \"', function() {\n return eq(xml('test8', {}, {}, {\n headless: true\n }).ele('node', '\"').end(), '\"');\n });\n test('Text node with empty string', function() {\n return eq(xml('test9', {}, {}, {\n headless: true\n }).text('').end(), '');\n });\n return test('Text node with empty string (pretty print)', function() {\n return eq(xml('test10', {}, {}, {\n headless: true\n }).text('').end(), '');\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/text.coffee", "line_start": 1, "line_end": 18} +{"id": "oozcitak/xmlbuilder-js:test/basic/text.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('Text Processing:', function() {\n test('Escape \"', function() {\n return eq(xml('test8', {}, {}, {\n headless: true\n }).ele('node', '\"').end(), '\"');\n });\n test('Text node with empty string', function() {\n return eq(xml('test9', {}, {}, {\n headless: true\n }).text('').end(), '');\n });\n return test('Text node with empty string (pretty print)', function() {\n return eq(xml('test10', {}, {}, {\n headless: true\n }).text('').end(), '');\n });\n});\n```", "response": "suite 'Text Processing:', ->\n test 'Escape \"', ->\n eq(\n xml('test8', {}, {}, { headless: true }).ele('node', '\"').end()\n '\"'\n )\n\n test 'Text node with empty string', ->\n eq(\n xml('test9', {}, {}, { headless: true }).text('').end()\n ''\n )\n\n test 'Text node with empty string (pretty print)', ->\n eq(\n xml('test10', {}, {}, { headless: true }).text('').end()\n ''\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/text.coffee", "line_start": 1, "line_end": 18} +{"id": "oozcitak/xmlbuilder-js:test/basic/text.coffee:1:completion", "type": "completion", "prompt": "suite 'Text Processing:', ->\n test 'Escape \"', ->\n eq(\n xml('test8', {}, {}, { headless: true }).ele('node', '\"').end()\n '\"'\n )\n\n test 'Text node with empty string', ->\n eq(", "response": "xml('test9', {}, {}, { headless: true }).text('').end()\n ''\n )\n\n test 'Text node with empty string (pretty print)', ->\n eq(\n xml('test10', {}, {}, { headless: true }).text('').end()\n ''\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/basic/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/text.coffee", "line_start": 1, "line_end": 18} +{"id": "js2coffee/js2coffee:lib/support/debug.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Debugging provisions. Run `before -> require('./lib/support/debug')` in tests\n# to print out some debug information.\n###\n\nTransformerBase = require('../transformer_base')\n\nTransformerBase::onBeforeEnter = (node) ->\n msg = \"#{node.type}\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"\n print @depth, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\nTransformerBase::onBeforeExit = (node) ->\n msg = \"#{node.type}Exit\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"\n print @depth+1, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\n# Prints the current node.\nprint = (depth, nodeType, message=\"\") ->\n color = if (/\\*$/.test(nodeType)) then 35 else 30\n prefix = \"\\u001b[#{color}m#{nodeType}\\u001b[0m\"\n indent = \"\\u001b[#{30 + (depth % 5)}m· \\u001b[0m\"\n\n console.log \\\n Array(depth+1).join(indent) + prefix,\n message\n\n# Checks if a certain AST is broken.\nisBroken = (ast) ->\n output = require('util').inspect(ast, depth: 1000)\n if ~output.indexOf(\"[Circular]\")\n \"[Circular]\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/support/debug.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/support/debug.coffee", "line_start": 1, "line_end": 34} +{"id": "js2coffee/js2coffee:lib/support/debug.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Debugging provisions. Run `before -> require('./lib/support/debug')` in tests\n# to print out some debug information.\n###\n\nTransformerBase = require('../transformer_base')\n\nTransformerBase::onBeforeEnter = (node) ->\n msg = \"#{node.type}\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"\n print @depth, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\nTransformerBase::onBeforeExit = (node) ->\n msg = \"#{node.type}Exit\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"\n print @depth+1, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\n# Prints the current node.\nprint = (depth, nodeType, message=\"\") ->\n color = if (/\\*$/.test(nodeType)) then 35 else 30\n prefix = \"\\u001b[#{color}m#{nodeType}\\u001b[0m\"\n indent = \"\\u001b[#{30 + (depth % 5)}m· \\u001b[0m\"\n\n console.log \\\n Array(depth+1).join(indent) + prefix,\n message\n\n# Checks if a certain AST is broken.\nisBroken = (ast) ->\n output = require('util').inspect(ast, depth: 1000)\n if ~output.indexOf(\"[Circular]\")\n \"[Circular]\"\n```", "response": "/*\n * Debugging provisions. Run `before -> require('./lib/support/debug')` in tests\n * to print out some debug information.\n */\nvar TransformerBase, isBroken, print;\n\nTransformerBase = require('../transformer_base');\n\nTransformerBase.prototype.onBeforeEnter = function(node) {\n var broken, fn, msg;\n msg = `${node.type}`;\n fn = this[msg] != null;\n broken = isBroken(this.ast) || \"\";\n return print(this.depth, (fn ? `${msg} *` : `${msg}`), broken);\n};\n\nTransformerBase.prototype.onBeforeExit = function(node) {\n var broken, fn, msg;\n msg = `${node.type}Exit`;\n fn = this[msg] != null;\n broken = isBroken(this.ast) || \"\";\n return print(this.depth + 1, (fn ? `${msg} *` : `${msg}`), broken);\n};\n\n// Prints the current node.\nprint = function(depth, nodeType, message = \"\") {\n var color, indent, prefix;\n color = (/\\*$/.test(nodeType)) ? 35 : 30;\n prefix = `\\u001b[${color}m${nodeType}\\u001b[0m`;\n indent = `\\u001b[${30 + (depth % 5)}m· \\u001b[0m`;\n return console.log(Array(depth + 1).join(indent) + prefix, message);\n};\n\n// Checks if a certain AST is broken.\nisBroken = function(ast) {\n var output;\n output = require('util').inspect(ast, {\n depth: 1000\n });\n if (~output.indexOf(\"[Circular]\")) {\n return \"[Circular]\";\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/support/debug.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/support/debug.coffee", "line_start": 1, "line_end": 34} +{"id": "js2coffee/js2coffee:lib/support/debug.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Debugging provisions. Run `before -> require('./lib/support/debug')` in tests\n * to print out some debug information.\n */\nvar TransformerBase, isBroken, print;\n\nTransformerBase = require('../transformer_base');\n\nTransformerBase.prototype.onBeforeEnter = function(node) {\n var broken, fn, msg;\n msg = `${node.type}`;\n fn = this[msg] != null;\n broken = isBroken(this.ast) || \"\";\n return print(this.depth, (fn ? `${msg} *` : `${msg}`), broken);\n};\n\nTransformerBase.prototype.onBeforeExit = function(node) {\n var broken, fn, msg;\n msg = `${node.type}Exit`;\n fn = this[msg] != null;\n broken = isBroken(this.ast) || \"\";\n return print(this.depth + 1, (fn ? `${msg} *` : `${msg}`), broken);\n};\n\n// Prints the current node.\nprint = function(depth, nodeType, message = \"\") {\n var color, indent, prefix;\n color = (/\\*$/.test(nodeType)) ? 35 : 30;\n prefix = `\\u001b[${color}m${nodeType}\\u001b[0m`;\n indent = `\\u001b[${30 + (depth % 5)}m· \\u001b[0m`;\n return console.log(Array(depth + 1).join(indent) + prefix, message);\n};\n\n// Checks if a certain AST is broken.\nisBroken = function(ast) {\n var output;\n output = require('util').inspect(ast, {\n depth: 1000\n });\n if (~output.indexOf(\"[Circular]\")) {\n return \"[Circular]\";\n }\n};\n```", "response": "###\n# Debugging provisions. Run `before -> require('./lib/support/debug')` in tests\n# to print out some debug information.\n###\n\nTransformerBase = require('../transformer_base')\n\nTransformerBase::onBeforeEnter = (node) ->\n msg = \"#{node.type}\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"\n print @depth, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\nTransformerBase::onBeforeExit = (node) ->\n msg = \"#{node.type}Exit\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"\n print @depth+1, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\n# Prints the current node.\nprint = (depth, nodeType, message=\"\") ->\n color = if (/\\*$/.test(nodeType)) then 35 else 30\n prefix = \"\\u001b[#{color}m#{nodeType}\\u001b[0m\"\n indent = \"\\u001b[#{30 + (depth % 5)}m· \\u001b[0m\"\n\n console.log \\\n Array(depth+1).join(indent) + prefix,\n message\n\n# Checks if a certain AST is broken.\nisBroken = (ast) ->\n output = require('util').inspect(ast, depth: 1000)\n if ~output.indexOf(\"[Circular]\")\n \"[Circular]\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/support/debug.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/support/debug.coffee", "line_start": 1, "line_end": 34} +{"id": "js2coffee/js2coffee:lib/support/debug.coffee:1:completion", "type": "completion", "prompt": "###\n# Debugging provisions. Run `before -> require('./lib/support/debug')` in tests\n# to print out some debug information.\n###\n\nTransformerBase = require('../transformer_base')\n\nTransformerBase::onBeforeEnter = (node) ->\n msg = \"#{node.type}\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"\n print @depth, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\nTransformerBase::onBeforeExit = (node) ->\n msg = \"#{node.type}Exit\"\n fn = @[msg]?\n broken = isBroken(@ast) or \"\"", "response": "print @depth+1, (if fn then \"#{msg} *\" else \"#{msg}\"), broken\n\n# Prints the current node.\nprint = (depth, nodeType, message=\"\") ->\n color = if (/\\*$/.test(nodeType)) then 35 else 30\n prefix = \"\\u001b[#{color}m#{nodeType}\\u001b[0m\"\n indent = \"\\u001b[#{30 + (depth % 5)}m· \\u001b[0m\"\n\n console.log \\\n Array(depth+1).join(indent) + prefix,\n message\n\n# Checks if a certain AST is broken.\nisBroken = (ast) ->\n output = require('util').inspect(ast, depth: 1000)\n if ~output.indexOf(\"[Circular]\")\n \"[Circular]\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/support/debug.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/support/debug.coffee", "line_start": 1, "line_end": 34} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (lineman) ->\n config:\n spec:\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/spec.coffee", "line_start": 1, "line_end": 6} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (lineman) ->\n config:\n spec:\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false\n```", "response": "module.exports = function(lineman) {\n return {\n config: {\n spec: {\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"],\n options: {\n growl: false\n }\n }\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/spec.coffee", "line_start": 1, "line_end": 6} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function(lineman) {\n return {\n config: {\n spec: {\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"],\n options: {\n growl: false\n }\n }\n }\n };\n};\n```", "response": "module.exports = (lineman) ->\n config:\n spec:\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/spec.coffee", "line_start": 1, "line_end": 6} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:completion", "type": "completion", "prompt": "module.exports = (lineman) ->\n config:\n spec:", "response": "files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/spec.coffee", "line_start": 1, "line_end": 6} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (lineman) ->\n config:\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/spec.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (lineman) ->\n config:\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false\n```", "response": "module.exports = function(lineman) {\n return {\n config: {\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"],\n options: {\n growl: false\n }\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/spec.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function(lineman) {\n return {\n config: {\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"],\n options: {\n growl: false\n }\n }\n };\n};\n```", "response": "module.exports = (lineman) ->\n config:\n files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/spec.coffee", "line_start": 1, "line_end": 5} +{"id": "linemanjs/lineman:config/plugins/spec.coffee:1:completion", "type": "completion", "prompt": "module.exports = (lineman) ->\n config:", "response": "files: [\"<%= files.js.concatenated %>\", \"<%= files.js.concatenatedSpec %>\"]\n options:\n growl: false", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/spec.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/spec.coffee", "line_start": 1, "line_end": 5} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"\n tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mediana\": tpl.median(frFmt)\n \"Diferencia\": tpl.var(1, frFmt)\n \"Desviación estándar de la muestra\": tpl.stdev(1, frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Primero\": tpl.first(frFmt),\n \"Pasado\": tpl.last(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncallWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"\n tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mediana\": tpl.median(frFmt)\n \"Diferencia\": tpl.var(1, frFmt)\n \"Desviación estándar de la muestra\": tpl.stdev(1, frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Primero\": tpl.first(frFmt),\n \"Pasado\": tpl.last(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)\n```", "response": "var callWithJQuery;\n\ncallWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") { // CommonJS\n return pivotModule(require(\"jquery\"));\n } else if (typeof define === \"function\" && define.amd) { // AMD\n return define([\"jquery\"], pivotModule);\n } else {\n // Plain browser env\n return pivotModule(jQuery);\n }\n};\n\ncallWithJQuery(function($) {\n var frFmt, frFmtInt, frFmtPct, nf, tpl;\n nf = $.pivotUtilities.numberFormat;\n tpl = $.pivotUtilities.aggregatorTemplates;\n frFmt = nf({\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtInt = nf({\n digitsAfterDecimal: 0,\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtPct = nf({\n digitsAfterDecimal: 1,\n scaler: 100,\n suffix: \"%\",\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n return $.pivotUtilities.locales.es = {\n localeStrings: {\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\",\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\",\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\",\n selectAll: \"Seleccionar todo\",\n selectNone: \"Deseleccionar todo\",\n tooMany: \"(demasiados valores)\",\n filterResults: \"Filtrar resultados\",\n totals: \"Totales\",\n vs: \"vs\",\n by: \"por\",\n apply: \"Aplicar\",\n cancel: \"Cancelar\"\n },\n aggregators: {\n \"Cuenta\": tpl.count(frFmtInt),\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt),\n \"Lista de valores únicos\": tpl.listUnique(\", \"),\n \"Suma\": tpl.sum(frFmt),\n \"Suma de enteros\": tpl.sum(frFmtInt),\n \"Promedio\": tpl.average(frFmt),\n \"Mediana\": tpl.median(frFmt),\n \"Diferencia\": tpl.var(1, frFmt),\n \"Desviación estándar de la muestra\": tpl.stdev(1, frFmt),\n \"Mínimo\": tpl.min(frFmt),\n \"Máximo\": tpl.max(frFmt),\n \"Primero\": tpl.first(frFmt),\n \"Pasado\": tpl.last(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt),\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt),\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar callWithJQuery;\n\ncallWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") { // CommonJS\n return pivotModule(require(\"jquery\"));\n } else if (typeof define === \"function\" && define.amd) { // AMD\n return define([\"jquery\"], pivotModule);\n } else {\n // Plain browser env\n return pivotModule(jQuery);\n }\n};\n\ncallWithJQuery(function($) {\n var frFmt, frFmtInt, frFmtPct, nf, tpl;\n nf = $.pivotUtilities.numberFormat;\n tpl = $.pivotUtilities.aggregatorTemplates;\n frFmt = nf({\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtInt = nf({\n digitsAfterDecimal: 0,\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtPct = nf({\n digitsAfterDecimal: 1,\n scaler: 100,\n suffix: \"%\",\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n return $.pivotUtilities.locales.es = {\n localeStrings: {\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\",\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\",\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\",\n selectAll: \"Seleccionar todo\",\n selectNone: \"Deseleccionar todo\",\n tooMany: \"(demasiados valores)\",\n filterResults: \"Filtrar resultados\",\n totals: \"Totales\",\n vs: \"vs\",\n by: \"por\",\n apply: \"Aplicar\",\n cancel: \"Cancelar\"\n },\n aggregators: {\n \"Cuenta\": tpl.count(frFmtInt),\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt),\n \"Lista de valores únicos\": tpl.listUnique(\", \"),\n \"Suma\": tpl.sum(frFmt),\n \"Suma de enteros\": tpl.sum(frFmtInt),\n \"Promedio\": tpl.average(frFmt),\n \"Mediana\": tpl.median(frFmt),\n \"Diferencia\": tpl.var(1, frFmt),\n \"Desviación estándar de la muestra\": tpl.stdev(1, frFmt),\n \"Mínimo\": tpl.min(frFmt),\n \"Máximo\": tpl.max(frFmt),\n \"Primero\": tpl.first(frFmt),\n \"Pasado\": tpl.last(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt),\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt),\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)\n }\n };\n});\n```", "response": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"\n tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mediana\": tpl.median(frFmt)\n \"Diferencia\": tpl.var(1, frFmt)\n \"Desviación estándar de la muestra\": tpl.stdev(1, frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Primero\": tpl.first(frFmt),\n \"Pasado\": tpl.last(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:completion", "type": "completion", "prompt": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"", "response": "tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mediana\": tpl.median(frFmt)\n \"Diferencia\": tpl.var(1, frFmt)\n \"Desviación estándar de la muestra\": tpl.stdev(1, frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Primero\": tpl.first(frFmt),\n \"Pasado\": tpl.last(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"\n tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)\n \"Proporción del total (suma)\": tpl.fractionOf(tpl.sum(), \"total\", frFmtPct)\n \"Proporción de la fila (suma)\": tpl.fractionOf(tpl.sum(), \"row\", frFmtPct)\n \"Proporción de la columna (suma)\": tpl.fractionOf(tpl.sum(), \"col\", frFmtPct)\n \"Proporción del total (cuenta)\": tpl.fractionOf(tpl.count(), \"total\", frFmtPct)\n \"Proporción de la fila (cuenta)\": tpl.fractionOf(tpl.count(), \"row\", frFmtPct)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "a49155d38b55ada4c07ec06f4382a4d61c756968", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/a49155d38b55ada4c07ec06f4382a4d61c756968/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncallWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"\n tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)\n \"Proporción del total (suma)\": tpl.fractionOf(tpl.sum(), \"total\", frFmtPct)\n \"Proporción de la fila (suma)\": tpl.fractionOf(tpl.sum(), \"row\", frFmtPct)\n \"Proporción de la columna (suma)\": tpl.fractionOf(tpl.sum(), \"col\", frFmtPct)\n \"Proporción del total (cuenta)\": tpl.fractionOf(tpl.count(), \"total\", frFmtPct)\n \"Proporción de la fila (cuenta)\": tpl.fractionOf(tpl.count(), \"row\", frFmtPct)\n```", "response": "var callWithJQuery;\n\ncallWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") { // CommonJS\n return pivotModule(require(\"jquery\"));\n } else if (typeof define === \"function\" && define.amd) { // AMD\n return define([\"jquery\"], pivotModule);\n } else {\n // Plain browser env\n return pivotModule(jQuery);\n }\n};\n\ncallWithJQuery(function($) {\n var frFmt, frFmtInt, frFmtPct, nf, tpl;\n nf = $.pivotUtilities.numberFormat;\n tpl = $.pivotUtilities.aggregatorTemplates;\n frFmt = nf({\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtInt = nf({\n digitsAfterDecimal: 0,\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtPct = nf({\n digitsAfterDecimal: 1,\n scaler: 100,\n suffix: \"%\",\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n return $.pivotUtilities.locales.es = {\n localeStrings: {\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\",\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\",\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\",\n selectAll: \"Seleccionar todo\",\n selectNone: \"Deseleccionar todo\",\n tooMany: \"(demasiados valores)\",\n filterResults: \"Filtrar resultados\",\n totals: \"Totales\",\n vs: \"vs\",\n by: \"por\",\n apply: \"Aplicar\",\n cancel: \"Cancelar\"\n },\n aggregators: {\n \"Cuenta\": tpl.count(frFmtInt),\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt),\n \"Lista de valores únicos\": tpl.listUnique(\", \"),\n \"Suma\": tpl.sum(frFmt),\n \"Suma de enteros\": tpl.sum(frFmtInt),\n \"Promedio\": tpl.average(frFmt),\n \"Mínimo\": tpl.min(frFmt),\n \"Máximo\": tpl.max(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt),\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt),\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt),\n \"Proporción del total (suma)\": tpl.fractionOf(tpl.sum(), \"total\", frFmtPct),\n \"Proporción de la fila (suma)\": tpl.fractionOf(tpl.sum(), \"row\", frFmtPct),\n \"Proporción de la columna (suma)\": tpl.fractionOf(tpl.sum(), \"col\", frFmtPct),\n \"Proporción del total (cuenta)\": tpl.fractionOf(tpl.count(), \"total\", frFmtPct),\n \"Proporción de la fila (cuenta)\": tpl.fractionOf(tpl.count(), \"row\", frFmtPct)\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "a49155d38b55ada4c07ec06f4382a4d61c756968", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/a49155d38b55ada4c07ec06f4382a4d61c756968/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar callWithJQuery;\n\ncallWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") { // CommonJS\n return pivotModule(require(\"jquery\"));\n } else if (typeof define === \"function\" && define.amd) { // AMD\n return define([\"jquery\"], pivotModule);\n } else {\n // Plain browser env\n return pivotModule(jQuery);\n }\n};\n\ncallWithJQuery(function($) {\n var frFmt, frFmtInt, frFmtPct, nf, tpl;\n nf = $.pivotUtilities.numberFormat;\n tpl = $.pivotUtilities.aggregatorTemplates;\n frFmt = nf({\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtInt = nf({\n digitsAfterDecimal: 0,\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n frFmtPct = nf({\n digitsAfterDecimal: 1,\n scaler: 100,\n suffix: \"%\",\n thousandsSep: \" \",\n decimalSep: \",\"\n });\n return $.pivotUtilities.locales.es = {\n localeStrings: {\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\",\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\",\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\",\n selectAll: \"Seleccionar todo\",\n selectNone: \"Deseleccionar todo\",\n tooMany: \"(demasiados valores)\",\n filterResults: \"Filtrar resultados\",\n totals: \"Totales\",\n vs: \"vs\",\n by: \"por\",\n apply: \"Aplicar\",\n cancel: \"Cancelar\"\n },\n aggregators: {\n \"Cuenta\": tpl.count(frFmtInt),\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt),\n \"Lista de valores únicos\": tpl.listUnique(\", \"),\n \"Suma\": tpl.sum(frFmt),\n \"Suma de enteros\": tpl.sum(frFmtInt),\n \"Promedio\": tpl.average(frFmt),\n \"Mínimo\": tpl.min(frFmt),\n \"Máximo\": tpl.max(frFmt),\n \"Suma de sumas\": tpl.sumOverSum(frFmt),\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt),\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt),\n \"Proporción del total (suma)\": tpl.fractionOf(tpl.sum(), \"total\", frFmtPct),\n \"Proporción de la fila (suma)\": tpl.fractionOf(tpl.sum(), \"row\", frFmtPct),\n \"Proporción de la columna (suma)\": tpl.fractionOf(tpl.sum(), \"col\", frFmtPct),\n \"Proporción del total (cuenta)\": tpl.fractionOf(tpl.count(), \"total\", frFmtPct),\n \"Proporción de la fila (cuenta)\": tpl.fractionOf(tpl.count(), \"row\", frFmtPct)\n }\n };\n});\n```", "response": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"\n tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)\n \"Proporción del total (suma)\": tpl.fractionOf(tpl.sum(), \"total\", frFmtPct)\n \"Proporción de la fila (suma)\": tpl.fractionOf(tpl.sum(), \"row\", frFmtPct)\n \"Proporción de la columna (suma)\": tpl.fractionOf(tpl.sum(), \"col\", frFmtPct)\n \"Proporción del total (cuenta)\": tpl.fractionOf(tpl.count(), \"total\", frFmtPct)\n \"Proporción de la fila (cuenta)\": tpl.fractionOf(tpl.count(), \"row\", frFmtPct)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "a49155d38b55ada4c07ec06f4382a4d61c756968", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/a49155d38b55ada4c07ec06f4382a4d61c756968/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "nicolaskruchten/pivottable:locales/pivot.es.coffee:1:completion", "type": "completion", "prompt": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n nf = $.pivotUtilities.numberFormat\n tpl = $.pivotUtilities.aggregatorTemplates\n\n frFmt = nf(thousandsSep: \" \", decimalSep: \",\")\n frFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: \" \", decimalSep: \",\")\n frFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: \"%\", thousandsSep: \" \", decimalSep: \",\")\n\n $.pivotUtilities.locales.es =\n\n localeStrings:\n renderError: \"Ocurrió un error durante la interpretación de la tabla dinámica.\"\n computeError: \"Ocurrió un error durante el cálculo de la tabla dinámica.\"\n uiRenderError: \"Ocurrió un error durante el dibujado de la tabla dinámica.\"\n selectAll: \"Seleccionar todo\"\n selectNone: \"Deseleccionar todo\"", "response": "tooMany: \"(demasiados valores)\"\n filterResults: \"Filtrar resultados\"\n totals: \"Totales\"\n vs: \"vs\"\n by: \"por\"\n apply: \"Aplicar\"\n cancel: \"Cancelar\"\n\n aggregators:\n \"Cuenta\": tpl.count(frFmtInt)\n \"Cuenta de valores únicos\": tpl.countUnique(frFmtInt)\n \"Lista de valores únicos\": tpl.listUnique(\", \")\n \"Suma\": tpl.sum(frFmt)\n \"Suma de enteros\": tpl.sum(frFmtInt)\n \"Promedio\": tpl.average(frFmt)\n \"Mínimo\": tpl.min(frFmt)\n \"Máximo\": tpl.max(frFmt)\n \"Suma de sumas\": tpl.sumOverSum(frFmt)\n \"Cota 80% superior\": tpl.sumOverSumBound80(true, frFmt)\n \"Cota 80% inferior\": tpl.sumOverSumBound80(false, frFmt)\n \"Proporción del total (suma)\": tpl.fractionOf(tpl.sum(), \"total\", frFmtPct)\n \"Proporción de la fila (suma)\": tpl.fractionOf(tpl.sum(), \"row\", frFmtPct)\n \"Proporción de la columna (suma)\": tpl.fractionOf(tpl.sum(), \"col\", frFmtPct)\n \"Proporción del total (cuenta)\": tpl.fractionOf(tpl.count(), \"total\", frFmtPct)\n \"Proporción de la fila (cuenta)\": tpl.fractionOf(tpl.count(), \"row\", frFmtPct)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "locales/pivot.es.coffee", "license": "MIT", "commit": "a49155d38b55ada4c07ec06f4382a4d61c756968", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/a49155d38b55ada4c07ec06f4382a4d61c756968/locales/pivot.es.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'jsonedit', ->\n {\n restrict: 'EAC'\n scope:\n model: '='\n replace: true\n template: '
                '\n\n controller: ($scope, dashboardService) ->\n\n $scope.aceLoaded = (editor) ->\n editor.setOptions {\n maxLines: Infinity\n minLines: 10\n enableBasicAutocompletion: true\n }\n editor.focus()\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode : true\n showGutter: true\n showPrintMargin: false\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded\n\n $scope.jsonValue = dashboardService.toString $scope.model\n\n $scope.$watch 'jsonValue', (json) ->\n # Catch parse errors due to incomplete objects\n try\n if $scope.model?\n _.replaceInside $scope.model, dashboardService.parse(json)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2018 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'jsonedit', ->\n {\n restrict: 'EAC'\n scope:\n model: '='\n replace: true\n template: '
                '\n\n controller: ($scope, dashboardService) ->", "response": "$scope.aceLoaded = (editor) ->\n editor.setOptions {\n maxLines: Infinity\n minLines: 10\n enableBasicAutocompletion: true\n }\n editor.focus()\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode : true\n showGutter: true\n showPrintMargin: false\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded\n\n $scope.jsonValue = dashboardService.toString $scope.model\n\n $scope.$watch 'jsonValue', (json) ->\n # Catch parse errors due to incomplete objects\n try\n if $scope.model?\n _.replaceInside $scope.model, dashboardService.parse(json)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'jsonedit', ->\n {\n restrict: 'EAC'\n scope:\n model: '='\n replace: true\n template: '
                '\n\n controller: ($scope, dashboardService) ->\n\n $scope.aceLoaded = (editor) ->\n editor.setOptions {\n maxLines: Infinity\n minLines: 10\n enableBasicAutocompletion: true\n }\n editor.focus()\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode : true\n showGutter: true\n showPrintMargin: false\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded\n\n $scope.jsonValue = dashboardService.toString $scope.model\n\n $scope.$watch 'jsonValue', (json) ->\n # Catch parse errors due to incomplete objects\n try\n if $scope.model?\n _.replaceInside $scope.model, dashboardService.parse(json)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "line_start": 1, "line_end": 50} +{"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2015 the original author or authors.\n#\n# Licensed under the MIT License (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.opensource.org/licenses/mit-license.php\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n# either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n###\n\ncyclotronDirectives.directive 'jsonedit', ->\n {\n restrict: 'EAC'\n scope:\n model: '='\n replace: true\n template: '
                '\n\n controller: ($scope, dashboardService) ->", "response": "$scope.aceLoaded = (editor) ->\n editor.setOptions {\n maxLines: Infinity\n minLines: 10\n enableBasicAutocompletion: true\n }\n editor.focus()\n\n # Settings for the JSON Editor\n $scope.aceOptions =\n useWrapMode : true\n showGutter: true\n showPrintMargin: false\n mode: 'json'\n theme: 'chrome'\n onLoad: $scope.aceLoaded\n\n $scope.jsonValue = dashboardService.toString $scope.model\n\n $scope.$watch 'jsonValue', (json) ->\n # Catch parse errors due to incomplete objects\n try\n if $scope.model?\n _.replaceInside $scope.model, dashboardService.parse(json)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/directives/directives.jsonedit.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Exporter\n constructor: (@engine) ->\n return unless @command = location.search.match(/export=([a-z0-9]+)/)?[1]\n\n engine.addEventListener('precompile', @preexport)\n\n preexport: =>\n # Let every element get an ID\n if (scope = @engine.scope).nodeType == 9\n scope = @engine.scope.body\n @engine.identify(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @engine.identify(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n\n if @command.indexOf('x') > -1\n [width, height] = @command.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[@command] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @engine.intrinsic.properties['::window[height]'] = ->\n return height\n @engine.intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if @command == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: =>\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "0484d45a299f218f645cbc5ea3e8665305b01882", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/0484d45a299f218f645cbc5ea3e8665305b01882/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:completion", "type": "completion", "prompt": "class Exporter\n constructor: (@engine) ->\n return unless @command = location.search.match(/export=([a-z0-9]+)/)?[1]\n\n engine.addEventListener('precompile', @preexport)\n\n preexport: =>\n # Let every element get an ID\n if (scope = @engine.scope).nodeType == 9\n scope = @engine.scope.body\n @engine.identify(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @engine.identify(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n\n if @command.indexOf('x') > -1\n [width, height] = @command.split('x')\n baseline = 72", "response": "width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[@command] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @engine.intrinsic.properties['::window[height]'] = ->\n return height\n @engine.intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if @command == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: =>\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "0484d45a299f218f645cbc5ea3e8665305b01882", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/0484d45a299f218f645cbc5ea3e8665305b01882/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->\n values = {}\n for path, value of @engine.values\n if (index = path.indexOf('[')) > -1 && path.indexOf('\"') == -1\n property = @engine.intrinsic.camelize(path.substring(index + 1, path.length - 1))\n id = path.substring(0, index)\n if property == 'x' || property == 'y' || document.body.style[property] != undefined\n unless @engine.values[id + '[intrinsic-' + property + ']']?\n values[path] = Math.ceil(value)\n values.stylesheets = @engine.Stylesheet.export()\n return values\n\nmodule.exports = Exporter", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "b47652553f419e9a2b1ca3c03fbb860bedbfc271", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/b47652553f419e9a2b1ca3c03fbb860bedbfc271/src/utilities/Exporter.coffee", "line_start": 51, "line_end": 66} +{"id": "gss/engine:src/utilities/Exporter.coffee:2:completion", "type": "completion", "prompt": "result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->\n values = {}\n for path, value of @engine.values\n if (index = path.indexOf('[')) > -1 && path.indexOf('\"') == -1\n property = @engine.intrinsic.camelize(path.substring(index + 1, path.length - 1))", "response": "id = path.substring(0, index)\n if property == 'x' || property == 'y' || document.body.style[property] != undefined\n unless @engine.values[id + '[intrinsic-' + property + ']']?\n values[path] = Math.ceil(value)\n values.stylesheets = @engine.Stylesheet.export()\n return values\n\nmodule.exports = Exporter", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "b47652553f419e9a2b1ca3c03fbb860bedbfc271", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/b47652553f419e9a2b1ca3c03fbb860bedbfc271/src/utilities/Exporter.coffee", "line_start": 51, "line_end": 66} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identify(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identify(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identify(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identify(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->\n```", "response": "var Exporter;\n\nExporter = class Exporter {\n preexport() {\n var baseline, element, height, i, j, k, l, len, len1, len2, len3, match, pairs, ref, ref1, ref2, ref3, ref4, ref5, scope, width;\n // Let every element get an ID\n if ((scope = this.scope).nodeType === 9) {\n scope = this.scope.body;\n }\n this.identify(scope);\n ref = scope.getElementsByTagName('*');\n for (i = 0, len = ref.length; i < len; i++) {\n element = ref[i];\n if (element.tagName !== 'SCRIPT' && (element.tagName !== 'STYLE' || ((ref1 = element.getAttribute('type')) != null ? ref1.indexOf('gss') : void 0) > -1)) {\n this.identify(element);\n }\n }\n if (window.Sizes) {\n this.sizes = [];\n ref2 = window.Sizes;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n pairs = ref2[j];\n ref3 = pairs[0];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n width = ref3[k];\n ref4 = pairs[1];\n for (l = 0, len3 = ref4.length; l < len3; l++) {\n height = ref4[l];\n this.sizes.push(width + 'x' + height);\n }\n }\n }\n }\n if (match = (ref5 = location.search.match(/export=([a-z0-9]+)/)) != null ? ref5[1] : void 0) {\n if (match.indexOf('x') > -1) {\n [width, height] = match.split('x');\n baseline = 72;\n width = parseInt(width) * baseline;\n height = parseInt(height) * baseline;\n window.addEventListener('load', () => {\n localStorage[match] = JSON.stringify(this.export());\n return this.postexport();\n });\n document.body.style.width = width + 'px';\n this.intrinsic.properties['::window[height]'] = function() {\n return height;\n };\n return this.intrinsic.properties['::window[width]'] = function() {\n return width;\n };\n } else {\n if (match === 'true') {\n localStorage.clear();\n return this.postexport();\n }\n }\n }\n }\n\n postexport() {\n var i, len, property, ref, result, size, value;\n ref = this.sizes;\n for (i = 0, len = ref.length; i < len; i++) {\n size = ref[i];\n if (!localStorage[size]) {\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size;\n return;\n }\n }\n result = {};\n for (property in localStorage) {\n value = localStorage[property];\n if (property.match(/^\\d+x\\d+$/)) {\n result[property] = JSON.parse(value);\n }\n }\n return document.write(JSON.stringify(result));\n }\n\n export() {}\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Exporter;\n\nExporter = class Exporter {\n preexport() {\n var baseline, element, height, i, j, k, l, len, len1, len2, len3, match, pairs, ref, ref1, ref2, ref3, ref4, ref5, scope, width;\n // Let every element get an ID\n if ((scope = this.scope).nodeType === 9) {\n scope = this.scope.body;\n }\n this.identify(scope);\n ref = scope.getElementsByTagName('*');\n for (i = 0, len = ref.length; i < len; i++) {\n element = ref[i];\n if (element.tagName !== 'SCRIPT' && (element.tagName !== 'STYLE' || ((ref1 = element.getAttribute('type')) != null ? ref1.indexOf('gss') : void 0) > -1)) {\n this.identify(element);\n }\n }\n if (window.Sizes) {\n this.sizes = [];\n ref2 = window.Sizes;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n pairs = ref2[j];\n ref3 = pairs[0];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n width = ref3[k];\n ref4 = pairs[1];\n for (l = 0, len3 = ref4.length; l < len3; l++) {\n height = ref4[l];\n this.sizes.push(width + 'x' + height);\n }\n }\n }\n }\n if (match = (ref5 = location.search.match(/export=([a-z0-9]+)/)) != null ? ref5[1] : void 0) {\n if (match.indexOf('x') > -1) {\n [width, height] = match.split('x');\n baseline = 72;\n width = parseInt(width) * baseline;\n height = parseInt(height) * baseline;\n window.addEventListener('load', () => {\n localStorage[match] = JSON.stringify(this.export());\n return this.postexport();\n });\n document.body.style.width = width + 'px';\n this.intrinsic.properties['::window[height]'] = function() {\n return height;\n };\n return this.intrinsic.properties['::window[width]'] = function() {\n return width;\n };\n } else {\n if (match === 'true') {\n localStorage.clear();\n return this.postexport();\n }\n }\n }\n }\n\n postexport() {\n var i, len, property, ref, result, size, value;\n ref = this.sizes;\n for (i = 0, len = ref.length; i < len; i++) {\n size = ref[i];\n if (!localStorage[size]) {\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size;\n return;\n }\n }\n result = {};\n for (property in localStorage) {\n value = localStorage[property];\n if (property.match(/^\\d+x\\d+$/)) {\n result[property] = JSON.parse(value);\n }\n }\n return document.write(JSON.stringify(result));\n }\n\n export() {}\n\n};\n```", "response": "class Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identify(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identify(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:completion", "type": "completion", "prompt": "class Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identify(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identify(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())", "response": "@postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "values = {}\n for path, value of @values\n if (index = path.indexOf('[')) > -1 && path.indexOf('\"') == -1\n property = @camelize(path.substring(index + 1, path.length - 1))\n id = path.substring(0, index)\n if property == 'x' || property == 'y' || document.body.style[property] != undefined\n unless @values[id + '[intrinsic-' + property + ']']?\n values[path] = Math.ceil(value)\n values.stylesheets = @stylesheets.export()\n return values\n\nmodule.export = Exporter", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/utilities/Exporter.coffee", "line_start": 51, "line_end": 62} +{"id": "gss/engine:src/utilities/Exporter.coffee:2:completion", "type": "completion", "prompt": "values = {}\n for path, value of @values\n if (index = path.indexOf('[')) > -1 && path.indexOf('\"') == -1\n property = @camelize(path.substring(index + 1, path.length - 1))\n id = path.substring(0, index)\n if property == 'x' || property == 'y' || document.body.style[property] != undefined", "response": "unless @values[id + '[intrinsic-' + property + ']']?\n values[path] = Math.ceil(value)\n values.stylesheets = @stylesheets.export()\n return values\n\nmodule.export = Exporter", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/utilities/Exporter.coffee", "line_start": 51, "line_end": 62} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identity(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identity(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "465ef0255a88915ae4ae7522acb91c4b0d70e60a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/465ef0255a88915ae4ae7522acb91c4b0d70e60a/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identity(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identity(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->\n```", "response": "var Exporter;\n\nExporter = class Exporter {\n preexport() {\n var baseline, element, height, i, j, k, l, len, len1, len2, len3, match, pairs, ref, ref1, ref2, ref3, ref4, ref5, scope, width;\n // Let every element get an ID\n if ((scope = this.scope).nodeType === 9) {\n scope = this.scope.body;\n }\n this.identity(scope);\n ref = scope.getElementsByTagName('*');\n for (i = 0, len = ref.length; i < len; i++) {\n element = ref[i];\n if (element.tagName !== 'SCRIPT' && (element.tagName !== 'STYLE' || ((ref1 = element.getAttribute('type')) != null ? ref1.indexOf('gss') : void 0) > -1)) {\n this.identity(element);\n }\n }\n if (window.Sizes) {\n this.sizes = [];\n ref2 = window.Sizes;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n pairs = ref2[j];\n ref3 = pairs[0];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n width = ref3[k];\n ref4 = pairs[1];\n for (l = 0, len3 = ref4.length; l < len3; l++) {\n height = ref4[l];\n this.sizes.push(width + 'x' + height);\n }\n }\n }\n }\n if (match = (ref5 = location.search.match(/export=([a-z0-9]+)/)) != null ? ref5[1] : void 0) {\n if (match.indexOf('x') > -1) {\n [width, height] = match.split('x');\n baseline = 72;\n width = parseInt(width) * baseline;\n height = parseInt(height) * baseline;\n window.addEventListener('load', () => {\n localStorage[match] = JSON.stringify(this.export());\n return this.postexport();\n });\n document.body.style.width = width + 'px';\n this.intrinsic.properties['::window[height]'] = function() {\n return height;\n };\n return this.intrinsic.properties['::window[width]'] = function() {\n return width;\n };\n } else {\n if (match === 'true') {\n localStorage.clear();\n return this.postexport();\n }\n }\n }\n }\n\n postexport() {\n var i, len, property, ref, result, size, value;\n ref = this.sizes;\n for (i = 0, len = ref.length; i < len; i++) {\n size = ref[i];\n if (!localStorage[size]) {\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size;\n return;\n }\n }\n result = {};\n for (property in localStorage) {\n value = localStorage[property];\n if (property.match(/^\\d+x\\d+$/)) {\n result[property] = JSON.parse(value);\n }\n }\n return document.write(JSON.stringify(result));\n }\n\n export() {}\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "465ef0255a88915ae4ae7522acb91c4b0d70e60a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/465ef0255a88915ae4ae7522acb91c4b0d70e60a/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Exporter;\n\nExporter = class Exporter {\n preexport() {\n var baseline, element, height, i, j, k, l, len, len1, len2, len3, match, pairs, ref, ref1, ref2, ref3, ref4, ref5, scope, width;\n // Let every element get an ID\n if ((scope = this.scope).nodeType === 9) {\n scope = this.scope.body;\n }\n this.identity(scope);\n ref = scope.getElementsByTagName('*');\n for (i = 0, len = ref.length; i < len; i++) {\n element = ref[i];\n if (element.tagName !== 'SCRIPT' && (element.tagName !== 'STYLE' || ((ref1 = element.getAttribute('type')) != null ? ref1.indexOf('gss') : void 0) > -1)) {\n this.identity(element);\n }\n }\n if (window.Sizes) {\n this.sizes = [];\n ref2 = window.Sizes;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n pairs = ref2[j];\n ref3 = pairs[0];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n width = ref3[k];\n ref4 = pairs[1];\n for (l = 0, len3 = ref4.length; l < len3; l++) {\n height = ref4[l];\n this.sizes.push(width + 'x' + height);\n }\n }\n }\n }\n if (match = (ref5 = location.search.match(/export=([a-z0-9]+)/)) != null ? ref5[1] : void 0) {\n if (match.indexOf('x') > -1) {\n [width, height] = match.split('x');\n baseline = 72;\n width = parseInt(width) * baseline;\n height = parseInt(height) * baseline;\n window.addEventListener('load', () => {\n localStorage[match] = JSON.stringify(this.export());\n return this.postexport();\n });\n document.body.style.width = width + 'px';\n this.intrinsic.properties['::window[height]'] = function() {\n return height;\n };\n return this.intrinsic.properties['::window[width]'] = function() {\n return width;\n };\n } else {\n if (match === 'true') {\n localStorage.clear();\n return this.postexport();\n }\n }\n }\n }\n\n postexport() {\n var i, len, property, ref, result, size, value;\n ref = this.sizes;\n for (i = 0, len = ref.length; i < len; i++) {\n size = ref[i];\n if (!localStorage[size]) {\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size;\n return;\n }\n }\n result = {};\n for (property in localStorage) {\n value = localStorage[property];\n if (property.match(/^\\d+x\\d+$/)) {\n result[property] = JSON.parse(value);\n }\n }\n return document.write(JSON.stringify(result));\n }\n\n export() {}\n\n};\n```", "response": "class Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identity(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identity(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())\n @postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "465ef0255a88915ae4ae7522acb91c4b0d70e60a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/465ef0255a88915ae4ae7522acb91c4b0d70e60a/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "gss/engine:src/utilities/Exporter.coffee:1:completion", "type": "completion", "prompt": "class Exporter\n preexport: ->\n\n # Let every element get an ID\n if (scope = @scope).nodeType == 9\n scope = @scope.body\n @identity(scope)\n for element in scope.getElementsByTagName('*')\n if element.tagName != 'SCRIPT' &&\n (element.tagName != 'STYLE' || element.getAttribute('type')?.indexOf('gss') > -1)\n @identity(element)\n if window.Sizes\n @sizes = []\n for pairs in window.Sizes\n for width in pairs[0]\n for height in pairs[1]\n @sizes.push(width + 'x' + height)\n if match = location.search.match(/export=([a-z0-9]+)/)?[1]\n if match.indexOf('x') > -1\n [width, height] = match.split('x')\n baseline = 72\n width = parseInt(width) * baseline\n height = parseInt(height) * baseline\n window.addEventListener 'load', =>\n localStorage[match] = JSON.stringify(@export())", "response": "@postexport()\n\n document.body.style.width = width + 'px'\n @intrinsic.properties['::window[height]'] = ->\n return height\n @intrinsic.properties['::window[width]'] = ->\n return width\n\n else\n if match == 'true'\n localStorage.clear()\n @postexport()\n\n postexport: ->\n for size in @sizes\n unless localStorage[size]\n location.search = location.search.replace(/[&?]export=([a-z0-9])+/, '') + '?export=' + size\n return\n result = {}\n for property, value of localStorage\n if property.match(/^\\d+x\\d+$/)\n result[property] = JSON.parse(value)\n document.write(JSON.stringify(result))\n\n export: ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/utilities/Exporter.coffee", "license": "MIT", "commit": "465ef0255a88915ae4ae7522acb91c4b0d70e60a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/465ef0255a88915ae4ae7522acb91c4b0d70e60a/src/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{Schema} = require 'mongoose'\nErr = require 'err1st'\n_ = require 'lodash'\nuuid = require 'uuid'\ncrypto = require 'crypto'\nutil = require '../util'\n\n_hashId = -> crypto.createHash('sha1').update(uuid.v4() + Date.now()).digest('hex')\n\nmodule.exports = IntegrationSchema = new Schema\n creator: type: Schema.Types.ObjectId, ref: 'User'\n team: type: Schema.Types.ObjectId, ref: 'Team'\n room: type: Schema.Types.ObjectId, ref: 'Room'\n robot: type: Schema.Types.ObjectId, ref: 'User'\n category: type: String # Integration category: weibo/github\n hashId: type: String, default: _hashId\n group: type: String\n # For authorized integrations\n token: String\n refreshToken: String\n showname: type: String\n openId: String\n notifications: type: Object\n # Options\n title: type: String\n iconUrl: String\n # Rss\n url: String\n description: type: String\n # Github\n repos: type: Array\n events: Array\n project: _id: String, name: String\n config: Object\n # Data saved by system\n data: Object\n errorInfo: String\n errorTimes: type: Number, default: 0\n lastErrorInfo: String\n createdAt: type: Date, default: Date.now\n updatedAt: type: Date, default: Date.now\n,\n read: 'secondaryPreferred'\n toObject:\n virtuals: true\n getters: true\n toJSON:\n virtuals: true\n getters: true", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{Schema} = require 'mongoose'\nErr = require 'err1st'\n_ = require 'lodash'\nuuid = require 'uuid'\ncrypto = require 'crypto'\nutil = require '../util'\n\n_hashId = -> crypto.createHash('sha1').update(uuid.v4() + Date.now()).digest('hex')\n\nmodule.exports = IntegrationSchema = new Schema\n creator: type: Schema.Types.ObjectId, ref: 'User'\n team: type: Schema.Types.ObjectId, ref: 'Team'\n room: type: Schema.Types.ObjectId, ref: 'Room'\n robot: type: Schema.Types.ObjectId, ref: 'User'\n category: type: String # Integration category: weibo/github\n hashId: type: String, default: _hashId\n group: type: String\n # For authorized integrations\n token: String\n refreshToken: String\n showname: type: String\n openId: String\n notifications: type: Object\n # Options\n title: type: String\n iconUrl: String\n # Rss\n url: String\n description: type: String\n # Github\n repos: type: Array\n events: Array\n project: _id: String, name: String\n config: Object\n # Data saved by system\n data: Object\n errorInfo: String\n errorTimes: type: Number, default: 0\n lastErrorInfo: String\n createdAt: type: Date, default: Date.now\n updatedAt: type: Date, default: Date.now\n,\n read: 'secondaryPreferred'\n toObject:\n virtuals: true\n getters: true\n toJSON:\n virtuals: true\n getters: true\n```", "response": "var Err, IntegrationSchema, Schema, _, _hashId, crypto, util, uuid;\n\n({Schema} = require('mongoose'));\n\nErr = require('err1st');\n\n_ = require('lodash');\n\nuuid = require('uuid');\n\ncrypto = require('crypto');\n\nutil = require('../util');\n\n_hashId = function() {\n return crypto.createHash('sha1').update(uuid.v4() + Date.now()).digest('hex');\n};\n\nmodule.exports = IntegrationSchema = new Schema({\n creator: {\n type: Schema.Types.ObjectId,\n ref: 'User'\n },\n team: {\n type: Schema.Types.ObjectId,\n ref: 'Team'\n },\n room: {\n type: Schema.Types.ObjectId,\n ref: 'Room'\n },\n robot: {\n type: Schema.Types.ObjectId,\n ref: 'User'\n },\n category: {\n type: String // Integration category: weibo/github\n },\n hashId: {\n type: String,\n default: _hashId\n },\n group: {\n type: String\n },\n // For authorized integrations\n token: String,\n refreshToken: String,\n showname: {\n type: String\n },\n openId: String,\n notifications: {\n type: Object\n },\n // Options\n title: {\n type: String\n },\n iconUrl: String,\n // Rss\n url: String,\n description: {\n type: String\n },\n // Github\n repos: {\n type: Array\n },\n events: Array,\n project: {\n _id: String,\n name: String\n },\n config: Object,\n // Data saved by system\n data: Object,\n errorInfo: String,\n errorTimes: {\n type: Number,\n default: 0\n },\n lastErrorInfo: String,\n createdAt: {\n type: Date,\n default: Date.now\n },\n updatedAt: {\n type: Date,\n default: Date.now\n }\n}, {\n read: 'secondaryPreferred',\n toObject: {\n virtuals: true,\n getters: true\n },\n toJSON: {\n virtuals: true,\n getters: true\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Err, IntegrationSchema, Schema, _, _hashId, crypto, util, uuid;\n\n({Schema} = require('mongoose'));\n\nErr = require('err1st');\n\n_ = require('lodash');\n\nuuid = require('uuid');\n\ncrypto = require('crypto');\n\nutil = require('../util');\n\n_hashId = function() {\n return crypto.createHash('sha1').update(uuid.v4() + Date.now()).digest('hex');\n};\n\nmodule.exports = IntegrationSchema = new Schema({\n creator: {\n type: Schema.Types.ObjectId,\n ref: 'User'\n },\n team: {\n type: Schema.Types.ObjectId,\n ref: 'Team'\n },\n room: {\n type: Schema.Types.ObjectId,\n ref: 'Room'\n },\n robot: {\n type: Schema.Types.ObjectId,\n ref: 'User'\n },\n category: {\n type: String // Integration category: weibo/github\n },\n hashId: {\n type: String,\n default: _hashId\n },\n group: {\n type: String\n },\n // For authorized integrations\n token: String,\n refreshToken: String,\n showname: {\n type: String\n },\n openId: String,\n notifications: {\n type: Object\n },\n // Options\n title: {\n type: String\n },\n iconUrl: String,\n // Rss\n url: String,\n description: {\n type: String\n },\n // Github\n repos: {\n type: Array\n },\n events: Array,\n project: {\n _id: String,\n name: String\n },\n config: Object,\n // Data saved by system\n data: Object,\n errorInfo: String,\n errorTimes: {\n type: Number,\n default: 0\n },\n lastErrorInfo: String,\n createdAt: {\n type: Date,\n default: Date.now\n },\n updatedAt: {\n type: Date,\n default: Date.now\n }\n}, {\n read: 'secondaryPreferred',\n toObject: {\n virtuals: true,\n getters: true\n },\n toJSON: {\n virtuals: true,\n getters: true\n }\n});\n```", "response": "{Schema} = require 'mongoose'\nErr = require 'err1st'\n_ = require 'lodash'\nuuid = require 'uuid'\ncrypto = require 'crypto'\nutil = require '../util'\n\n_hashId = -> crypto.createHash('sha1').update(uuid.v4() + Date.now()).digest('hex')\n\nmodule.exports = IntegrationSchema = new Schema\n creator: type: Schema.Types.ObjectId, ref: 'User'\n team: type: Schema.Types.ObjectId, ref: 'Team'\n room: type: Schema.Types.ObjectId, ref: 'Room'\n robot: type: Schema.Types.ObjectId, ref: 'User'\n category: type: String # Integration category: weibo/github\n hashId: type: String, default: _hashId\n group: type: String\n # For authorized integrations\n token: String\n refreshToken: String\n showname: type: String\n openId: String\n notifications: type: Object\n # Options\n title: type: String\n iconUrl: String\n # Rss\n url: String\n description: type: String\n # Github\n repos: type: Array\n events: Array\n project: _id: String, name: String\n config: Object\n # Data saved by system\n data: Object\n errorInfo: String\n errorTimes: type: Number, default: 0\n lastErrorInfo: String\n createdAt: type: Date, default: Date.now\n updatedAt: type: Date, default: Date.now\n,\n read: 'secondaryPreferred'\n toObject:\n virtuals: true\n getters: true\n toJSON:\n virtuals: true\n getters: true", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:1:completion", "type": "completion", "prompt": "{Schema} = require 'mongoose'\nErr = require 'err1st'\n_ = require 'lodash'\nuuid = require 'uuid'\ncrypto = require 'crypto'\nutil = require '../util'\n\n_hashId = -> crypto.createHash('sha1').update(uuid.v4() + Date.now()).digest('hex')\n\nmodule.exports = IntegrationSchema = new Schema\n creator: type: Schema.Types.ObjectId, ref: 'User'\n team: type: Schema.Types.ObjectId, ref: 'Team'\n room: type: Schema.Types.ObjectId, ref: 'Room'\n robot: type: Schema.Types.ObjectId, ref: 'User'\n category: type: String # Integration category: weibo/github\n hashId: type: String, default: _hashId\n group: type: String\n # For authorized integrations\n token: String\n refreshToken: String\n showname: type: String\n openId: String\n notifications: type: Object\n # Options", "response": "title: type: String\n iconUrl: String\n # Rss\n url: String\n description: type: String\n # Github\n repos: type: Array\n events: Array\n project: _id: String, name: String\n config: Object\n # Data saved by system\n data: Object\n errorInfo: String\n errorTimes: type: Number, default: 0\n lastErrorInfo: String\n createdAt: type: Date, default: Date.now\n updatedAt: type: Date, default: Date.now\n,\n read: 'secondaryPreferred'\n toObject:\n virtuals: true\n getters: true\n toJSON:\n virtuals: true\n getters: true", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 1, "line_end": 50} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "IntegrationSchema.virtual '_creatorId'\n .get -> @creator?._id or @creator\n .set (_id) -> @creator = _id\n\nIntegrationSchema.virtual '_roomId'\n .get -> @room?._id or @room\n .set (_id) -> @room = _id\n\nIntegrationSchema.virtual '_teamId'\n .get -> @team?._id or @team\n .set (_id) -> @team = _id\n\nIntegrationSchema.virtual '_robotId'\n .get -> @robot?._id or @robot\n .set (_id) -> @robot = _id\n\nIntegrationSchema.virtual 'webhookUrl'\n .get -> if @hashId then util.buildWebhookUrl(@hashId) else ''", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 51, "line_end": 68} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nIntegrationSchema.virtual '_creatorId'\n .get -> @creator?._id or @creator\n .set (_id) -> @creator = _id\n\nIntegrationSchema.virtual '_roomId'\n .get -> @room?._id or @room\n .set (_id) -> @room = _id\n\nIntegrationSchema.virtual '_teamId'\n .get -> @team?._id or @team\n .set (_id) -> @team = _id\n\nIntegrationSchema.virtual '_robotId'\n .get -> @robot?._id or @robot\n .set (_id) -> @robot = _id\n\nIntegrationSchema.virtual 'webhookUrl'\n .get -> if @hashId then util.buildWebhookUrl(@hashId) else ''\n```", "response": "IntegrationSchema.virtual('_creatorId').get(function() {\n var ref;\n return ((ref = this.creator) != null ? ref._id : void 0) || this.creator;\n}).set(function(_id) {\n return this.creator = _id;\n});\n\nIntegrationSchema.virtual('_roomId').get(function() {\n var ref;\n return ((ref = this.room) != null ? ref._id : void 0) || this.room;\n}).set(function(_id) {\n return this.room = _id;\n});\n\nIntegrationSchema.virtual('_teamId').get(function() {\n var ref;\n return ((ref = this.team) != null ? ref._id : void 0) || this.team;\n}).set(function(_id) {\n return this.team = _id;\n});\n\nIntegrationSchema.virtual('_robotId').get(function() {\n var ref;\n return ((ref = this.robot) != null ? ref._id : void 0) || this.robot;\n}).set(function(_id) {\n return this.robot = _id;\n});\n\nIntegrationSchema.virtual('webhookUrl').get(function() {\n if (this.hashId) {\n return util.buildWebhookUrl(this.hashId);\n } else {\n return '';\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 51, "line_end": 68} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nIntegrationSchema.virtual('_creatorId').get(function() {\n var ref;\n return ((ref = this.creator) != null ? ref._id : void 0) || this.creator;\n}).set(function(_id) {\n return this.creator = _id;\n});\n\nIntegrationSchema.virtual('_roomId').get(function() {\n var ref;\n return ((ref = this.room) != null ? ref._id : void 0) || this.room;\n}).set(function(_id) {\n return this.room = _id;\n});\n\nIntegrationSchema.virtual('_teamId').get(function() {\n var ref;\n return ((ref = this.team) != null ? ref._id : void 0) || this.team;\n}).set(function(_id) {\n return this.team = _id;\n});\n\nIntegrationSchema.virtual('_robotId').get(function() {\n var ref;\n return ((ref = this.robot) != null ? ref._id : void 0) || this.robot;\n}).set(function(_id) {\n return this.robot = _id;\n});\n\nIntegrationSchema.virtual('webhookUrl').get(function() {\n if (this.hashId) {\n return util.buildWebhookUrl(this.hashId);\n } else {\n return '';\n }\n});\n```", "response": "IntegrationSchema.virtual '_creatorId'\n .get -> @creator?._id or @creator\n .set (_id) -> @creator = _id\n\nIntegrationSchema.virtual '_roomId'\n .get -> @room?._id or @room\n .set (_id) -> @room = _id\n\nIntegrationSchema.virtual '_teamId'\n .get -> @team?._id or @team\n .set (_id) -> @team = _id\n\nIntegrationSchema.virtual '_robotId'\n .get -> @robot?._id or @robot\n .set (_id) -> @robot = _id\n\nIntegrationSchema.virtual 'webhookUrl'\n .get -> if @hashId then util.buildWebhookUrl(@hashId) else ''", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 51, "line_end": 68} +{"id": "jianliaoim/talk-os:talk-api2x/server/schemas/integration.coffee:2:completion", "type": "completion", "prompt": "IntegrationSchema.virtual '_creatorId'\n .get -> @creator?._id or @creator\n .set (_id) -> @creator = _id\n\nIntegrationSchema.virtual '_roomId'\n .get -> @room?._id or @room\n .set (_id) -> @room = _id\n\nIntegrationSchema.virtual '_teamId'", "response": ".get -> @team?._id or @team\n .set (_id) -> @team = _id\n\nIntegrationSchema.virtual '_robotId'\n .get -> @robot?._id or @robot\n .set (_id) -> @robot = _id\n\nIntegrationSchema.virtual 'webhookUrl'\n .get -> if @hashId then util.buildWebhookUrl(@hashId) else ''", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/schemas/integration.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/integration.coffee", "line_start": 51, "line_end": 68} +{"id": "oozcitak/xmlbuilder-js:test/guards/instruction.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'CDATA Guards:', ->\n test 'constructor', ->\n err(\n () -> xml('test').ins()\n Error\n \"Missing instruction target. parent: \"\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/instruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/instruction.coffee", "line_start": 1, "line_end": 7} +{"id": "oozcitak/xmlbuilder-js:test/guards/instruction.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'CDATA Guards:', ->\n test 'constructor', ->\n err(\n () -> xml('test').ins()\n Error\n \"Missing instruction target. parent: \"\n )\n```", "response": "suite('CDATA Guards:', function() {\n return test('constructor', function() {\n return err(function() {\n return xml('test').ins();\n }, Error, \"Missing instruction target. parent: \");\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/instruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/instruction.coffee", "line_start": 1, "line_end": 7} +{"id": "oozcitak/xmlbuilder-js:test/guards/instruction.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('CDATA Guards:', function() {\n return test('constructor', function() {\n return err(function() {\n return xml('test').ins();\n }, Error, \"Missing instruction target. parent: \");\n });\n});\n```", "response": "suite 'CDATA Guards:', ->\n test 'constructor', ->\n err(\n () -> xml('test').ins()\n Error\n \"Missing instruction target. parent: \"\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/instruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/instruction.coffee", "line_start": 1, "line_end": 7} +{"id": "oozcitak/xmlbuilder-js:test/guards/instruction.coffee:1:completion", "type": "completion", "prompt": "suite 'CDATA Guards:', ->\n test 'constructor', ->\n err(", "response": "() -> xml('test').ins()\n Error\n \"Missing instruction target. parent: \"\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/instruction.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/instruction.coffee", "line_start": 1, "line_end": 7} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              3. ${name}
              4. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n functionOverrides: {}\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "a627b5fcac22c35d52b7fb6d8a93181d2546f3c0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/a627b5fcac22c35d52b7fb6d8a93181d2546f3c0/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              5. ${name}
              6. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n functionOverrides: {}\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              7. ${name}
              8. \",\n insertTpl: \"${atwho-at}${name}\",\n headerTpl: null,\n callbacks: DEFAULT_CALLBACKS,\n functionOverrides: {},\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n acceptSpaceBar: false,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "a627b5fcac22c35d52b7fb6d8a93181d2546f3c0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/a627b5fcac22c35d52b7fb6d8a93181d2546f3c0/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              9. ${name}
              10. \",\n insertTpl: \"${atwho-at}${name}\",\n headerTpl: null,\n callbacks: DEFAULT_CALLBACKS,\n functionOverrides: {},\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n acceptSpaceBar: false,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              11. ${name}
              12. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n functionOverrides: {}\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "a627b5fcac22c35d52b7fb6d8a93181d2546f3c0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/a627b5fcac22c35d52b7fb6d8a93181d2546f3c0/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              13. ${name}
              14. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n functionOverrides: {}\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "a627b5fcac22c35d52b7fb6d8a93181d2546f3c0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/a627b5fcac22c35d52b7fb6d8a93181d2546f3c0/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              15. ${name}
              16. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "dff09c0b84679fb0294dd938e745a7f371e3f48d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/dff09c0b84679fb0294dd938e745a7f371e3f48d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              17. ${name}
              18. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              19. ${name}
              20. \",\n insertTpl: \"${atwho-at}${name}\",\n headerTpl: null,\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n acceptSpaceBar: false,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "dff09c0b84679fb0294dd938e745a7f371e3f48d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/dff09c0b84679fb0294dd938e745a7f371e3f48d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              21. ${name}
              22. \",\n insertTpl: \"${atwho-at}${name}\",\n headerTpl: null,\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n acceptSpaceBar: false,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              23. ${name}
              24. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "dff09c0b84679fb0294dd938e745a7f371e3f48d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/dff09c0b84679fb0294dd938e745a7f371e3f48d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              25. ${name}
              26. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n acceptSpaceBar: false\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "dff09c0b84679fb0294dd938e745a7f371e3f48d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/dff09c0b84679fb0294dd938e745a7f371e3f48d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              27. ${name}
              28. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              29. ${name}
              30. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              31. ${name}
              32. \",\n insertTpl: \"${atwho-at}${name}\",\n headerTpl: null,\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              33. ${name}
              34. \",\n insertTpl: \"${atwho-at}${name}\",\n headerTpl: null,\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              35. ${name}
              36. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              37. ${name}
              38. \"\n insertTpl: \"${atwho-at}${name}\"\n headerTpl: null\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/d01f943a84b9ac01e5022a4c9dd9469aa0c1d3eb/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              39. ${name}
              40. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "e4aaa30e84d527f3fd29db0e82b062f2da00e3cf", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/e4aaa30e84d527f3fd29db0e82b062f2da00e3cf/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              41. ${name}
              42. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              43. ${name}
              44. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "e4aaa30e84d527f3fd29db0e82b062f2da00e3cf", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/e4aaa30e84d527f3fd29db0e82b062f2da00e3cf/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              45. ${name}
              46. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n minLen: 0,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              47. ${name}
              48. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "e4aaa30e84d527f3fd29db0e82b062f2da00e3cf", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/e4aaa30e84d527f3fd29db0e82b062f2da00e3cf/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              49. ${name}
              50. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n minLen: 0\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "e4aaa30e84d527f3fd29db0e82b062f2da00e3cf", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/e4aaa30e84d527f3fd29db0e82b062f2da00e3cf/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              51. ${name}
              52. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "fd7d298845d97dc266015352e612ad817e431fff", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/fd7d298845d97dc266015352e612ad817e431fff/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              53. ${name}
              54. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              55. ${name}
              56. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true,\n editableAtwhoQueryAttrs: {}\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "fd7d298845d97dc266015352e612ad817e431fff", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/fd7d298845d97dc266015352e612ad817e431fff/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return !!((ref = this.controller()) != null ? ref.view.visible() : void 0);\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              57. ${name}
              58. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true,\n editableAtwhoQueryAttrs: {}\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              59. ${name}
              60. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "fd7d298845d97dc266015352e612ad817e431fff", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/fd7d298845d97dc266015352e612ad817e431fff/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> !!this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              61. ${name}
              62. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "fd7d298845d97dc266015352e612ad817e431fff", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/fd7d298845d97dc266015352e612ad817e431fff/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              63. ${name}
              64. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "c374c9335f761b66ecb3dec4770a3f630e5bcb4e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/c374c9335f761b66ecb3dec4770a3f630e5bcb4e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              65. ${name}
              66. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              67. ${name}
              68. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true,\n editableAtwhoQueryAttrs: {}\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "c374c9335f761b66ecb3dec4770a3f630e5bcb4e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/c374c9335f761b66ecb3dec4770a3f630e5bcb4e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n if (result != null) {\n return result;\n } else {\n return this;\n }\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              69. ${name}
              70. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true,\n editableAtwhoQueryAttrs: {}\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              71. ${name}
              72. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "c374c9335f761b66ecb3dec4770a3f630e5bcb4e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/c374c9335f761b66ecb3dec4770a3f630e5bcb4e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n if result? then result else this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              73. ${name}
              74. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "c374c9335f761b66ecb3dec4770a3f630e5bcb4e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/c374c9335f761b66ecb3dec4770a3f630e5bcb4e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              75. ${name}
              76. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              77. ${name}
              78. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              79. ${name}
              80. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true,\n editableAtwhoQueryAttrs: {}\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n return c.view.reposition(c.rect());\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              81. ${name}
              82. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true,\n editableAtwhoQueryAttrs: {}\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              83. ${name}
              84. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              85. ${name}
              86. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n editableAtwhoQueryAttrs: {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/5c4a9b5f1c0f7f6fe49c162281a86708ff07cf0d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              87. ${name}
              88. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "89219c3f4fff5846570afd640c5c34c7c7603a81", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/89219c3f4fff5846570afd640c5c34c7c7603a81/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              89. ${name}
              90. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n c.view.reposition(c.rect());\n return console.log(\"reposition\", c);\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              91. ${name}
              92. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "89219c3f4fff5846570afd640c5c34c7c7603a81", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/89219c3f4fff5846570afd640c5c34c7c7603a81/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n c.view.reposition(c.rect());\n return console.log(\"reposition\", c);\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              93. ${name}
              94. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n tabSelectsMatch: true\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              95. ${name}
              96. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "89219c3f4fff5846570afd640c5c34c7c7603a81", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/89219c3f4fff5846570afd640c5c34c7c7603a81/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method", "response": "app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              97. ${name}
              98. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n tabSelectsMatch: yes", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "89219c3f4fff5846570afd640c5c34c7c7603a81", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/89219c3f4fff5846570afd640c5c34c7c7603a81/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              99. ${name}
              100. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              101. ${name}
              102. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n c.view.reposition(c.rect());\n return console.log(\"reposition\", c);\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              103. ${name}
              104. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n editableAtwhoQueryAttrs: {}\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n reposition: function() {\n var c;\n if (c = this.controller()) {\n c.view.reposition(c.rect());\n return console.log(\"reposition\", c);\n }\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.atwho`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              105. ${name}
              106. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n editableAtwhoQueryAttrs: {}\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              107. ${name}
              108. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n reposition: () ->\n if c = this.controller()\n c.view.reposition(c.rect())\n console.log \"reposition\", c\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method", "response": "app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.atwho\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              109. ${name}
              110. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/886613f3b5aebfcfdf3ffdcdbbef434e4a17eb4d/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              111. ${name}
              112. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "db09ac76dad3c109b8f2dacd0eb8879a58444c6c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/db09ac76dad3c109b8f2dacd0eb8879a58444c6c/src/api.coffee", "line_start": 1, "line_end": 46} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              113. ${name}
              114. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              115. ${name}
              116. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n editableAtwhoQueryAttrs: {}\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "db09ac76dad3c109b8f2dacd0eb8879a58444c6c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/db09ac76dad3c109b8f2dacd0eb8879a58444c6c/src/api.coffee", "line_start": 1, "line_end": 46} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n hide: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.hide() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              117. ${name}
              118. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n editableAtwhoQueryAttrs: {}\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              119. ${name}
              120. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "db09ac76dad3c109b8f2dacd0eb8879a58444c6c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/db09ac76dad3c109b8f2dacd0eb8879a58444c6c/src/api.coffee", "line_start": 1, "line_end": 46} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n hide: () -> this.controller()?.view.hide()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              121. ${name}
              122. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "db09ac76dad3c109b8f2dacd0eb8879a58444c6c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/db09ac76dad3c109b8f2dacd0eb8879a58444c6c/src/api.coffee", "line_start": 1, "line_end": 46} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              123. ${name}
              124. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "64ab00d4b86f12b2860963fd99aa91677419ee0f", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/64ab00d4b86f12b2860963fd99aa91677419ee0f/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              125. ${name}
              126. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              127. ${name}
              128. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n editableAtwhoQueryAttrs: {}\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "64ab00d4b86f12b2860963fd99aa91677419ee0f", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/64ab00d4b86f12b2860963fd99aa91677419ee0f/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              129. ${name}
              130. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false,\n editableAtwhoQueryAttrs: {}\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              131. ${name}
              132. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "64ab00d4b86f12b2860963fd99aa91677419ee0f", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/64ab00d4b86f12b2860963fd99aa91677419ee0f/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              133. ${name}
              134. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n editableAtwhoQueryAttrs: {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "64ab00d4b86f12b2860963fd99aa91677419ee0f", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/64ab00d4b86f12b2860963fd99aa91677419ee0f/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              135. ${name}
              136. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9/src/api.coffee", "line_start": 1, "line_end": 44} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              137. ${name}
              138. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              139. ${name}
              140. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9/src/api.coffee", "line_start": 1, "line_end": 44} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              141. ${name}
              142. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null,\n spaceSelectsMatch: false\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              143. ${name}
              144. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9/src/api.coffee", "line_start": 1, "line_end": 44} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              145. ${name}
              146. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n spaceSelectsMatch: no", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/aa93bfe0eb8dc9f9a1727f870c7f66aaeed1e5d9/src/api.coffee", "line_start": 1, "line_end": 44} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              147. ${name}
              148. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "84d945fca2064aa55ea48eb6457ec1ce3cc92258", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/84d945fca2064aa55ea48eb6457ec1ce3cc92258/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              149. ${name}
              150. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              151. ${name}
              152. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "84d945fca2064aa55ea48eb6457ec1ce3cc92258", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/84d945fca2064aa55ea48eb6457ec1ce3cc92258/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visible() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              153. ${name}
              154. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              155. ${name}
              156. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "84d945fca2064aa55ea48eb6457ec1ce3cc92258", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/84d945fca2064aa55ea48eb6457ec1ce3cc92258/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visible()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              157. ${name}
              158. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "84d945fca2064aa55ea48eb6457ec1ce3cc92258", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/84d945fca2064aa55ea48eb6457ec1ce3cc92258/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              159. ${name}
              160. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              161. ${name}
              162. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visiable() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              163. ${name}
              164. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visiable() : void 0;\n },\n setIframe: function(iframe, asRoot) {\n this.setupRootElement(iframe, asRoot);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              165. ${name}
              166. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              167. ${name}
              168. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              169. ${name}
              170. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              171. ${name}
              172. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f10323cf80e1ab33ccc224507f3c4d6f2ab4916a", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f10323cf80e1ab33ccc224507f3c4d6f2ab4916a/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              173. ${name}
              174. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visiable() : void 0;\n },\n setIframe: function(iframe, standalone) {\n this.setupRootElement(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              175. ${name}
              176. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f10323cf80e1ab33ccc224507f3c4d6f2ab4916a", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f10323cf80e1ab33ccc224507f3c4d6f2ab4916a/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n isSelecting: function() {\n var ref;\n return (ref = this.controller()) != null ? ref.view.visiable() : void 0;\n },\n setIframe: function(iframe, standalone) {\n this.setupRootElement(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              177. ${name}
              178. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              179. ${name}
              180. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f10323cf80e1ab33ccc224507f3c4d6f2ab4916a", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f10323cf80e1ab33ccc224507f3c4d6f2ab4916a/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n isSelecting: () -> this.controller()?.view.visiable()\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method", "response": "else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              181. ${name}
              182. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f10323cf80e1ab33ccc224507f3c4d6f2ab4916a", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f10323cf80e1ab33ccc224507f3c4d6f2ab4916a/src/api.coffee", "line_start": 1, "line_end": 43} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              183. ${name}
              184. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eb598d4487da4a09475c854c23722206dc124cbb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eb598d4487da4a09475c854c23722206dc124cbb/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              185. ${name}
              186. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setupRootElement(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              187. ${name}
              188. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eb598d4487da4a09475c854c23722206dc124cbb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eb598d4487da4a09475c854c23722206dc124cbb/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setupRootElement(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              189. ${name}
              190. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              191. ${name}
              192. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eb598d4487da4a09475c854c23722206dc124cbb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eb598d4487da4a09475c854c23722206dc124cbb/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setupRootElement(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              193. ${name}
              194. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "eb598d4487da4a09475c854c23722206dc124cbb", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/eb598d4487da4a09475c854c23722206dc124cbb/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              195. ${name}
              196. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              197. ${name}
              198. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              199. ${name}
              200. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n displayTpl: \"
              201. ${name}
              202. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              203. ${name}
              204. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n displayTpl: \"
              205. ${name}
              206. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/9d82ad5d6ed52c07d7910df0d5ef2b108b9e1d4c/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              207. ${name}
              208. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ac213212f2d0d421896f8e490ec99698ed1d99f0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              209. ${name}
              210. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              211. ${name}
              212. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ac213212f2d0d421896f8e490ec99698ed1d99f0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              213. ${name}
              214. \",\n insertTpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n searchKey: \"name\",\n suffix: void 0,\n hideWithoutSuffix: false,\n startWithSpace: true,\n highlightFirst: true,\n limit: 5,\n maxLen: 20,\n displayTimeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              215. ${name}
              216. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ac213212f2d0d421896f8e490ec99698ed1d99f0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              217. ${name}
              218. \"\n insertTpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n searchKey: \"name\"\n suffix: undefined\n hideWithoutSuffix: no\n startWithSpace: yes\n highlightFirst: yes\n limit: 5\n maxLen: 20\n displayTimeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ac213212f2d0d421896f8e490ec99698ed1d99f0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              219. ${name}
              220. \"\n insert_tpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ccefdd18940e098a0e82d3ac23cfd128e04c98c2", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ccefdd18940e098a0e82d3ac23cfd128e04c98c2/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              221. ${name}
              222. \"\n insert_tpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              223. ${name}
              224. \",\n insert_tpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ccefdd18940e098a0e82d3ac23cfd128e04c98c2", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ccefdd18940e098a0e82d3ac23cfd128e04c98c2/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              225. ${name}
              226. \",\n insert_tpl: \"${atwho-at}${name}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              227. ${name}
              228. \"\n insert_tpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ccefdd18940e098a0e82d3ac23cfd128e04c98c2", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ccefdd18940e098a0e82d3ac23cfd128e04c98c2/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              229. ${name}
              230. \"\n insert_tpl: \"${atwho-at}${name}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ccefdd18940e098a0e82d3ac23cfd128e04c98c2", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ccefdd18940e098a0e82d3ac23cfd128e04c98c2/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              231. ${name}
              232. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              233. ${name}
              234. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null\n```", "response": "var Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              235. ${name}
              236. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe, standalone) {\n this.setIframe(iframe, standalone);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              237. ${name}
              238. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              239. ${name}
              240. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe, standalone) -> this.setIframe(iframe, standalone); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$.fn.atwho = (method) ->\n _args = arguments\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app", "response": "result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              241. ${name}
              242. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/api.coffee", "line_start": 1, "line_end": 42} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              243. ${name}
              244. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f92b33de7c2e61e452e0f0decedaf323e7cdc284", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f92b33de7c2e61e452e0f0decedaf323e7cdc284/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              245. ${name}
              246. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null\n```", "response": "var $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              247. ${name}
              248. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f92b33de7c2e61e452e0f0decedaf323e7cdc284", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f92b33de7c2e61e452e0f0decedaf323e7cdc284/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              249. ${name}
              250. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              251. ${name}
              252. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f92b33de7c2e61e452e0f0decedaf323e7cdc284", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f92b33de7c2e61e452e0f0decedaf323e7cdc284/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=\"\"], [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method", "response": "app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              253. ${name}
              254. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f92b33de7c2e61e452e0f0decedaf323e7cdc284", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f92b33de7c2e61e452e0f0decedaf323e7cdc284/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              255. ${name}
              256. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "70057691aff1afd7d2758a638437e75a0b3185e4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              257. ${name}
              258. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null\n```", "response": "var $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              259. ${name}
              260. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "70057691aff1afd7d2758a638437e75a0b3185e4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              261. ${name}
              262. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS,\n search_key: \"name\",\n suffix: void 0,\n hide_without_suffix: false,\n start_with_space: true,\n highlight_first: true,\n limit: 5,\n max_len: 20,\n display_timeout: 300,\n delay: null\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              263. ${name}
              264. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "70057691aff1afd7d2758a638437e75a0b3185e4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n setIframe: (iframe) -> this.setIframe(iframe); null;\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method", "response": "app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              265. ${name}
              266. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n search_key: \"name\"\n suffix: undefined\n hide_without_suffix: no\n start_with_space: yes\n highlight_first: yes\n limit: 5\n max_len: 20\n display_timeout: 300\n delay: null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "70057691aff1afd7d2758a638437e75a0b3185e4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/api.coffee", "line_start": 1, "line_end": 45} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              267. ${name}
              268. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "1f13a168bb7b5dbf19f2159d7839a0d11448b75e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              269. ${name}
              270. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS\n```", "response": "var $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              271. ${name}
              272. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "1f13a168bb7b5dbf19f2159d7839a0d11448b75e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n data: null,\n tpl: \"
              273. ${name}
              274. \",\n insert_tpl: \"${atwho-data-value}\",\n callbacks: DEFAULT_CALLBACKS\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              275. ${name}
              276. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "1f13a168bb7b5dbf19f2159d7839a0d11448b75e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)", "response": "$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n data: null\n tpl: \"
              277. ${name}
              278. \"\n insert_tpl: \"${atwho-data-value}\"\n callbacks: DEFAULT_CALLBACKS", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "1f13a168bb7b5dbf19f2159d7839a0d11448b75e", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n space_after: true\n data: null\n tpl: \"
              279. ${name}
              280. \"\n insert_tpl: \"${atwho-data-value}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "4d3fb8fcebea1bee5314b2022f37a9554bbc8b57", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n space_after: true\n data: null\n tpl: \"
              281. ${name}
              282. \"\n insert_tpl: \"${atwho-data-value}\"\n```", "response": "var $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n space_after: true,\n data: null,\n tpl: \"
              283. ${name}
              284. \",\n insert_tpl: \"${atwho-data-value}\"\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "4d3fb8fcebea1bee5314b2022f37a9554bbc8b57", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $CONTAINER, Api;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n setIframe: function(iframe) {\n this.setIframe(iframe);\n return null;\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var $this, app;\n if (!(app = ($this = $(this)).data(\"atwho\"))) {\n $this.data('atwho', (app = new App(this)));\n }\n if (typeof method === 'object' || !method) {\n return app.reg(method.at, method);\n } else if (Api[method] && app) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0,\n space_after: true,\n data: null,\n tpl: \"
              285. ${name}
              286. \",\n insert_tpl: \"${atwho-data-value}\"\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n space_after: true\n data: null\n tpl: \"
              287. ${name}
              288. \"\n insert_tpl: \"${atwho-data-value}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "4d3fb8fcebea1bee5314b2022f37a9554bbc8b57", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe); null;\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)", "response": "$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if not app = ($this = $ this).data \"atwho\"\n $this.data 'atwho', (app = new App this)\n if typeof method is 'object' || !method\n app.reg method.at, method\n else if Api[method] and app\n result = Api[method].apply app, Array::slice.call(_args, 1)\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n space_after: true\n data: null\n tpl: \"
              289. ${name}
              290. \"\n insert_tpl: \"${atwho-data-value}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "4d3fb8fcebea1bee5314b2022f37a9554bbc8b57", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe)\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "0a6433a61c66fa68a8264e1ffa871fa108c37eb6", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe)\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n```", "response": "var $CONTAINER, Api, Atwho;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n setIframe: function(iframe) {\n return this.setIframe(iframe);\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\nAtwho = {\n // init or update an inputor with a special flag\n\n // @params options [Object] settings of At.js\n init: function(options) {\n var $this, app;\n app = ($this = $(this)).data(\"atwho\");\n if (!app) {\n $this.data('atwho', (app = new App(this)));\n }\n app.reg(options.at, options);\n return this;\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var app;\n if (typeof method === 'object' || !method) {\n return Atwho.init.apply(this, _args);\n } else if (Api[method]) {\n if (app = $(this).data('atwho')) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n }\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "0a6433a61c66fa68a8264e1ffa871fa108c37eb6", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $CONTAINER, Api, Atwho;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n setIframe: function(iframe) {\n return this.setIframe(iframe);\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\nAtwho = {\n // init or update an inputor with a special flag\n\n // @params options [Object] settings of At.js\n init: function(options) {\n var $this, app;\n app = ($this = $(this)).data(\"atwho\");\n if (!app) {\n $this.data('atwho', (app = new App(this)));\n }\n app.reg(options.at, options);\n return this;\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var app;\n if (typeof method === 'object' || !method) {\n return Atwho.init.apply(this, _args);\n } else if (Api[method]) {\n if (app = $(this).data('atwho')) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n }\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe)\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "0a6433a61c66fa68a8264e1ffa871fa108c37eb6", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n setIframe: (iframe) -> this.setIframe(iframe)\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)", "response": "Atwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "0a6433a61c66fa68a8264e1ffa871fa108c37eb6", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f3e706542de650f6dd1f103d9826c37f032a6ed4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n```", "response": "var $CONTAINER, Api, Atwho;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\nAtwho = {\n // init or update an inputor with a special flag\n\n // @params options [Object] settings of At.js\n init: function(options) {\n var $this, app;\n app = ($this = $(this)).data(\"atwho\");\n if (!app) {\n $this.data('atwho', (app = new App(this)));\n }\n app.reg(options.at, options);\n return this;\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var app;\n if (typeof method === 'object' || !method) {\n return Atwho.init.apply(this, _args);\n } else if (Api[method]) {\n if (app = $(this).data('atwho')) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n }\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f3e706542de650f6dd1f103d9826c37f032a6ed4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $CONTAINER, Api, Atwho;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n run: function() {\n return this.dispatch();\n },\n destroy: function() {\n this.shutdown();\n return this.$inputor.data('atwho', null);\n }\n};\n\nAtwho = {\n // init or update an inputor with a special flag\n\n // @params options [Object] settings of At.js\n init: function(options) {\n var $this, app;\n app = ($this = $(this)).data(\"atwho\");\n if (!app) {\n $this.data('atwho', (app = new App(this)));\n }\n app.reg(options.at, options);\n return this;\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var app;\n if (typeof method === 'object' || !method) {\n return Atwho.init.apply(this, _args);\n } else if (Api[method]) {\n if (app = $(this).data('atwho')) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n }\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f3e706542de650f6dd1f103d9826c37f032a6ed4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n destroy: ->\n this.shutdown()\n @$inputor.data('atwho', null)", "response": "Atwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "f3e706542de650f6dd1f103d9826c37f032a6ed4", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/f3e706542de650f6dd1f103d9826c37f032a6ed4/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "7569078e80d186c7f530356e57cf3339202efcd8", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/7569078e80d186c7f530356e57cf3339202efcd8/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nApi =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined\n```", "response": "var $CONTAINER, Api, Atwho;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n run: function() {\n return this.dispatch();\n }\n};\n\nAtwho = {\n // init or update an inputor with a special flag\n\n // @params options [Object] settings of At.js\n init: function(options) {\n var $this, app;\n app = ($this = $(this)).data(\"atwho\");\n if (!app) {\n $this.data('atwho', (app = new App(this)));\n }\n app.reg(options.at, options);\n return this;\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var app;\n if (typeof method === 'object' || !method) {\n return Atwho.init.apply(this, _args);\n } else if (Api[method]) {\n if (app = $(this).data('atwho')) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n }\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "7569078e80d186c7f530356e57cf3339202efcd8", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/7569078e80d186c7f530356e57cf3339202efcd8/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $CONTAINER, Api, Atwho;\n\nApi = {\n // load a flag's data\n\n // @params at[String] the flag\n // @params data [Array] data to storage.\n load: function(at, data) {\n var c;\n if (c = this.controller(at)) {\n return c.model.load(data);\n }\n },\n getInsertedItemsWithIDs: function(at) {\n var c, ids, items;\n if (!(c = this.controller(at))) {\n return [null, null];\n }\n if (at) {\n at = `-${c.get_opt('alias') || c.at}`;\n }\n ids = [];\n items = $.map(this.$inputor.find(`span.atwho-view-flag${at || \"\"}`), function(item) {\n var data;\n data = $(item).data('atwho-data-item');\n if (ids.indexOf(data.id) > -1) {\n return;\n }\n if (data.id) {\n ids.push = data.id;\n }\n return data;\n });\n return [ids, items];\n },\n getInsertedItems: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[1];\n },\n getInsertedIDs: function(at) {\n return Api.getInsertedItemsWithIDs.apply(this, [at])[0];\n },\n run: function() {\n return this.dispatch();\n }\n};\n\nAtwho = {\n // init or update an inputor with a special flag\n\n // @params options [Object] settings of At.js\n init: function(options) {\n var $this, app;\n app = ($this = $(this)).data(\"atwho\");\n if (!app) {\n $this.data('atwho', (app = new App(this)));\n }\n app.reg(options.at, options);\n return this;\n }\n};\n\n$CONTAINER = $(\"
                \");\n\n$.fn.atwho = function(method) {\n var _args, result;\n _args = arguments;\n $('body').append($CONTAINER);\n result = null;\n this.filter('textarea, input, [contenteditable=true]').each(function() {\n var app;\n if (typeof method === 'object' || !method) {\n return Atwho.init.apply(this, _args);\n } else if (Api[method]) {\n if (app = $(this).data('atwho')) {\n return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1));\n }\n } else {\n return $.error(`Method ${method} does not exist on jQuery.caret`);\n }\n });\n return result || this;\n};\n\n$.fn.atwho.default = {\n at: void 0,\n alias: void 0\n};\n```", "response": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n\nAtwho =\n # init or update an inputor with a special flag\n #\n # @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "7569078e80d186c7f530356e57cf3339202efcd8", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/7569078e80d186c7f530356e57cf3339202efcd8/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "ichord/At.js:src/api.coffee:1:completion", "type": "completion", "prompt": "Api =\n # load a flag's data\n #\n # @params at[String] the flag\n # @params data [Array] data to storage.\n load: (at, data) -> c.model.load data if c = this.controller(at)\n\n getInsertedItemsWithIDs: (at) ->\n return [null, null] unless c = this.controller at\n at = \"-#{c.get_opt('alias') || c.at}\" if at\n ids = []\n items = $.map @$inputor.find(\"span.atwho-view-flag#{at || \"\"}\"), (item) ->\n data = $(item).data('atwho-data-item')\n return if ids.indexOf(data.id) > -1\n ids.push = data.id if data.id\n data\n [ids, items]\n getInsertedItems: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[1]\n getInsertedIDs: (at) -> Api.getInsertedItemsWithIDs.apply(this, [at])[0]\n\n run: -> this.dispatch()\n\nAtwho =\n # init or update an inputor with a special flag\n #", "response": "# @params options [Object] settings of At.js\n init: (options) ->\n app = ($this = $(this)).data \"atwho\"\n $this.data 'atwho', (app = new App(this)) if not app\n app.reg options.at, options\n this\n\n$CONTAINER = $(\"
                \")\n\n$.fn.atwho = (method) ->\n _args = arguments\n $('body').append($CONTAINER)\n result = null\n this.filter('textarea, input, [contenteditable=true]').each ->\n if typeof method is 'object' || !method\n Atwho.init.apply this, _args\n else if Api[method]\n result = Api[method].apply app, Array::slice.call(_args, 1) if app = $(this).data('atwho')\n else\n $.error \"Method #{method} does not exist on jQuery.caret\"\n result || this\n\n$.fn.atwho.default =\n at: undefined\n alias: undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ichord/At.js", "path": "src/api.coffee", "license": "MIT", "commit": "7569078e80d186c7f530356e57cf3339202efcd8", "stars": 5250, "source_url": "https://github.com/ichord/At.js/blob/7569078e80d186c7f530356e57cf3339202efcd8/src/api.coffee", "line_start": 1, "line_end": 50} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "9fcc5f6c1cada03cbf284e4b78162fd47a882384", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/9fcc5f6c1cada03cbf284e4b78162fd47a882384/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwindow.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"\n```", "response": "var base;\n\nwindow.Tags || (window.Tags = {});\n\nTags.Templates || (Tags.Templates = {});\n\n(base = Tags.Templates)[\"2\"] || (base[\"2\"] = {});\n\nTags.Templates[\"2\"].tag = function(options = {}) {\n return `
                ${Tags.Helpers.addPadding(options.tag, 2, options.isReadOnly)} ${options.isReadOnly ? \"\" : \"\"}
                `;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "9fcc5f6c1cada03cbf284e4b78162fd47a882384", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/9fcc5f6c1cada03cbf284e4b78162fd47a882384/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar base;\n\nwindow.Tags || (window.Tags = {});\n\nTags.Templates || (Tags.Templates = {});\n\n(base = Tags.Templates)[\"2\"] || (base[\"2\"] = {});\n\nTags.Templates[\"2\"].tag = function(options = {}) {\n return `
                ${Tags.Helpers.addPadding(options.tag, 2, options.isReadOnly)} ${options.isReadOnly ? \"\" : \"\"}
                `;\n};\n```", "response": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "9fcc5f6c1cada03cbf284e4b78162fd47a882384", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/9fcc5f6c1cada03cbf284e4b78162fd47a882384/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:completion", "type": "completion", "prompt": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->", "response": "\"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "9fcc5f6c1cada03cbf284e4b78162fd47a882384", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/9fcc5f6c1cada03cbf284e4b78162fd47a882384/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "be46a8e0a6a718bca3465e19c3d2042909c2cd8d", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/be46a8e0a6a718bca3465e19c3d2042909c2cd8d/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwindow.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"\n```", "response": "var base;\n\nwindow.Tags || (window.Tags = {});\n\nTags.Templates || (Tags.Templates = {});\n\n(base = Tags.Templates)[\"2\"] || (base[\"2\"] = {});\n\nTags.Templates[\"2\"].tag = function(options = {}) {\n return `
                ${Tags.Helpers.addPadding(options.tag, 2, options.isReadOnly)} ${options.isReadOnly ? \"\" : \"\"}
                `;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "be46a8e0a6a718bca3465e19c3d2042909c2cd8d", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/be46a8e0a6a718bca3465e19c3d2042909c2cd8d/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar base;\n\nwindow.Tags || (window.Tags = {});\n\nTags.Templates || (Tags.Templates = {});\n\n(base = Tags.Templates)[\"2\"] || (base[\"2\"] = {});\n\nTags.Templates[\"2\"].tag = function(options = {}) {\n return `
                ${Tags.Helpers.addPadding(options.tag, 2, options.isReadOnly)} ${options.isReadOnly ? \"\" : \"\"}
                `;\n};\n```", "response": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "be46a8e0a6a718bca3465e19c3d2042909c2cd8d", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/be46a8e0a6a718bca3465e19c3d2042909c2cd8d/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:completion", "type": "completion", "prompt": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->", "response": "\"
                \n #{Tags.Helpers.addPadding options.tag, 2, options.isReadOnly}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "be46a8e0a6a718bca3465e19c3d2042909c2cd8d", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/be46a8e0a6a718bca3465e19c3d2042909c2cd8d/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{options.tag}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nwindow.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{options.tag}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"\n```", "response": "var base;\n\nwindow.Tags || (window.Tags = {});\n\nTags.Templates || (Tags.Templates = {});\n\n(base = Tags.Templates)[\"2\"] || (base[\"2\"] = {});\n\nTags.Templates[\"2\"].tag = function(options = {}) {\n return `
                ${options.tag} ${options.isReadOnly ? \"\" : \"\"}
                `;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar base;\n\nwindow.Tags || (window.Tags = {});\n\nTags.Templates || (Tags.Templates = {});\n\n(base = Tags.Templates)[\"2\"] || (base[\"2\"] = {});\n\nTags.Templates[\"2\"].tag = function(options = {}) {\n return `
                ${options.tag} ${options.isReadOnly ? \"\" : \"\"}
                `;\n};\n```", "response": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->\n \"
                \n #{options.tag}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8} +{"id": "maxwells/bootstrap-tags:src/templates/2/tag.coffee:1:completion", "type": "completion", "prompt": "window.Tags ||= {}\nTags.Templates ||= {}\nTags.Templates[\"2\"] ||= {}\nTags.Templates[\"2\"].tag = (options = {}) ->", "response": "\"
                \n #{options.tag}\n #{ if options.isReadOnly then \"\" else \"\" }\n
                \"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "maxwells/bootstrap-tags", "path": "src/templates/2/tag.coffee", "license": "MIT", "commit": "23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1", "stars": 543, "source_url": "https://github.com/maxwells/bootstrap-tags/blob/23509c0e8bcb2e9bf7a4e5558dfbca7fc5c353b1/src/templates/2/tag.coffee", "line_start": 1, "line_end": 8}