{"id": "jianliaoim/talk-os:talk-web/client/updater/tagged-results.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Immutable = require 'immutable'\n\nexports.read = (store, actionData) ->\n messagesList = actionData.get('messages')\n\n store.update 'taggedResults', (messages) ->\n messages.concat messagesList\n\nexports.clear = (store, actionData) ->\n store.set 'taggedResults', Immutable.List()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/tagged-results.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/tagged-results.coffee", "line_start": 1, "line_end": 10} {"id": "jianliaoim/talk-os:talk-web/client/updater/tagged-results.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nImmutable = require 'immutable'\n\nexports.read = (store, actionData) ->\n messagesList = actionData.get('messages')\n\n store.update 'taggedResults', (messages) ->\n messages.concat messagesList\n\nexports.clear = (store, actionData) ->\n store.set 'taggedResults', Immutable.List()\n```", "response": "var Immutable;\n\nImmutable = require('immutable');\n\nexports.read = function(store, actionData) {\n var messagesList;\n messagesList = actionData.get('messages');\n return store.update('taggedResults', function(messages) {\n return messages.concat(messagesList);\n });\n};\n\nexports.clear = function(store, actionData) {\n return store.set('taggedResults', Immutable.List());\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/tagged-results.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/tagged-results.coffee", "line_start": 1, "line_end": 10} {"id": "jianliaoim/talk-os:talk-web/client/updater/tagged-results.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Immutable;\n\nImmutable = require('immutable');\n\nexports.read = function(store, actionData) {\n var messagesList;\n messagesList = actionData.get('messages');\n return store.update('taggedResults', function(messages) {\n return messages.concat(messagesList);\n });\n};\n\nexports.clear = function(store, actionData) {\n return store.set('taggedResults', Immutable.List());\n};\n```", "response": "Immutable = require 'immutable'\n\nexports.read = (store, actionData) ->\n messagesList = actionData.get('messages')\n\n store.update 'taggedResults', (messages) ->\n messages.concat messagesList\n\nexports.clear = (store, actionData) ->\n store.set 'taggedResults', Immutable.List()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/tagged-results.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/tagged-results.coffee", "line_start": 1, "line_end": 10} {"id": "jianliaoim/talk-os:talk-web/client/updater/tagged-results.coffee:1:completion", "type": "completion", "prompt": "Immutable = require 'immutable'\n\nexports.read = (store, actionData) ->\n messagesList = actionData.get('messages')", "response": "store.update 'taggedResults', (messages) ->\n messages.concat messagesList\n\nexports.clear = (store, actionData) ->\n store.set 'taggedResults', Immutable.List()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/updater/tagged-results.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/tagged-results.coffee", "line_start": 1, "line_end": 10} {"id": "Glavin001/atom-beautify:src/logger.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nGlobal Logger\n###\nmodule.exports = do ->\n # Create Event Emitter\n {Emitter} = require 'event-kit'\n emitter = new Emitter()\n # Create Transport with Writable Stream\n # See http://stackoverflow.com/a/21583831/2578205\n winston = require('winston')\n stream = require('stream')\n writable = new stream.Writable()\n writable._write = (chunk, encoding, next) ->\n msg = chunk.toString()\n # console.log(msg)\n emitter.emit('logging', msg)\n next()\n\n levels = {\n silly: 0,\n input: 1,\n verbose: 2,\n prompt: 3,\n debug: 4,\n info: 5,\n data: 6,\n help: 7,\n warn: 8,\n error: 9\n }\n\n return (label) ->\n transport = new (winston.transports.File)({\n label: label\n level: 'debug'\n timestamp: true\n # prettyPrint: true\n # colorize: true\n stream: writable\n json: false\n })\n # Initialize logger\n wlogger = new (winston.Logger)({\n # Configure transports\n transports: [\n transport\n ]\n })\n wlogger.on('logging', (transport, level, msg, meta)->\n loggerLevel = atom?.config.get(\\", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/logger.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/logger.coffee", "line_start": 1, "line_end": 50} {"id": "Glavin001/atom-beautify:src/logger.coffee:1:completion", "type": "completion", "prompt": "###\nGlobal Logger\n###\nmodule.exports = do ->\n # Create Event Emitter\n {Emitter} = require 'event-kit'\n emitter = new Emitter()\n # Create Transport with Writable Stream\n # See http://stackoverflow.com/a/21583831/2578205\n winston = require('winston')\n stream = require('stream')\n writable = new stream.Writable()\n writable._write = (chunk, encoding, next) ->\n msg = chunk.toString()\n # console.log(msg)\n emitter.emit('logging', msg)\n next()\n\n levels = {\n silly: 0,\n input: 1,\n verbose: 2,\n prompt: 3,\n debug: 4,\n info: 5,", "response": "data: 6,\n help: 7,\n warn: 8,\n error: 9\n }\n\n return (label) ->\n transport = new (winston.transports.File)({\n label: label\n level: 'debug'\n timestamp: true\n # prettyPrint: true\n # colorize: true\n stream: writable\n json: false\n })\n # Initialize logger\n wlogger = new (winston.Logger)({\n # Configure transports\n transports: [\n transport\n ]\n })\n wlogger.on('logging', (transport, level, msg, meta)->\n loggerLevel = atom?.config.get(\\", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/logger.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/logger.coffee", "line_start": 1, "line_end": 50} {"id": "Glavin001/atom-beautify:src/logger.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "'atom-beautify.general.loggerLevel') ? \"warn\"\n # console.log('logging', loggerLevel, arguments)\n loggerLevelNum = levels[loggerLevel]\n levelNum = levels[level]\n if loggerLevelNum <= levelNum\n path = require('path')\n label = \"#{path.dirname(transport.label)\\\n .split(path.sep).reverse()[0]}\\\n #{path.sep}#{path.basename(transport.label)}\"\n d = new Date()\n console.log(\"#{d.toLocaleDateString()} #{d.toLocaleTimeString()} - #{label} [#{level}]: #{msg}\", meta)\n )\n # Export logger methods\n loggerMethods = ['silly','debug','verbose','info','warn','error']\n logger = {}\n for method in loggerMethods\n logger[method] = wlogger[method]\n # Add logger listener\n logger.onLogging = (handler) ->\n # console.log('onLogging', handler)\n subscription = emitter.on('logging', handler)\n # console.log('emitter', emitter.handlersByEventName, subscription)\n return subscription\n # Return simplified logger\n return logger", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/logger.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/logger.coffee", "line_start": 51, "line_end": 75} {"id": "Glavin001/atom-beautify:src/logger.coffee:2:completion", "type": "completion", "prompt": "'atom-beautify.general.loggerLevel') ? \"warn\"\n # console.log('logging', loggerLevel, arguments)\n loggerLevelNum = levels[loggerLevel]\n levelNum = levels[level]\n if loggerLevelNum <= levelNum\n path = require('path')\n label = \"#{path.dirname(transport.label)\\\n .split(path.sep).reverse()[0]}\\\n #{path.sep}#{path.basename(transport.label)}\"\n d = new Date()\n console.log(\"#{d.toLocaleDateString()} #{d.toLocaleTimeString()} - #{label} [#{level}]: #{msg}\", meta)\n )", "response": "# Export logger methods\n loggerMethods = ['silly','debug','verbose','info','warn','error']\n logger = {}\n for method in loggerMethods\n logger[method] = wlogger[method]\n # Add logger listener\n logger.onLogging = (handler) ->\n # console.log('onLogging', handler)\n subscription = emitter.on('logging', handler)\n # console.log('emitter', emitter.handlersByEventName, subscription)\n return subscription\n # Return simplified logger\n return logger", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/logger.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/logger.coffee", "line_start": 51, "line_end": 75} {"id": "jianliaoim/talk-os:talk-api2x/server/config/response.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Err = require 'err1st'\njsonMask = require 'json-mask'\n_ = require 'lodash'\nsocket = require '../components/socket'\nlogger = require '../components/logger'\n\napp = require '../server'\n\nres = app.response\n\nres.response = ->\n {err, result, req} = this\n if err\n err = new Err(err) unless err instanceof Err\n if err.code is 100 # Log the unknown error\n logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack\n @status(err.status or 400).json\n code: err.code\n message: err.locale(req.getLocale()).message\n else\n result = result?.toJSON?() or result\n if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']\n result = jsonMask(result, @req.query?.fields) or undefined\n if @req.query?.excludeFields and toString.call(result) is '[object Object]'\n result = _.omit(result, @req.query.excludeFields.split(','))\n @status(200).send(result)\n\nres.broadcast = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, @req.get('socketId'), callback\n\nres.publish = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, null, callback\n\nres.join = (channel, callback) ->\n socket.join channel, @req.get('socketId'), callback\n\nres.leave = (channel, callback) ->\n socket.leave channel, @req.get('socketId'), callback", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/response.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/response.coffee", "line_start": 1, "line_end": 38} {"id": "jianliaoim/talk-os:talk-api2x/server/config/response.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nErr = require 'err1st'\njsonMask = require 'json-mask'\n_ = require 'lodash'\nsocket = require '../components/socket'\nlogger = require '../components/logger'\n\napp = require '../server'\n\nres = app.response\n\nres.response = ->\n {err, result, req} = this\n if err\n err = new Err(err) unless err instanceof Err\n if err.code is 100 # Log the unknown error\n logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack\n @status(err.status or 400).json\n code: err.code\n message: err.locale(req.getLocale()).message\n else\n result = result?.toJSON?() or result\n if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']\n result = jsonMask(result, @req.query?.fields) or undefined\n if @req.query?.excludeFields and toString.call(result) is '[object Object]'\n result = _.omit(result, @req.query.excludeFields.split(','))\n @status(200).send(result)\n\nres.broadcast = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, @req.get('socketId'), callback\n\nres.publish = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, null, callback\n\nres.join = (channel, callback) ->\n socket.join channel, @req.get('socketId'), callback\n\nres.leave = (channel, callback) ->\n socket.leave channel, @req.get('socketId'), callback\n```", "response": "var Err, _, app, jsonMask, logger, res, socket;\n\nErr = require('err1st');\n\njsonMask = require('json-mask');\n\n_ = require('lodash');\n\nsocket = require('../components/socket');\n\nlogger = require('../components/logger');\n\napp = require('../server');\n\nres = app.response;\n\nres.response = function() {\n var err, ref, ref1, ref2, ref3, req, result;\n ({err, result, req} = this);\n if (err) {\n if (!(err instanceof Err)) {\n err = new Err(err);\n }\n if (err.code === 100) { // Log the unknown error\n logger.err(req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack);\n }\n return this.status(err.status || 400).json({\n code: err.code,\n message: err.locale(req.getLocale()).message\n });\n } else {\n result = (result != null ? typeof result.toJSON === \"function\" ? result.toJSON() : void 0 : void 0) || result;\n if (((ref = this.req.query) != null ? ref.fields : void 0) && ((ref1 = toString.call(result)) === '[object Object]' || ref1 === '[object Array]')) {\n result = jsonMask(result, (ref2 = this.req.query) != null ? ref2.fields : void 0) || void 0;\n }\n if (((ref3 = this.req.query) != null ? ref3.excludeFields : void 0) && toString.call(result) === '[object Object]') {\n result = _.omit(result, this.req.query.excludeFields.split(','));\n }\n return this.status(200).send(result);\n }\n};\n\nres.broadcast = function(channel, event, data, callback) {\n return socket.broadcast(channel, event, data, this.req.get('socketId'), callback);\n};\n\nres.publish = function(channel, event, data, callback) {\n return socket.broadcast(channel, event, data, null, callback);\n};\n\nres.join = function(channel, callback) {\n return socket.join(channel, this.req.get('socketId'), callback);\n};\n\nres.leave = function(channel, callback) {\n return socket.leave(channel, this.req.get('socketId'), callback);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/response.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/response.coffee", "line_start": 1, "line_end": 38} {"id": "jianliaoim/talk-os:talk-api2x/server/config/response.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Err, _, app, jsonMask, logger, res, socket;\n\nErr = require('err1st');\n\njsonMask = require('json-mask');\n\n_ = require('lodash');\n\nsocket = require('../components/socket');\n\nlogger = require('../components/logger');\n\napp = require('../server');\n\nres = app.response;\n\nres.response = function() {\n var err, ref, ref1, ref2, ref3, req, result;\n ({err, result, req} = this);\n if (err) {\n if (!(err instanceof Err)) {\n err = new Err(err);\n }\n if (err.code === 100) { // Log the unknown error\n logger.err(req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack);\n }\n return this.status(err.status || 400).json({\n code: err.code,\n message: err.locale(req.getLocale()).message\n });\n } else {\n result = (result != null ? typeof result.toJSON === \"function\" ? result.toJSON() : void 0 : void 0) || result;\n if (((ref = this.req.query) != null ? ref.fields : void 0) && ((ref1 = toString.call(result)) === '[object Object]' || ref1 === '[object Array]')) {\n result = jsonMask(result, (ref2 = this.req.query) != null ? ref2.fields : void 0) || void 0;\n }\n if (((ref3 = this.req.query) != null ? ref3.excludeFields : void 0) && toString.call(result) === '[object Object]') {\n result = _.omit(result, this.req.query.excludeFields.split(','));\n }\n return this.status(200).send(result);\n }\n};\n\nres.broadcast = function(channel, event, data, callback) {\n return socket.broadcast(channel, event, data, this.req.get('socketId'), callback);\n};\n\nres.publish = function(channel, event, data, callback) {\n return socket.broadcast(channel, event, data, null, callback);\n};\n\nres.join = function(channel, callback) {\n return socket.join(channel, this.req.get('socketId'), callback);\n};\n\nres.leave = function(channel, callback) {\n return socket.leave(channel, this.req.get('socketId'), callback);\n};\n```", "response": "Err = require 'err1st'\njsonMask = require 'json-mask'\n_ = require 'lodash'\nsocket = require '../components/socket'\nlogger = require '../components/logger'\n\napp = require '../server'\n\nres = app.response\n\nres.response = ->\n {err, result, req} = this\n if err\n err = new Err(err) unless err instanceof Err\n if err.code is 100 # Log the unknown error\n logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack\n @status(err.status or 400).json\n code: err.code\n message: err.locale(req.getLocale()).message\n else\n result = result?.toJSON?() or result\n if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']\n result = jsonMask(result, @req.query?.fields) or undefined\n if @req.query?.excludeFields and toString.call(result) is '[object Object]'\n result = _.omit(result, @req.query.excludeFields.split(','))\n @status(200).send(result)\n\nres.broadcast = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, @req.get('socketId'), callback\n\nres.publish = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, null, callback\n\nres.join = (channel, callback) ->\n socket.join channel, @req.get('socketId'), callback\n\nres.leave = (channel, callback) ->\n socket.leave channel, @req.get('socketId'), callback", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/response.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/response.coffee", "line_start": 1, "line_end": 38} {"id": "jianliaoim/talk-os:talk-api2x/server/config/response.coffee:1:completion", "type": "completion", "prompt": "Err = require 'err1st'\njsonMask = require 'json-mask'\n_ = require 'lodash'\nsocket = require '../components/socket'\nlogger = require '../components/logger'\n\napp = require '../server'\n\nres = app.response\n\nres.response = ->\n {err, result, req} = this\n if err\n err = new Err(err) unless err instanceof Err\n if err.code is 100 # Log the unknown error\n logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack\n @status(err.status or 400).json\n code: err.code\n message: err.locale(req.getLocale()).message", "response": "else\n result = result?.toJSON?() or result\n if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']\n result = jsonMask(result, @req.query?.fields) or undefined\n if @req.query?.excludeFields and toString.call(result) is '[object Object]'\n result = _.omit(result, @req.query.excludeFields.split(','))\n @status(200).send(result)\n\nres.broadcast = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, @req.get('socketId'), callback\n\nres.publish = (channel, event, data, callback) ->\n socket.broadcast channel, event, data, null, callback\n\nres.join = (channel, callback) ->\n socket.join channel, @req.get('socketId'), callback\n\nres.leave = (channel, callback) ->\n socket.leave channel, @req.get('socketId'), callback", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/response.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/response.coffee", "line_start": 1, "line_end": 38} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.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# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl\n\n checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.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# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl\n\n checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url\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// Provides access to the CyclotronData API\ncyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {\n var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;\n defaultUrl = configService.restServiceUrl;\n checkBucketExists = function(key, url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Checking if bucket exists:', key);\n url = url + '/data/' + encodeURIComponent(key);\n req = $http.get(url);\n return req.then(function(result) {\n return true;\n }).catch(function(error) {\n return false;\n });\n };\n createBucket = function(key, data = [], url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Creating new bucket:', key);\n url = url + '/data';\n req = $http.post(url, {key, data});\n return req.then(function(result) {\n return result.data;\n });\n };\n return ensureBucketExists = function(key, url = defaultUrl) {\n return checkBucketExists(key, url).then(function(result) {\n if (!result) {\n return createBucket(key, [], url);\n }\n });\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.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// Provides access to the CyclotronData API\ncyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {\n var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;\n defaultUrl = configService.restServiceUrl;\n checkBucketExists = function(key, url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Checking if bucket exists:', key);\n url = url + '/data/' + encodeURIComponent(key);\n req = $http.get(url);\n return req.then(function(result) {\n return true;\n }).catch(function(error) {\n return false;\n });\n };\n createBucket = function(key, data = [], url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Creating new bucket:', key);\n url = url + '/data';\n req = $http.post(url, {key, data});\n return req.then(function(result) {\n return result.data;\n });\n };\n return ensureBucketExists = function(key, url = defaultUrl) {\n return checkBucketExists(key, url).then(function(result) {\n if (!result) {\n return createBucket(key, [], url);\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\n#\n# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl\n\n checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.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# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl", "response": "checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return {\n # Gets a list of available buckets (without data)\n getBuckets: (url = defaultUrl) ->\n url = url + '/data'\n req = $http.get url\n req.then (result) -> result.data\n\n bucketExists: checkBucketExists\n\n # Creates a new bucket\n createBucket: createBucket\n\n # Deletes a bucket\n deleteBucket: (key, url = defaultUrl) ->\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.delete url\n\n # Gets a bucket\n getBucket: (key, url = defaultUrl) ->\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n result.data\n .catch (error) ->\n null\n\n # Gets just the data for a bucket\n getBucketData: (key, url = defaultUrl) ->\n url = url + '/data/' + encodeURIComponent(key) + '/data'\n req = $http.get url\n req.then (result) ->\n result.data\n .catch (error) ->\n null\n\n # Replaces the data for a bucket\n updateBucketData: (key, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->\n url = url + '/data/' + encodeURIComponent(key) + '/data'\n req = $http.put url, data\n req.then (result) -> result.data", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 42, "line_end": 82} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:2:completion", "type": "completion", "prompt": "return {\n # Gets a list of available buckets (without data)\n getBuckets: (url = defaultUrl) ->\n url = url + '/data'\n req = $http.get url\n req.then (result) -> result.data\n\n bucketExists: checkBucketExists\n\n # Creates a new bucket\n createBucket: createBucket\n\n # Deletes a bucket\n deleteBucket: (key, url = defaultUrl) ->\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.delete url\n\n # Gets a bucket\n getBucket: (key, url = defaultUrl) ->\n url = url + '/data/' + encodeURIComponent(key)", "response": "req = $http.get url\n req.then (result) ->\n result.data\n .catch (error) ->\n null\n\n # Gets just the data for a bucket\n getBucketData: (key, url = defaultUrl) ->\n url = url + '/data/' + encodeURIComponent(key) + '/data'\n req = $http.get url\n req.then (result) ->\n result.data\n .catch (error) ->\n null\n\n # Replaces the data for a bucket\n updateBucketData: (key, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->\n url = url + '/data/' + encodeURIComponent(key) + '/data'\n req = $http.put url, data\n req.then (result) -> result.data", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 42, "line_end": 82} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Appends to the data for a bucket\n append: (key, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->\n url = url + '/data/' + encodeURIComponent(key) + '/append'\n req = $http.post url, data\n req.then (result) -> result.data\n\n # Upserts a row of data for a bucket\n upsert: (key, matchingKeys, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->\n url = url + '/data/' + encodeURIComponent(key) + '/upsert'\n req = $http.post url, { keys: matchingKeys, data: data }\n req.then (result) -> result.data\n\n # Removes matching data from a bucket\n remove: (key, matchingKeys, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->\n url = url + '/data/' + encodeURIComponent(key) + '/remove'\n req = $http.post url, matchingKeys\n req.then (result) -> result.data\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 84, "line_end": 104} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:3:completion", "type": "completion", "prompt": "# Appends to the data for a bucket\n append: (key, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->\n url = url + '/data/' + encodeURIComponent(key) + '/append'\n req = $http.post url, data\n req.then (result) -> result.data\n\n # Upserts a row of data for a bucket\n upsert: (key, matchingKeys, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->", "response": "url = url + '/data/' + encodeURIComponent(key) + '/upsert'\n req = $http.post url, { keys: matchingKeys, data: data }\n req.then (result) -> result.data\n\n # Removes matching data from a bucket\n remove: (key, matchingKeys, data, url = defaultUrl) ->\n ensureBucketExists(key, url).then ->\n url = url + '/data/' + encodeURIComponent(key) + '/remove'\n req = $http.post url, matchingKeys\n req.then (result) -> result.data\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 84, "line_end": 104} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n# Copyright (c) 2013-2016 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# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl\n\n checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0d7d6f843df6f4dc02ea758dc88423d6884d20be", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0d7d6f843df6f4dc02ea758dc88423d6884d20be/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n# Copyright (c) 2013-2016 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# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl\n\n checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url\n```", "response": "/*\n * Copyright (c) 2013-2016 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// Provides access to the CyclotronData API\ncyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {\n var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;\n defaultUrl = configService.restServiceUrl;\n checkBucketExists = function(key, url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Checking if bucket exists:', key);\n url = url + '/data/' + encodeURIComponent(key);\n req = $http.get(url);\n return req.then(function(result) {\n return true;\n }).catch(function(error) {\n return false;\n });\n };\n createBucket = function(key, data = [], url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Creating new bucket:', key);\n url = url + '/data';\n req = $http.post(url, {key, data});\n return req.then(function(result) {\n return result.data;\n });\n };\n return ensureBucketExists = function(key, url = defaultUrl) {\n return checkBucketExists(key, url).then(function(result) {\n if (!result) {\n return createBucket(key, [], url);\n }\n });\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0d7d6f843df6f4dc02ea758dc88423d6884d20be", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0d7d6f843df6f4dc02ea758dc88423d6884d20be/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n * Copyright (c) 2013-2016 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// Provides access to the CyclotronData API\ncyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {\n var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;\n defaultUrl = configService.restServiceUrl;\n checkBucketExists = function(key, url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Checking if bucket exists:', key);\n url = url + '/data/' + encodeURIComponent(key);\n req = $http.get(url);\n return req.then(function(result) {\n return true;\n }).catch(function(error) {\n return false;\n });\n };\n createBucket = function(key, data = [], url = defaultUrl) {\n var req;\n logService.debug('CyclotronData: Creating new bucket:', key);\n url = url + '/data';\n req = $http.post(url, {key, data});\n return req.then(function(result) {\n return result.data;\n });\n };\n return ensureBucketExists = function(key, url = defaultUrl) {\n return checkBucketExists(key, url).then(function(result) {\n if (!result) {\n return createBucket(key, [], url);\n }\n });\n };\n});\n```", "response": "###\n# Copyright (c) 2013-2016 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# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl\n\n checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0d7d6f843df6f4dc02ea758dc88423d6884d20be", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0d7d6f843df6f4dc02ea758dc88423d6884d20be/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee:1:completion", "type": "completion", "prompt": "###\n# Copyright (c) 2013-2016 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# Provides access to the CyclotronData API\ncyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->\n defaultUrl = configService.restServiceUrl", "response": "checkBucketExists = (key, url = defaultUrl) ->\n logService.debug 'CyclotronData: Checking if bucket exists:', key\n url = url + '/data/' + encodeURIComponent(key)\n req = $http.get url\n req.then (result) ->\n true\n .catch (error) ->\n false\n\n createBucket = (key, data = [], url = defaultUrl) ->\n logService.debug 'CyclotronData: Creating new bucket:', key\n url = url + '/data'\n req = $http.post url, { key, data }\n req.then (result) -> result.data\n\n ensureBucketExists = (key, url = defaultUrl) ->\n checkBucketExists(key, url).then (result) ->\n if !result\n createBucket key, [], url", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "license": "MIT", "commit": "0d7d6f843df6f4dc02ea758dc88423d6884d20be", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0d7d6f843df6f4dc02ea758dc88423d6884d20be/cyclotron-site/app/scripts/dashboards/services/services.cyclotronDataService.coffee", "line_start": 1, "line_end": 40} {"id": "xhan/qqbot:tests/longpoll.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'\n client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'\n uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n # log 'psessionid',psessionid\n # log 'client_id',client_id\n # log 'ptwebqq',ptwebqq\n # log 'uin',uin\n # log 'vfwebqq',vfwebqq\n\n\n api.send_message2user 2440652742, \"你好啊\" , client_id,psessionid, (ret,e)->\n log \"send ret:\",ret\n # log \"长轮训\"\n # api.long_poll client_id , psessionid , (ret)->\n # log ret\n\ntest_long_pull()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "ac7a9bd1a1d3e8c3beae93a884de07392ea38afd", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/ac7a9bd1a1d3e8c3beae93a884de07392ea38afd/tests/longpoll.coffee", "line_start": 1, "line_end": 34} {"id": "xhan/qqbot:tests/longpoll.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'\n client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'\n uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n # log 'psessionid',psessionid\n # log 'client_id',client_id\n # log 'ptwebqq',ptwebqq\n # log 'uin',uin\n # log 'vfwebqq',vfwebqq\n\n\n api.send_message2user 2440652742, \"你好啊\" , client_id,psessionid, (ret,e)->\n log \"send ret:\",ret\n # log \"长轮训\"\n # api.long_poll client_id , psessionid , (ret)->\n # log ret\n\ntest_long_pull()\n```", "response": "//!/usr/bin/env coffee\nvar api, auth, config, int, log, pass, qq, test_long_pull;\n\nint = function(v) {\n return parseInt(v);\n};\n\nlog = console.log;\n\nauth = require(\"../src/qqauth\");\n\napi = require(\"../src/qqapi\");\n\nconfig = require('../config');\n\nqq = config.account;\n\npass = config.password;\n\ntest_long_pull = function() {\n var client_id, psessionid, ptwebqq, uin, vfwebqq;\n api.defaults_read();\n psessionid = api.defaults('psessionid');\n client_id = api.defaults('clientid');\n ptwebqq = api.defaults('ptwebqq');\n uin = api.defaults('uin');\n vfwebqq = api.defaults('vfwebqq');\n // log 'psessionid',psessionid\n // log 'client_id',client_id\n // log 'ptwebqq',ptwebqq\n // log 'uin',uin\n // log 'vfwebqq',vfwebqq\n return api.send_message2user(2440652742, \"你好啊\", client_id, psessionid, function(ret, e) {\n return log(\"send ret:\", ret);\n });\n};\n\n// log \"长轮训\"\n// api.long_poll client_id , psessionid , (ret)->\n// log ret\ntest_long_pull();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "ac7a9bd1a1d3e8c3beae93a884de07392ea38afd", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/ac7a9bd1a1d3e8c3beae93a884de07392ea38afd/tests/longpoll.coffee", "line_start": 1, "line_end": 34} {"id": "xhan/qqbot:tests/longpoll.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n//!/usr/bin/env coffee\nvar api, auth, config, int, log, pass, qq, test_long_pull;\n\nint = function(v) {\n return parseInt(v);\n};\n\nlog = console.log;\n\nauth = require(\"../src/qqauth\");\n\napi = require(\"../src/qqapi\");\n\nconfig = require('../config');\n\nqq = config.account;\n\npass = config.password;\n\ntest_long_pull = function() {\n var client_id, psessionid, ptwebqq, uin, vfwebqq;\n api.defaults_read();\n psessionid = api.defaults('psessionid');\n client_id = api.defaults('clientid');\n ptwebqq = api.defaults('ptwebqq');\n uin = api.defaults('uin');\n vfwebqq = api.defaults('vfwebqq');\n // log 'psessionid',psessionid\n // log 'client_id',client_id\n // log 'ptwebqq',ptwebqq\n // log 'uin',uin\n // log 'vfwebqq',vfwebqq\n return api.send_message2user(2440652742, \"你好啊\", client_id, psessionid, function(ret, e) {\n return log(\"send ret:\", ret);\n });\n};\n\n// log \"长轮训\"\n// api.long_poll client_id , psessionid , (ret)->\n// log ret\ntest_long_pull();\n```", "response": "#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'\n client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'\n uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n # log 'psessionid',psessionid\n # log 'client_id',client_id\n # log 'ptwebqq',ptwebqq\n # log 'uin',uin\n # log 'vfwebqq',vfwebqq\n\n\n api.send_message2user 2440652742, \"你好啊\" , client_id,psessionid, (ret,e)->\n log \"send ret:\",ret\n # log \"长轮训\"\n # api.long_poll client_id , psessionid , (ret)->\n # log ret\n\ntest_long_pull()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "ac7a9bd1a1d3e8c3beae93a884de07392ea38afd", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/ac7a9bd1a1d3e8c3beae93a884de07392ea38afd/tests/longpoll.coffee", "line_start": 1, "line_end": 34} {"id": "xhan/qqbot:tests/longpoll.coffee:1:completion", "type": "completion", "prompt": "#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'\n client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'", "response": "uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n # log 'psessionid',psessionid\n # log 'client_id',client_id\n # log 'ptwebqq',ptwebqq\n # log 'uin',uin\n # log 'vfwebqq',vfwebqq\n\n\n api.send_message2user 2440652742, \"你好啊\" , client_id,psessionid, (ret,e)->\n log \"send ret:\",ret\n # log \"长轮训\"\n # api.long_poll client_id , psessionid , (ret)->\n # log ret\n\ntest_long_pull()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "ac7a9bd1a1d3e8c3beae93a884de07392ea38afd", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/ac7a9bd1a1d3e8c3beae93a884de07392ea38afd/tests/longpoll.coffee", "line_start": 1, "line_end": 34} {"id": "xhan/qqbot:tests/longpoll.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'\n client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'\n uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n log 'psessionid',psessionid\n log 'client_id',client_id\n log 'ptwebqq',ptwebqq\n log 'uin',uin\n log 'vfwebqq',vfwebqq\n\n log \"长轮训\"\n api.long_poll client_id , psessionid , (ret)->\n log ret\n\ntest_long_pull()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "3a214d86b5bfcd77af8dab465e01366790f1b82a", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/tests/longpoll.coffee", "line_start": 1, "line_end": 31} {"id": "xhan/qqbot:tests/longpoll.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'\n client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'\n uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n log 'psessionid',psessionid\n log 'client_id',client_id\n log 'ptwebqq',ptwebqq\n log 'uin',uin\n log 'vfwebqq',vfwebqq\n\n log \"长轮训\"\n api.long_poll client_id , psessionid , (ret)->\n log ret\n\ntest_long_pull()\n```", "response": "//!/usr/bin/env coffee\nvar api, auth, config, int, log, pass, qq, test_long_pull;\n\nint = function(v) {\n return parseInt(v);\n};\n\nlog = console.log;\n\nauth = require(\"../src/qqauth\");\n\napi = require(\"../src/qqapi\");\n\nconfig = require('../config');\n\nqq = config.account;\n\npass = config.password;\n\ntest_long_pull = function() {\n var client_id, psessionid, ptwebqq, uin, vfwebqq;\n api.defaults_read();\n psessionid = api.defaults('psessionid');\n client_id = api.defaults('clientid');\n ptwebqq = api.defaults('ptwebqq');\n uin = api.defaults('uin');\n vfwebqq = api.defaults('vfwebqq');\n log('psessionid', psessionid);\n log('client_id', client_id);\n log('ptwebqq', ptwebqq);\n log('uin', uin);\n log('vfwebqq', vfwebqq);\n log(\"长轮训\");\n return api.long_poll(client_id, psessionid, function(ret) {\n return log(ret);\n });\n};\n\ntest_long_pull();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "3a214d86b5bfcd77af8dab465e01366790f1b82a", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/tests/longpoll.coffee", "line_start": 1, "line_end": 31} {"id": "xhan/qqbot:tests/longpoll.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n//!/usr/bin/env coffee\nvar api, auth, config, int, log, pass, qq, test_long_pull;\n\nint = function(v) {\n return parseInt(v);\n};\n\nlog = console.log;\n\nauth = require(\"../src/qqauth\");\n\napi = require(\"../src/qqapi\");\n\nconfig = require('../config');\n\nqq = config.account;\n\npass = config.password;\n\ntest_long_pull = function() {\n var client_id, psessionid, ptwebqq, uin, vfwebqq;\n api.defaults_read();\n psessionid = api.defaults('psessionid');\n client_id = api.defaults('clientid');\n ptwebqq = api.defaults('ptwebqq');\n uin = api.defaults('uin');\n vfwebqq = api.defaults('vfwebqq');\n log('psessionid', psessionid);\n log('client_id', client_id);\n log('ptwebqq', ptwebqq);\n log('uin', uin);\n log('vfwebqq', vfwebqq);\n log(\"长轮训\");\n return api.long_poll(client_id, psessionid, function(ret) {\n return log(ret);\n });\n};\n\ntest_long_pull();\n```", "response": "#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'\n client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'\n uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n log 'psessionid',psessionid\n log 'client_id',client_id\n log 'ptwebqq',ptwebqq\n log 'uin',uin\n log 'vfwebqq',vfwebqq\n\n log \"长轮训\"\n api.long_poll client_id , psessionid , (ret)->\n log ret\n\ntest_long_pull()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "3a214d86b5bfcd77af8dab465e01366790f1b82a", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/tests/longpoll.coffee", "line_start": 1, "line_end": 31} {"id": "xhan/qqbot:tests/longpoll.coffee:1:completion", "type": "completion", "prompt": "#!/usr/bin/env coffee\n\nint = (v) -> parseInt v\nlog = console.log\nauth = require \"../src/qqauth\"\napi = require \"../src/qqapi\"\n\nconfig = require '../config'\nqq = config.account\npass = config.password\n\ntest_long_pull = ->\n api.defaults_read()\n\n psessionid = api.defaults 'psessionid'", "response": "client_id = api.defaults 'clientid'\n ptwebqq = api.defaults 'ptwebqq'\n uin = api.defaults 'uin'\n vfwebqq = api.defaults 'vfwebqq'\n\n log 'psessionid',psessionid\n log 'client_id',client_id\n log 'ptwebqq',ptwebqq\n log 'uin',uin\n log 'vfwebqq',vfwebqq\n\n log \"长轮训\"\n api.long_poll client_id , psessionid , (ret)->\n log ret\n\ntest_long_pull()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "xhan/qqbot", "path": "tests/longpoll.coffee", "license": "MIT", "commit": "3a214d86b5bfcd77af8dab465e01366790f1b82a", "stars": 1435, "source_url": "https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/tests/longpoll.coffee", "line_start": 1, "line_end": 31} {"id": "layerssss/paste.js:paste.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$.paste = (pasteContainer) ->\n console?.log \"DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.\"\n pm = Paste.mountNonInputable pasteContainer\n pm._container", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 8, "line_end": 11} {"id": "layerssss/paste.js:paste.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$.paste = (pasteContainer) ->\n console?.log \"DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.\"\n pm = Paste.mountNonInputable pasteContainer\n pm._container\n```", "response": "$.paste = function(pasteContainer) {\n var pm;\n if (typeof console !== \"undefined\" && console !== null) {\n console.log(\"DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.\");\n }\n pm = Paste.mountNonInputable(pasteContainer);\n return pm._container;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 8, "line_end": 11} {"id": "layerssss/paste.js:paste.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$.paste = function(pasteContainer) {\n var pm;\n if (typeof console !== \"undefined\" && console !== null) {\n console.log(\"DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.\");\n }\n pm = Paste.mountNonInputable(pasteContainer);\n return pm._container;\n};\n```", "response": "$.paste = (pasteContainer) ->\n console?.log \"DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.\"\n pm = Paste.mountNonInputable pasteContainer\n pm._container", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 8, "line_end": 11} {"id": "layerssss/paste.js:paste.coffee:1:completion", "type": "completion", "prompt": "$.paste = (pasteContainer) ->\n console?.log \"DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.\"", "response": "pm = Paste.mountNonInputable pasteContainer\n pm._container", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 8, "line_end": 11} {"id": "layerssss/paste.js:paste.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$.fn.pastableNonInputable = ->\n for el in @\n Paste.mountNonInputable el\n @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 12, "line_end": 15} {"id": "layerssss/paste.js:paste.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$.fn.pastableNonInputable = ->\n for el in @\n Paste.mountNonInputable el\n @\n```", "response": "$.fn.pastableNonInputable = function() {\n var el, i, len, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n Paste.mountNonInputable(el);\n }\n return this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 12, "line_end": 15} {"id": "layerssss/paste.js:paste.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$.fn.pastableNonInputable = function() {\n var el, i, len, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n Paste.mountNonInputable(el);\n }\n return this;\n};\n```", "response": "$.fn.pastableNonInputable = ->\n for el in @\n Paste.mountNonInputable el\n @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 12, "line_end": 15} {"id": "layerssss/paste.js:paste.coffee:2:completion", "type": "completion", "prompt": "$.fn.pastableNonInputable = ->\n for el in @", "response": "Paste.mountNonInputable el\n @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 12, "line_end": 15} {"id": "layerssss/paste.js:paste.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$.fn.pastableTextarea = ->\n for el in @\n Paste.mountTextarea el\n @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 16, "line_end": 19} {"id": "layerssss/paste.js:paste.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$.fn.pastableTextarea = ->\n for el in @\n Paste.mountTextarea el\n @\n```", "response": "$.fn.pastableTextarea = function() {\n var el, i, len, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n Paste.mountTextarea(el);\n }\n return this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 16, "line_end": 19} {"id": "layerssss/paste.js:paste.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$.fn.pastableTextarea = function() {\n var el, i, len, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n Paste.mountTextarea(el);\n }\n return this;\n};\n```", "response": "$.fn.pastableTextarea = ->\n for el in @\n Paste.mountTextarea el\n @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 16, "line_end": 19} {"id": "layerssss/paste.js:paste.coffee:3:completion", "type": "completion", "prompt": "$.fn.pastableTextarea = ->\n for el in @", "response": "Paste.mountTextarea el\n @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 16, "line_end": 19} {"id": "layerssss/paste.js:paste.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$.fn.pastableContenteditable = ->\n for el in @\n Paste.mountContenteditable el\n @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 20, "line_end": 23} {"id": "layerssss/paste.js:paste.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$.fn.pastableContenteditable = ->\n for el in @\n Paste.mountContenteditable el\n @\n```", "response": "$.fn.pastableContenteditable = function() {\n var el, i, len, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n Paste.mountContenteditable(el);\n }\n return this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 20, "line_end": 23} {"id": "layerssss/paste.js:paste.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$.fn.pastableContenteditable = function() {\n var el, i, len, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n Paste.mountContenteditable(el);\n }\n return this;\n};\n```", "response": "$.fn.pastableContenteditable = ->\n for el in @\n Paste.mountContenteditable el\n @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 20, "line_end": 23} {"id": "layerssss/paste.js:paste.coffee:4:completion", "type": "completion", "prompt": "$.fn.pastableContenteditable = ->\n for el in @", "response": "Paste.mountContenteditable el\n @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 20, "line_end": 23} {"id": "layerssss/paste.js:paste.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "dataURLtoBlob = (dataURL, sliceSize=512) ->\n return null unless m = dataURL.match /^data\\:([^\\;]+)\\;base64\\,(.+)$/\n [m, contentType, b64Data] = m\n byteCharacters = atob(b64Data)\n byteArrays = []\n offset = 0\n while offset < byteCharacters.length\n slice = byteCharacters.slice(offset, offset + sliceSize)\n byteNumbers = new Array(slice.length)\n i = 0\n while i < slice.length\n byteNumbers[i] = slice.charCodeAt(i)\n i++\n byteArray = new Uint8Array(byteNumbers)\n byteArrays.push byteArray\n offset += sliceSize\n new Blob byteArrays,\n type: contentType", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 25, "line_end": 42} {"id": "layerssss/paste.js:paste.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndataURLtoBlob = (dataURL, sliceSize=512) ->\n return null unless m = dataURL.match /^data\\:([^\\;]+)\\;base64\\,(.+)$/\n [m, contentType, b64Data] = m\n byteCharacters = atob(b64Data)\n byteArrays = []\n offset = 0\n while offset < byteCharacters.length\n slice = byteCharacters.slice(offset, offset + sliceSize)\n byteNumbers = new Array(slice.length)\n i = 0\n while i < slice.length\n byteNumbers[i] = slice.charCodeAt(i)\n i++\n byteArray = new Uint8Array(byteNumbers)\n byteArrays.push byteArray\n offset += sliceSize\n new Blob byteArrays,\n type: contentType\n```", "response": "var dataURLtoBlob;\n\ndataURLtoBlob = function(dataURL, sliceSize = 512) {\n var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice;\n if (!(m = dataURL.match(/^data\\:([^\\;]+)\\;base64\\,(.+)$/))) {\n return null;\n }\n [m, contentType, b64Data] = m;\n byteCharacters = atob(b64Data);\n byteArrays = [];\n offset = 0;\n while (offset < byteCharacters.length) {\n slice = byteCharacters.slice(offset, offset + sliceSize);\n byteNumbers = new Array(slice.length);\n i = 0;\n while (i < slice.length) {\n byteNumbers[i] = slice.charCodeAt(i);\n i++;\n }\n byteArray = new Uint8Array(byteNumbers);\n byteArrays.push(byteArray);\n offset += sliceSize;\n }\n return new Blob(byteArrays, {\n type: contentType\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 25, "line_end": 42} {"id": "layerssss/paste.js:paste.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar dataURLtoBlob;\n\ndataURLtoBlob = function(dataURL, sliceSize = 512) {\n var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice;\n if (!(m = dataURL.match(/^data\\:([^\\;]+)\\;base64\\,(.+)$/))) {\n return null;\n }\n [m, contentType, b64Data] = m;\n byteCharacters = atob(b64Data);\n byteArrays = [];\n offset = 0;\n while (offset < byteCharacters.length) {\n slice = byteCharacters.slice(offset, offset + sliceSize);\n byteNumbers = new Array(slice.length);\n i = 0;\n while (i < slice.length) {\n byteNumbers[i] = slice.charCodeAt(i);\n i++;\n }\n byteArray = new Uint8Array(byteNumbers);\n byteArrays.push(byteArray);\n offset += sliceSize;\n }\n return new Blob(byteArrays, {\n type: contentType\n });\n};\n```", "response": "dataURLtoBlob = (dataURL, sliceSize=512) ->\n return null unless m = dataURL.match /^data\\:([^\\;]+)\\;base64\\,(.+)$/\n [m, contentType, b64Data] = m\n byteCharacters = atob(b64Data)\n byteArrays = []\n offset = 0\n while offset < byteCharacters.length\n slice = byteCharacters.slice(offset, offset + sliceSize)\n byteNumbers = new Array(slice.length)\n i = 0\n while i < slice.length\n byteNumbers[i] = slice.charCodeAt(i)\n i++\n byteArray = new Uint8Array(byteNumbers)\n byteArrays.push byteArray\n offset += sliceSize\n new Blob byteArrays,\n type: contentType", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 25, "line_end": 42} {"id": "layerssss/paste.js:paste.coffee:5:completion", "type": "completion", "prompt": "dataURLtoBlob = (dataURL, sliceSize=512) ->\n return null unless m = dataURL.match /^data\\:([^\\;]+)\\;base64\\,(.+)$/\n [m, contentType, b64Data] = m\n byteCharacters = atob(b64Data)\n byteArrays = []\n offset = 0\n while offset < byteCharacters.length\n slice = byteCharacters.slice(offset, offset + sliceSize)\n byteNumbers = new Array(slice.length)", "response": "i = 0\n while i < slice.length\n byteNumbers[i] = slice.charCodeAt(i)\n i++\n byteArray = new Uint8Array(byteNumbers)\n byteArrays.push byteArray\n offset += sliceSize\n new Blob byteArrays,\n type: contentType", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 25, "line_end": 42} {"id": "layerssss/paste.js:paste.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createHiddenEditable = ->\n $(document.createElement 'div')\n .attr 'contenteditable', true\n .attr 'aria-hidden', true\n .attr 'tabindex', -1\n .css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 44, "line_end": 54} {"id": "layerssss/paste.js:paste.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreateHiddenEditable = ->\n $(document.createElement 'div')\n .attr 'contenteditable', true\n .attr 'aria-hidden', true\n .attr 'tabindex', -1\n .css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n```", "response": "var createHiddenEditable;\n\ncreateHiddenEditable = function() {\n return $(document.createElement('div')).attr('contenteditable', true).attr('aria-hidden', true).attr('tabindex', -1).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 44, "line_end": 54} {"id": "layerssss/paste.js:paste.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar createHiddenEditable;\n\ncreateHiddenEditable = function() {\n return $(document.createElement('div')).attr('contenteditable', true).attr('aria-hidden', true).attr('tabindex', -1).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n });\n};\n```", "response": "createHiddenEditable = ->\n $(document.createElement 'div')\n .attr 'contenteditable', true\n .attr 'aria-hidden', true\n .attr 'tabindex', -1\n .css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 44, "line_end": 54} {"id": "layerssss/paste.js:paste.coffee:6:completion", "type": "completion", "prompt": "createHiddenEditable = ->\n $(document.createElement 'div')\n .attr 'contenteditable', true\n .attr 'aria-hidden', true\n .attr 'tabindex', -1", "response": ".css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 44, "line_end": 54} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n $(paste._target).on 'pasteText', (ev, data)=>\n curStart = $(textarea).prop('selectionStart')\n curEnd = $(textarea).prop('selectionEnd')\n content = $(textarea).val()\n $(textarea).val \"#{content[0...curStart]}#{data.text}#{content[curEnd...]}\"\n $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length\n $(textarea).trigger 'change'\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n $(paste._target).on 'pasteText', (ev, data)=>\n curStart = $(textarea).prop('selectionStart')\n curEnd = $(textarea).prop('selectionEnd')\n content = $(textarea).val()\n $(textarea).val \"#{content[0...curStart]}#{data.text}#{content[curEnd...]}\"\n $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length\n $(textarea).trigger 'change'\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n```", "response": "var Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var ctlDown, paste;\n if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {\n // Firefox & IE\n return this.mountContenteditable(textarea);\n }\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n ctlDown = false;\n $(textarea).on('keyup', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n return ctlDown = false;\n }\n });\n $(textarea).on('keydown', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n ctlDown = true;\n }\n if ((ev.ctrlKey != null) && (ev.metaKey != null)) {\n ctlDown = ev.ctrlKey || ev.metaKey;\n }\n if (ctlDown && ev.keyCode === 86) {\n return paste._container.focus();\n }\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n $(paste._target).on('_pasteCheckContainerDone', () => {\n return $(textarea).focus();\n });\n return $(paste._target).on('pasteText', (ev, data) => {\n var content, curEnd, curStart;\n curStart = $(textarea).prop('selectionStart');\n curEnd = $(textarea).prop('selectionEnd');\n content = $(textarea).val();\n $(textarea).val(`${content.slice(0, curStart)}${data.text}${content.slice(curEnd)}`);\n $(textarea)[0].setSelectionRange(curStart + data.text.length, curStart + data.text.length);\n return $(textarea).trigger('change');\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {});\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var ctlDown, paste;\n if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {\n // Firefox & IE\n return this.mountContenteditable(textarea);\n }\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n ctlDown = false;\n $(textarea).on('keyup', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n return ctlDown = false;\n }\n });\n $(textarea).on('keydown', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n ctlDown = true;\n }\n if ((ev.ctrlKey != null) && (ev.metaKey != null)) {\n ctlDown = ev.ctrlKey || ev.metaKey;\n }\n if (ctlDown && ev.keyCode === 86) {\n return paste._container.focus();\n }\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n $(paste._target).on('_pasteCheckContainerDone', () => {\n return $(textarea).focus();\n });\n return $(paste._target).on('pasteText', (ev, data) => {\n var content, curEnd, curStart;\n curStart = $(textarea).prop('selectionStart');\n curEnd = $(textarea).prop('selectionEnd');\n content = $(textarea).val();\n $(textarea).val(`${content.slice(0, curStart)}${data.text}${content.slice(curEnd)}`);\n $(textarea)[0].setSelectionRange(curStart + data.text.length, curStart + data.text.length);\n return $(textarea).trigger('change');\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {});\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);\n```", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n $(paste._target).on 'pasteText', (ev, data)=>\n curStart = $(textarea).prop('selectionStart')\n curEnd = $(textarea).prop('selectionEnd')\n content = $(textarea).val()\n $(textarea).val \"#{content[0...curStart]}#{data.text}#{content[curEnd...]}\"\n $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length\n $(textarea).trigger 'change'\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?", "response": "paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n $(paste._target).on 'pasteText', (ev, data)=>\n curStart = $(textarea).prop('selectionStart')\n curEnd = $(textarea).prop('selectionEnd')\n content = $(textarea).val()\n $(textarea).val \"#{content[0...curStart]}#{data.text}#{content[curEnd...]}\"\n $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length\n $(textarea).trigger 'change'\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n setTimeout =>\n @_target.trigger 'pasteText', text: text\n @_target.trigger '_pasteCheckContainerDone'\n , 1\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer (src)->\n null\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:completion", "type": "completion", "prompt": "if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n setTimeout =>\n @_target.trigger 'pasteText', text: text", "response": "@_target.trigger '_pasteCheckContainerDone'\n , 1\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer (src)->\n null\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n @_target.trigger '_pasteCheckContainerDone'\n , 1", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 156, "line_end": 175} {"id": "layerssss/paste.js:paste.coffee:9:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n @_target.trigger '_pasteCheckContainerDone'\n , 1\n```", "response": "this._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n});\n\nloader.onerror = () => {\n return this._target.trigger('pasteImageError', {\n message: `Failed to get image from: ${src}`,\n url: src\n });\n};\n\nloader.src = src;\n\n({\n _checkImagesInContainer: function(cb) {\n var i, img, len, ref, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref = this._container.find('img');\n for (i = 0, len = ref.length; i < len; i++) {\n img = ref[i];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var j, len1, ref1;\n ref1 = this._container.find('img');\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n img = ref1[j];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n $(img).remove();\n }\n return this._target.trigger('_pasteCheckContainerDone');\n }, 1);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 156, "line_end": 175} {"id": "layerssss/paste.js:paste.coffee:9:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n});\n\nloader.onerror = () => {\n return this._target.trigger('pasteImageError', {\n message: `Failed to get image from: ${src}`,\n url: src\n });\n};\n\nloader.src = src;\n\n({\n _checkImagesInContainer: function(cb) {\n var i, img, len, ref, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref = this._container.find('img');\n for (i = 0, len = ref.length; i < len; i++) {\n img = ref[i];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var j, len1, ref1;\n ref1 = this._container.find('img');\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n img = ref1[j];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n $(img).remove();\n }\n return this._target.trigger('_pasteCheckContainerDone');\n }, 1);\n }\n});\n```", "response": "@_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n @_target.trigger '_pasteCheckContainerDone'\n , 1", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 156, "line_end": 175} {"id": "layerssss/paste.js:paste.coffee:9:completion", "type": "completion", "prompt": "@_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src", "response": "_checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n @_target.trigger '_pasteCheckContainerDone'\n , 1", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dee2c6f05191fd3651bbf4dc7010e2e41ad1cdc7/paste.coffee", "line_start": 156, "line_end": 175} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n```", "response": "var Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var ctlDown, paste;\n if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {\n // Firefox & IE\n return this.mountContenteditable(textarea);\n }\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n ctlDown = false;\n $(textarea).on('keyup', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n return ctlDown = false;\n }\n });\n $(textarea).on('keydown', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n ctlDown = true;\n }\n if ((ev.ctrlKey != null) && (ev.metaKey != null)) {\n ctlDown = ev.ctrlKey || ev.metaKey;\n }\n if (ctlDown && ev.keyCode === 86) {\n return paste._container.focus();\n }\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n return $(paste._target).on('_pasteCheckContainerDone', () => {\n return $(textarea).focus();\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {\n var clipboardData, i, item, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) {\n ref1 = clipboardData.items;\n // Chrome\n results = [];\n for (i = 0, len = ref1.length; i < len; i++) {\n item = ref1[i];\n if (item.type.match(/^image\\//)) {\n results.push(reader = new FileReader());\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n }\n });\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var ctlDown, paste;\n if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {\n // Firefox & IE\n return this.mountContenteditable(textarea);\n }\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n ctlDown = false;\n $(textarea).on('keyup', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n return ctlDown = false;\n }\n });\n $(textarea).on('keydown', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n ctlDown = true;\n }\n if ((ev.ctrlKey != null) && (ev.metaKey != null)) {\n ctlDown = ev.ctrlKey || ev.metaKey;\n }\n if (ctlDown && ev.keyCode === 86) {\n return paste._container.focus();\n }\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n return $(paste._target).on('_pasteCheckContainerDone', () => {\n return $(textarea).focus();\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {\n var clipboardData, i, item, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) {\n ref1 = clipboardData.items;\n // Chrome\n results = [];\n for (i = 0, len = ref1.length; i < len; i++) {\n item = ref1[i];\n if (item.type.match(/^image\\//)) {\n results.push(reader = new FileReader());\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n }\n });\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);\n```", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?", "response": "paste._container.focus() if ctlDown && ev.keyCode == 86\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()\n\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n setTimeout =>\n @_target.trigger 'pasteText', text: text\n @_target.trigger '_pasteCheckContainerDone'\n , 1\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer (src)->\n null\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n setTimeout =>\n @_target.trigger 'pasteText', text: text\n @_target.trigger '_pasteCheckContainerDone'\n , 1\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer (src)->\n null\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',\n```", "response": "var clipboardData, file, i, len, ref, ref1, text;\n\nreader.onload = (event) => {\n return this._handleImage(event.target.result);\n};\n\nreader.readAsDataURL(item.getAsFile());\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox & Safari(text-only)\n if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n }\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n setTimeout(() => {\n this._target.trigger('pasteText', {\n text: text\n });\n return this._target.trigger('_pasteCheckContainerDone');\n }, 1);\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n }\n this._checkImagesInContainer(function(src) {});\n }\n}\n\nnull;\n\n({\n _handleImage: function(src) {\n var loader;\n if (src.match(/^webkit\\-fake\\-url\\:\\/\\//)) {\n return this._target.trigger('pasteImageError', {\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n });\n }\n loader = new Image();\n loader.crossOrigin = \"anonymous\";\n loader.onload = () => {\n var blob, canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n blob = dataURLtoBlob(dataURL);\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.onerror = () => {\n return this._target.trigger('pasteImageError');\n };\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar clipboardData, file, i, len, ref, ref1, text;\n\nreader.onload = (event) => {\n return this._handleImage(event.target.result);\n};\n\nreader.readAsDataURL(item.getAsFile());\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox & Safari(text-only)\n if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n }\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n setTimeout(() => {\n this._target.trigger('pasteText', {\n text: text\n });\n return this._target.trigger('_pasteCheckContainerDone');\n }, 1);\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n }\n this._checkImagesInContainer(function(src) {});\n }\n}\n\nnull;\n\n({\n _handleImage: function(src) {\n var loader;\n if (src.match(/^webkit\\-fake\\-url\\:\\/\\//)) {\n return this._target.trigger('pasteImageError', {\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n });\n }\n loader = new Image();\n loader.crossOrigin = \"anonymous\";\n loader.onload = () => {\n var blob, canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n blob = dataURLtoBlob(dataURL);\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.onerror = () => {\n return this._target.trigger('pasteImageError');\n };\n }\n});\n```", "response": "reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n setTimeout =>\n @_target.trigger 'pasteText', text: text\n @_target.trigger '_pasteCheckContainerDone'\n , 1\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer (src)->\n null\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:completion", "type": "completion", "prompt": "reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n setTimeout =>\n @_target.trigger 'pasteText', text: text\n @_target.trigger '_pasteCheckContainerDone'\n , 1\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer (src)->\n null", "response": "_handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n @_target.trigger 'pasteImageError',", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n @_target.trigger '_pasteCheckContainerDone'\n , 1", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 156, "line_end": 168} {"id": "layerssss/paste.js:paste.coffee:9:completion", "type": "completion", "prompt": "message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()", "response": "img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n @_target.trigger '_pasteCheckContainerDone'\n , 1", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d3a6fb5c6fba0e74249cf39f65124730892d3cb4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d3a6fb5c6fba0e74249cf39f65124730892d3cb4/paste.coffee", "line_start": 156, "line_end": 168} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteImageError', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteImageError', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n```", "response": "var Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var ctlDown, paste;\n if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {\n // Firefox & IE\n return this.mountContenteditable(textarea);\n }\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n ctlDown = false;\n $(textarea).on('keyup', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n return ctlDown = false;\n }\n });\n $(textarea).on('keydown', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n ctlDown = true;\n }\n if ((ev.ctrlKey != null) && (ev.metaKey != null)) {\n ctlDown = ev.ctrlKey || ev.metaKey;\n }\n if (ctlDown && ev.keyCode === 86) {\n return paste._container.focus();\n }\n });\n $(paste._target).on('pasteImage', () => {\n return $(textarea).focus();\n });\n $(paste._target).on('pasteImageError', () => {\n return $(textarea).focus();\n });\n $(paste._target).on('pasteText', () => {\n return $(textarea).focus();\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n return $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {\n var clipboardData, ref;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n return clipboardData = ev.originalEvent.clipboardData;\n }\n });\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var ctlDown, paste;\n if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {\n // Firefox & IE\n return this.mountContenteditable(textarea);\n }\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n ctlDown = false;\n $(textarea).on('keyup', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n return ctlDown = false;\n }\n });\n $(textarea).on('keydown', function(ev) {\n var ref;\n if ((ref = ev.keyCode) === 17 || ref === 224) {\n ctlDown = true;\n }\n if ((ev.ctrlKey != null) && (ev.metaKey != null)) {\n ctlDown = ev.ctrlKey || ev.metaKey;\n }\n if (ctlDown && ev.keyCode === 86) {\n return paste._container.focus();\n }\n });\n $(paste._target).on('pasteImage', () => {\n return $(textarea).focus();\n });\n $(paste._target).on('pasteImageError', () => {\n return $(textarea).focus();\n });\n $(paste._target).on('pasteText', () => {\n return $(textarea).focus();\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n return $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {\n var clipboardData, ref;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n return clipboardData = ev.originalEvent.clipboardData;\n }\n });\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);\n```", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteImageError', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?", "response": "paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteImageError', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>\n```", "response": "var clipboardData, file, i, item, j, len, len1, reader, ref, ref1, ref2, text;\n\nif (clipboardData.items) {\n ref = clipboardData.items;\n // Chrome\n for (i = 0, len = ref.length; i < len; i++) {\n item = ref[i];\n if (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return this._handleImage(event.target.result);\n };\n reader.readAsDataURL(item.getAsFile());\n }\n if (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n }\n }\n} else {\n // Firefox & Safari(text-only)\n if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n }\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref1 = (text = clipboardData.getData('Text'))) != null ? ref1.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref2 = clipboardData.files;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n file = ref2[j];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n if (src.match(/^webkit\\-fake\\-url\\:\\/\\//)) {\n return this._target.trigger('pasteImageError', {\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n });\n }\n loader = new Image();\n loader.crossOrigin = \"anonymous\";\n loader.onload = () => {\n var blob, canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n blob = dataURLtoBlob(dataURL);\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.onerror = () => {};\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar clipboardData, file, i, item, j, len, len1, reader, ref, ref1, ref2, text;\n\nif (clipboardData.items) {\n ref = clipboardData.items;\n // Chrome\n for (i = 0, len = ref.length; i < len; i++) {\n item = ref[i];\n if (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return this._handleImage(event.target.result);\n };\n reader.readAsDataURL(item.getAsFile());\n }\n if (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n }\n }\n} else {\n // Firefox & Safari(text-only)\n if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n }\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref1 = (text = clipboardData.getData('Text'))) != null ? ref1.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref2 = clipboardData.files;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n file = ref2[j];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n if (src.match(/^webkit\\-fake\\-url\\:\\/\\//)) {\n return this._target.trigger('pasteImageError', {\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n });\n }\n loader = new Image();\n loader.crossOrigin = \"anonymous\";\n loader.onload = () => {\n var blob, canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n blob = dataURLtoBlob(dataURL);\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.onerror = () => {};\n }\n});\n```", "response": "if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:completion", "type": "completion", "prompt": "if clipboardData.items\n # Chrome\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)", "response": "@_checkImagesInContainer ->\n\n _handleImage: (src)->\n if src.match /^webkit\\-fake\\-url\\:\\/\\//\n return @_target.trigger 'pasteImageError',\n message: \"You are trying to paste an image in Safari, however we are unable to retieve its data.\"\n loader = new Image()\n loader.crossOrigin = \"anonymous\"\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.onerror = =>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 156, "line_end": 168} {"id": "layerssss/paste.js:paste.coffee:9:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1\n```", "response": "this._target.trigger('pasteImageError', {\n message: `Failed to get image from: ${src}`,\n url: src\n});\n\nloader.src = src;\n\n({\n _checkImagesInContainer: function(cb) {\n var i, img, len, ref, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref = this._container.find('img');\n for (i = 0, len = ref.length; i < len; i++) {\n img = ref[i];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var j, len1, ref1, results;\n ref1 = this._container.find('img');\n results = [];\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n img = ref1[j];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n results.push($(img).remove());\n }\n return results;\n }, 1);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 156, "line_end": 168} {"id": "layerssss/paste.js:paste.coffee:9:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis._target.trigger('pasteImageError', {\n message: `Failed to get image from: ${src}`,\n url: src\n});\n\nloader.src = src;\n\n({\n _checkImagesInContainer: function(cb) {\n var i, img, len, ref, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref = this._container.find('img');\n for (i = 0, len = ref.length; i < len; i++) {\n img = ref[i];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var j, len1, ref1, results;\n ref1 = this._container.find('img');\n results = [];\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n img = ref1[j];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n results.push($(img).remove());\n }\n return results;\n }, 1);\n }\n});\n```", "response": "@_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 156, "line_end": 168} {"id": "layerssss/paste.js:paste.coffee:9:completion", "type": "completion", "prompt": "@_target.trigger 'pasteImageError',\n message: \"Failed to get image from: #{src}\"\n url: src\n loader.src = src\n\n _checkImagesInContainer: (cb)->", "response": "timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0a6871fef6a7a09e7bd76d888c22c95d8685041f", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0a6871fef6a7a09e7bd76d888c22c95d8685041f/paste.coffee", "line_start": 156, "line_end": 168} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "96681d755953bd4493430e67ae85cf0290dbebbc", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/96681d755953bd4493430e67ae85cf0290dbebbc/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?", "response": "paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "96681d755953bd4493430e67ae85cf0290dbebbc", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/96681d755953bd4493430e67ae85cf0290dbebbc/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "96681d755953bd4493430e67ae85cf0290dbebbc", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/96681d755953bd4493430e67ae85cf0290dbebbc/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:completion", "type": "completion", "prompt": "for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->", "response": "_handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "96681d755953bd4493430e67ae85cf0290dbebbc", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/96681d755953bd4493430e67ae85cf0290dbebbc/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "b6c60578dc85dc677e61103dab9e56ebb4201ba7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/b6c60578dc85dc677e61103dab9e56ebb4201ba7/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n paste._container.focus() if ctlDown && ev.keyCode == 86", "response": "$(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "b6c60578dc85dc677e61103dab9e56ebb4201ba7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/b6c60578dc85dc677e61103dab9e56ebb4201ba7/paste.coffee", "line_start": 56, "line_end": 105} {"id": "layerssss/paste.js:paste.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "b6c60578dc85dc677e61103dab9e56ebb4201ba7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/b6c60578dc85dc677e61103dab9e56ebb4201ba7/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n```", "response": "var clipboardData, file, i, len, reader, ref, ref1, text;\n\nif (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return this._handleImage(event.target.result);\n };\n reader.readAsDataURL(item.getAsFile());\n}\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox & Safari(text-only)\n if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n }\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n loader = new Image();\n loader.onload = () => {\n var blob, canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n blob = dataURLtoBlob(dataURL);\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n },\n _checkImagesInContainer: function(cb) {\n var img, j, len1, ref2, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref2 = this._container.find('img');\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n img = ref2[j];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var k, len2, ref3, results;\n ref3 = this._container.find('img');\n results = [];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n img = ref3[k];\n if (!img[`_paste_marked_${timespan}`]) {\n results.push(cb(img.src));\n } else {\n results.push(void 0);\n }\n }\n return results;\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "b6c60578dc85dc677e61103dab9e56ebb4201ba7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/b6c60578dc85dc677e61103dab9e56ebb4201ba7/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar clipboardData, file, i, len, reader, ref, ref1, text;\n\nif (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return this._handleImage(event.target.result);\n };\n reader.readAsDataURL(item.getAsFile());\n}\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox & Safari(text-only)\n if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n }\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n loader = new Image();\n loader.onload = () => {\n var blob, canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n blob = dataURLtoBlob(dataURL);\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n blob: blob,\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n },\n _checkImagesInContainer: function(cb) {\n var img, j, len1, ref2, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref2 = this._container.find('img');\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n img = ref2[j];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var k, len2, ref3, results;\n ref3 = this._container.find('img');\n results = [];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n img = ref3[k];\n if (!img[`_paste_marked_${timespan}`]) {\n results.push(cb(img.src));\n } else {\n results.push(void 0);\n }\n }\n return results;\n });\n }\n});\n```", "response": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "b6c60578dc85dc677e61103dab9e56ebb4201ba7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/b6c60578dc85dc677e61103dab9e56ebb4201ba7/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:8:completion", "type": "completion", "prompt": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox & Safari(text-only)\n if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->", "response": "loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "b6c60578dc85dc677e61103dab9e56ebb4201ba7", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/b6c60578dc85dc677e61103dab9e56ebb4201ba7/paste.coffee", "line_start": 106, "line_end": 155} {"id": "layerssss/paste.js:paste.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "createHiddenEditable = ->\n $(document.createElement 'div')\n .attr 'contenteditable', true\n .css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d59ea4203e4cfe360f3f900b10ef688cd5a30337", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d59ea4203e4cfe360f3f900b10ef688cd5a30337/paste.coffee", "line_start": 44, "line_end": 52} {"id": "layerssss/paste.js:paste.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncreateHiddenEditable = ->\n $(document.createElement 'div')\n .attr 'contenteditable', true\n .css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n```", "response": "var createHiddenEditable;\n\ncreateHiddenEditable = function() {\n return $(document.createElement('div')).attr('contenteditable', true).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d59ea4203e4cfe360f3f900b10ef688cd5a30337", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d59ea4203e4cfe360f3f900b10ef688cd5a30337/paste.coffee", "line_start": 44, "line_end": 52} {"id": "layerssss/paste.js:paste.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar createHiddenEditable;\n\ncreateHiddenEditable = function() {\n return $(document.createElement('div')).attr('contenteditable', true).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n });\n};\n```", "response": "createHiddenEditable = ->\n $(document.createElement 'div')\n .attr 'contenteditable', true\n .css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "d59ea4203e4cfe360f3f900b10ef688cd5a30337", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/d59ea4203e4cfe360f3f900b10ef688cd5a30337/paste.coffee", "line_start": 44, "line_end": 52} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "8cc0d3309e26fc491d65f3f5afae9b7258cc906e", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/8cc0d3309e26fc491d65f3f5afae9b7258cc906e/paste.coffee", "line_start": 54, "line_end": 103} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n paste._container.focus() if ctlDown && ev.keyCode == 86", "response": "$(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome\n for item in clipboardData.items", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "8cc0d3309e26fc491d65f3f5afae9b7258cc906e", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/8cc0d3309e26fc491d65f3f5afae9b7258cc906e/paste.coffee", "line_start": 54, "line_end": 103} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n paste._container.focus() if ctlDown && ev.keyCode == 86\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome & Safari(text-only)\n for item in clipboardData.items", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4/paste.coffee", "line_start": 54, "line_end": 103} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n # Firefox & IE\n return @mountContenteditable textarea unless window.ClipboardEvent || window.clipboardData\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n ctlDown = false\n $(textarea).on 'keyup', (ev)->\n ctlDown = false if ev.keyCode in [17, 224]\n $(textarea).on 'keydown', (ev)->\n ctlDown = true if ev.keyCode in [17, 224]\n paste._container.focus() if ctlDown && ev.keyCode == 86", "response": "$(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome & Safari(text-only)\n for item in clipboardData.items", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4/paste.coffee", "line_start": 54, "line_end": 103} {"id": "layerssss/paste.js:paste.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4/paste.coffee", "line_start": 104, "line_end": 153} {"id": "layerssss/paste.js:paste.coffee:8:completion", "type": "completion", "prompt": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->", "response": "_handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n blob = dataURLtoBlob dataURL\n if dataURL\n @_target.trigger 'pasteImage',\n blob: blob\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/e6b1abb7d53d134d21c1365fc6e1f230c8ea1ea4/paste.coffee", "line_start": 104, "line_end": 153} {"id": "layerssss/paste.js:paste.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$.fn.pastableNonInputable = ->\n for el in @\n paste = Paste.mountNonInputable el\n @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 6, "line_end": 9} {"id": "layerssss/paste.js:paste.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$.fn.pastableNonInputable = ->\n for el in @\n paste = Paste.mountNonInputable el\n @\n```", "response": "$.fn.pastableNonInputable = function() {\n var el, i, len, paste, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n paste = Paste.mountNonInputable(el);\n }\n return this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 6, "line_end": 9} {"id": "layerssss/paste.js:paste.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$.fn.pastableNonInputable = function() {\n var el, i, len, paste, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n paste = Paste.mountNonInputable(el);\n }\n return this;\n};\n```", "response": "$.fn.pastableNonInputable = ->\n for el in @\n paste = Paste.mountNonInputable el\n @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 6, "line_end": 9} {"id": "layerssss/paste.js:paste.coffee:2:completion", "type": "completion", "prompt": "$.fn.pastableNonInputable = ->\n for el in @", "response": "paste = Paste.mountNonInputable el\n @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 6, "line_end": 9} {"id": "layerssss/paste.js:paste.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$.fn.pastableTextarea = ->\n for el in @\n paste = Paste.mountTextarea el\n @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 10, "line_end": 13} {"id": "layerssss/paste.js:paste.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$.fn.pastableTextarea = ->\n for el in @\n paste = Paste.mountTextarea el\n @\n```", "response": "$.fn.pastableTextarea = function() {\n var el, i, len, paste, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n paste = Paste.mountTextarea(el);\n }\n return this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 10, "line_end": 13} {"id": "layerssss/paste.js:paste.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$.fn.pastableTextarea = function() {\n var el, i, len, paste, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n paste = Paste.mountTextarea(el);\n }\n return this;\n};\n```", "response": "$.fn.pastableTextarea = ->\n for el in @\n paste = Paste.mountTextarea el\n @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 10, "line_end": 13} {"id": "layerssss/paste.js:paste.coffee:3:completion", "type": "completion", "prompt": "$.fn.pastableTextarea = ->\n for el in @", "response": "paste = Paste.mountTextarea el\n @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 10, "line_end": 13} {"id": "layerssss/paste.js:paste.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$.fn.pastableContenteditable = ->\n for el in @\n paste = Paste.mountContenteditable el\n @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 14, "line_end": 17} {"id": "layerssss/paste.js:paste.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$.fn.pastableContenteditable = ->\n for el in @\n paste = Paste.mountContenteditable el\n @\n```", "response": "$.fn.pastableContenteditable = function() {\n var el, i, len, paste, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n paste = Paste.mountContenteditable(el);\n }\n return this;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 14, "line_end": 17} {"id": "layerssss/paste.js:paste.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$.fn.pastableContenteditable = function() {\n var el, i, len, paste, ref;\n ref = this;\n for (i = 0, len = ref.length; i < len; i++) {\n el = ref[i];\n paste = Paste.mountContenteditable(el);\n }\n return this;\n};\n```", "response": "$.fn.pastableContenteditable = ->\n for el in @\n paste = Paste.mountContenteditable el\n @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 14, "line_end": 17} {"id": "layerssss/paste.js:paste.coffee:4:completion", "type": "completion", "prompt": "$.fn.pastableContenteditable = ->\n for el in @", "response": "paste = Paste.mountContenteditable el\n @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "0150305cfbb52c917f86834237fc466c11702a84", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/0150305cfbb52c917f86834237fc466c11702a84/paste.coffee", "line_start": 14, "line_end": 17} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "02e8e0153f11b7045cc6d33304b52eea9dcced6c", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/02e8e0153f11b7045cc6d33304b52eea9dcced6c/paste.coffee", "line_start": 79, "line_end": 128} {"id": "layerssss/paste.js:paste.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n```", "response": "var clipboardData, file, i, len, reader, ref, ref1, text;\n\nif (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return this._handleImage(event.target.result);\n };\n reader.readAsDataURL(item.getAsFile());\n}\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox\n if (clipboardData.types.length) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n }\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n loader = new Image();\n loader.onload = () => {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n },\n _checkImagesInContainer: function(cb) {\n var img, j, len1, ref2, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref2 = this._container.find('img');\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n img = ref2[j];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var k, len2, ref3, results;\n ref3 = this._container.find('img');\n results = [];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n img = ref3[k];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n results.push($(img).remove());\n }\n return results;\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "02e8e0153f11b7045cc6d33304b52eea9dcced6c", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/02e8e0153f11b7045cc6d33304b52eea9dcced6c/paste.coffee", "line_start": 79, "line_end": 128} {"id": "layerssss/paste.js:paste.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar clipboardData, file, i, len, reader, ref, ref1, text;\n\nif (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return this._handleImage(event.target.result);\n };\n reader.readAsDataURL(item.getAsFile());\n}\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox\n if (clipboardData.types.length) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n }\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n loader = new Image();\n loader.onload = () => {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n },\n _checkImagesInContainer: function(cb) {\n var img, j, len1, ref2, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref2 = this._container.find('img');\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n img = ref2[j];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var k, len2, ref3, results;\n ref3 = this._container.find('img');\n results = [];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n img = ref3[k];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n results.push($(img).remove());\n }\n return results;\n });\n }\n});\n```", "response": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "02e8e0153f11b7045cc6d33304b52eea9dcced6c", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/02e8e0153f11b7045cc6d33304b52eea9dcced6c/paste.coffee", "line_start": 79, "line_end": 128} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->", "response": "_handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "02e8e0153f11b7045cc6d33304b52eea9dcced6c", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/02e8e0153f11b7045cc6d33304b52eea9dcced6c/paste.coffee", "line_start": 79, "line_end": 128} {"id": "layerssss/paste.js:paste.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n return @mountContenteditable textarea unless window.ClipboardEvent\n # Firefox only\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n $(textarea).on 'keypress', (ev)=>\n return unless 'v' == String.fromCharCode ev.charCode\n return unless ev.ctrlKey || ev.metaKey\n paste._container.focus()\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome & Safari(text-only)\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 29, "line_end": 78} {"id": "layerssss/paste.js:paste.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n return @mountContenteditable textarea unless window.ClipboardEvent\n # Firefox only\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n $(textarea).on 'keypress', (ev)=>\n return unless 'v' == String.fromCharCode ev.charCode\n return unless ev.ctrlKey || ev.metaKey\n paste._container.focus()\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome & Safari(text-only)\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n```", "response": "var Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var paste;\n if (!window.ClipboardEvent) {\n return this.mountContenteditable(textarea);\n }\n // Firefox only\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n $(textarea).on('keypress', (ev) => {\n if ('v' !== String.fromCharCode(ev.charCode)) {\n return;\n }\n if (!(ev.ctrlKey || ev.metaKey)) {\n return;\n }\n return paste._container.focus();\n });\n $(paste._target).on('pasteImage', () => {\n return $(textarea).focus();\n });\n $(paste._target).on('pasteText', () => {\n return $(textarea).focus();\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n return $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {\n var clipboardData, i, item, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) {\n ref1 = clipboardData.items;\n // Chrome & Safari(text-only)\n results = [];\n for (i = 0, len = ref1.length; i < len; i++) {\n item = ref1[i];\n if (item.type.match(/^image\\//)) {\n results.push(reader = new FileReader());\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n }\n });\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 29, "line_end": 78} {"id": "layerssss/paste.js:paste.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Paste;\n\nPaste = (function() {\n class Paste {\n static mountNonInputable(nonInputable) {\n var paste;\n paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);\n $(nonInputable).on('click', () => {\n return paste._container.focus();\n });\n paste._container.on('focus', () => {\n return $(nonInputable).addClass('pastable-focus');\n });\n return paste._container.on('blur', () => {\n return $(nonInputable).removeClass('pastable-focus');\n });\n }\n\n static mountTextarea(textarea) {\n var paste;\n if (!window.ClipboardEvent) {\n return this.mountContenteditable(textarea);\n }\n // Firefox only\n paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);\n $(textarea).on('keypress', (ev) => {\n if ('v' !== String.fromCharCode(ev.charCode)) {\n return;\n }\n if (!(ev.ctrlKey || ev.metaKey)) {\n return;\n }\n return paste._container.focus();\n });\n $(paste._target).on('pasteImage', () => {\n return $(textarea).focus();\n });\n $(paste._target).on('pasteText', () => {\n return $(textarea).focus();\n });\n $(textarea).on('focus', () => {\n return $(textarea).addClass('pastable-focus');\n });\n return $(textarea).on('blur', () => {\n return $(textarea).removeClass('pastable-focus');\n });\n }\n\n static mountContenteditable(contenteditable) {\n var paste;\n paste = new Paste(contenteditable, contenteditable);\n $(contenteditable).on('focus', () => {\n return $(contenteditable).addClass('pastable-focus');\n });\n return $(contenteditable).on('blur', () => {\n return $(contenteditable).removeClass('pastable-focus');\n });\n }\n\n constructor(_container, _target) {\n this._container = _container;\n this._target = _target;\n this._container = $(this._container);\n this._target = $(this._target).addClass('pastable');\n this._container.on('paste', (ev) => {\n var clipboardData, i, item, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) {\n ref1 = clipboardData.items;\n // Chrome & Safari(text-only)\n results = [];\n for (i = 0, len = ref1.length; i < len; i++) {\n item = ref1[i];\n if (item.type.match(/^image\\//)) {\n results.push(reader = new FileReader());\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n }\n });\n }\n\n };\n\n // Element to receive final events.\n Paste.prototype._target = null;\n\n // Actual element to do pasting.\n Paste.prototype._container = null;\n\n return Paste;\n\n}).call(this);\n```", "response": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n return @mountContenteditable textarea unless window.ClipboardEvent\n # Firefox only\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n $(textarea).on 'keypress', (ev)=>\n return unless 'v' == String.fromCharCode ev.charCode\n return unless ev.ctrlKey || ev.metaKey\n paste._container.focus()\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()\n $(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome & Safari(text-only)\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 29, "line_end": 78} {"id": "layerssss/paste.js:paste.coffee:6:completion", "type": "completion", "prompt": "class Paste\n # Element to receive final events.\n _target: null\n\n # Actual element to do pasting.\n _container: null\n\n @mountNonInputable: (nonInputable)->\n paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable\n $(nonInputable).on 'click', => paste._container.focus()\n\n paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'\n paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'\n\n\n @mountTextarea: (textarea)->\n return @mountContenteditable textarea unless window.ClipboardEvent\n # Firefox only\n paste = new Paste createHiddenEditable().insertBefore(textarea), textarea\n $(textarea).on 'keypress', (ev)=>\n return unless 'v' == String.fromCharCode ev.charCode\n return unless ev.ctrlKey || ev.metaKey\n paste._container.focus()\n $(paste._target).on 'pasteImage', =>\n $(textarea).focus()", "response": "$(paste._target).on 'pasteText', =>\n $(textarea).focus()\n\n $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'\n $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'\n\n @mountContenteditable: (contenteditable)->\n paste = new Paste contenteditable, contenteditable\n\n $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'\n $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'\n\n\n constructor: (@_container, @_target)->\n @_container = $ @_container\n @_target = $ @_target\n .addClass 'pastable'\n @_container.on 'paste', (ev)=>\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items\n # Chrome & Safari(text-only)\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 29, "line_end": 78} {"id": "layerssss/paste.js:paste.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 79, "line_end": 127} {"id": "layerssss/paste.js:paste.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1\n```", "response": "var clipboardData, file, i, len, ref, ref1, text;\n\nreader.onload = (event) => {\n return this._handleImage(event.target.result);\n};\n\nreader.readAsDataURL(item.getAsFile());\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox\n if (clipboardData.types.length) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n }\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n loader = new Image();\n loader.onload = () => {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n },\n _checkImagesInContainer: function(cb) {\n var img, j, len1, ref2, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref2 = this._container.find('img');\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n img = ref2[j];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var k, len2, ref3, results;\n ref3 = this._container.find('img');\n results = [];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n img = ref3[k];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n results.push($(img).remove());\n }\n return results;\n }, 1);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 79, "line_end": 127} {"id": "layerssss/paste.js:paste.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar clipboardData, file, i, len, ref, ref1, text;\n\nreader.onload = (event) => {\n return this._handleImage(event.target.result);\n};\n\nreader.readAsDataURL(item.getAsFile());\n\nif (item.type === 'text/plain') {\n item.getAsString((string) => {\n return this._target.trigger('pasteText', {\n text: string\n });\n });\n} else {\n // Firefox\n if (clipboardData.types.length) {\n text = clipboardData.getData('Text');\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n this._checkImagesInContainer((src) => {\n return this._handleImage(src);\n });\n }\n}\n\n// IE\nif (clipboardData = window.clipboardData) {\n if ((ref = (text = clipboardData.getData('Text'))) != null ? ref.length : void 0) {\n this._target.trigger('pasteText', {\n text: text\n });\n } else {\n ref1 = clipboardData.files;\n for (i = 0, len = ref1.length; i < len; i++) {\n file = ref1[i];\n this._handleImage(URL.createObjectURL(file));\n this._checkImagesInContainer(function() {});\n }\n }\n}\n\n({\n _handleImage: function(src) {\n var loader;\n loader = new Image();\n loader.onload = () => {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {}\n if (dataURL) {\n return this._target.trigger('pasteImage', {\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n },\n _checkImagesInContainer: function(cb) {\n var img, j, len1, ref2, timespan;\n timespan = Math.floor(1000 * Math.random());\n ref2 = this._container.find('img');\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n img = ref2[j];\n img[`_paste_marked_${timespan}`] = true;\n }\n return setTimeout(() => {\n var k, len2, ref3, results;\n ref3 = this._container.find('img');\n results = [];\n for (k = 0, len2 = ref3.length; k < len2; k++) {\n img = ref3[k];\n if (!img[`_paste_marked_${timespan}`]) {\n cb(img.src);\n }\n results.push($(img).remove());\n }\n return results;\n }, 1);\n }\n});\n```", "response": "reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->\n loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 79, "line_end": 127} {"id": "layerssss/paste.js:paste.coffee:7:completion", "type": "completion", "prompt": "reader.onload = (event)=>\n @_handleImage event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)=>\n @_target.trigger 'pasteText', text: string\n else\n # Firefox\n if clipboardData.types.length\n text = clipboardData.getData 'Text'\n @_target.trigger 'pasteText', text: text\n else\n @_checkImagesInContainer (src)=>\n @_handleImage src\n # IE\n if clipboardData = window.clipboardData\n if (text = clipboardData.getData 'Text')?.length\n @_target.trigger 'pasteText', text: text\n else\n for file in clipboardData.files\n @_handleImage URL.createObjectURL(file)\n @_checkImagesInContainer ->\n\n _handleImage: (src)->", "response": "loader = new Image()\n loader.onload = =>\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n if dataURL\n @_target.trigger 'pasteImage',\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n _checkImagesInContainer: (cb)->\n timespan = Math.floor 1000 * Math.random()\n img[\"_paste_marked_#{timespan}\"] = true for img in @_container.find('img')\n setTimeout =>\n for img in @_container.find('img')\n cb img.src unless img[\"_paste_marked_#{timespan}\"]\n $(img).remove()\n , 1", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "808a84c17d6add2c82f00a53d47976fe2a655762", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/808a84c17d6add2c82f00a53d47976fe2a655762/paste.coffee", "line_start": 79, "line_end": 127} {"id": "layerssss/paste.js:paste.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dddeb39a9fb733522c0a83b0f373d9b3c5839940", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dddeb39a9fb733522c0a83b0f373d9b3c5839940/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string\n else\n```", "response": "var $, getImageData, readImagesFromEditable;\n\n$ = jQuery;\n\nreadImagesFromEditable = function(element, cb) {\n return setTimeout((function() {\n return $(element).find('img').each(function(i, img) {\n return getImageData(img.src, cb);\n });\n }), 1);\n};\n\ngetImageData = function(src, cb) {\n var loader;\n loader = new Image();\n loader.onload = function() {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {\n\n }\n if (dataURL) {\n return cb({\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n};\n\n$.paste = function() {\n var div;\n div = document.createElement('div');\n div.contentEditable = true;\n return $(div).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n // backgroundColor: '#ccc'\n }).on('paste', function(ev) {\n var clipboardData, item, j, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) { //webkit\n ref1 = clipboardData.items;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n item = ref1[j];\n if (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return getImageData(event.target.result, function(data) {\n return $(div).trigger('pasteImage', data);\n });\n };\n reader.readAsDataURL(item.getAsFile());\n }\n if (item.type === 'text/plain') {\n results.push(item.getAsString(function(string) {\n return $(div).trigger('pasteText', {\n text: string\n });\n }));\n } else {\n results.push(void 0);\n }\n }\n return results;\n } else {\n\n }\n }\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dddeb39a9fb733522c0a83b0f373d9b3c5839940", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dddeb39a9fb733522c0a83b0f373d9b3c5839940/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $, getImageData, readImagesFromEditable;\n\n$ = jQuery;\n\nreadImagesFromEditable = function(element, cb) {\n return setTimeout((function() {\n return $(element).find('img').each(function(i, img) {\n return getImageData(img.src, cb);\n });\n }), 1);\n};\n\ngetImageData = function(src, cb) {\n var loader;\n loader = new Image();\n loader.onload = function() {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {\n\n }\n if (dataURL) {\n return cb({\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n};\n\n$.paste = function() {\n var div;\n div = document.createElement('div');\n div.contentEditable = true;\n return $(div).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n // backgroundColor: '#ccc'\n }).on('paste', function(ev) {\n var clipboardData, item, j, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) { //webkit\n ref1 = clipboardData.items;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n item = ref1[j];\n if (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return getImageData(event.target.result, function(data) {\n return $(div).trigger('pasteImage', data);\n });\n };\n reader.readAsDataURL(item.getAsFile());\n }\n if (item.type === 'text/plain') {\n results.push(item.getAsString(function(string) {\n return $(div).trigger('pasteText', {\n text: string\n });\n }));\n } else {\n results.push(void 0);\n }\n }\n return results;\n } else {\n\n }\n }\n });\n};\n```", "response": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string\n else", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dddeb39a9fb733522c0a83b0f373d9b3c5839940", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dddeb39a9fb733522c0a83b0f373d9b3c5839940/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:1:completion", "type": "completion", "prompt": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src", "response": "$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dddeb39a9fb733522c0a83b0f373d9b3c5839940", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dddeb39a9fb733522c0a83b0f373d9b3c5839940/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if clipboardData.types.length\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n if clipboardData = window.clipboardData # ie\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n\n setTimeout (->\n $(div).html('')\n ), 2\n return $ div", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dddeb39a9fb733522c0a83b0f373d9b3c5839940", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dddeb39a9fb733522c0a83b0f373d9b3c5839940/paste.coffee", "line_start": 51, "line_end": 67} {"id": "layerssss/paste.js:paste.coffee:2:completion", "type": "completion", "prompt": "if clipboardData.types.length\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n if clipboardData = window.clipboardData # ie\n if (text = clipboardData.getData 'Text')?.length", "response": "$(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n\n setTimeout (->\n $(div).html('')\n ), 2\n return $ div", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "dddeb39a9fb733522c0a83b0f373d9b3c5839940", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/dddeb39a9fb733522c0a83b0f373d9b3c5839940/paste.coffee", "line_start": 51, "line_end": 67} {"id": "layerssss/paste.js:paste.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n console.log $(element).find('img').length\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "bd7e7f79e48e5f869ed796d781bf584a7d88f20d", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/bd7e7f79e48e5f869ed796d781bf584a7d88f20d/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n console.log $(element).find('img').length\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string\n```", "response": "var $, getImageData, readImagesFromEditable;\n\n$ = jQuery;\n\nreadImagesFromEditable = function(element, cb) {\n return setTimeout((function() {\n console.log($(element).find('img').length);\n return $(element).find('img').each(function(i, img) {\n return getImageData(img.src, cb);\n });\n }), 1);\n};\n\ngetImageData = function(src, cb) {\n var loader;\n loader = new Image();\n loader.onload = function() {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {\n\n }\n if (dataURL) {\n return cb({\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n};\n\n$.paste = function() {\n var div;\n div = document.createElement('div');\n div.contentEditable = true;\n return $(div).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n // backgroundColor: '#ccc'\n }).on('paste', function(ev) {\n var clipboardData, item, j, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) { //webkit\n ref1 = clipboardData.items;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n item = ref1[j];\n if (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return getImageData(event.target.result, function(data) {\n return $(div).trigger('pasteImage', data);\n });\n };\n reader.readAsDataURL(item.getAsFile());\n }\n if (item.type === 'text/plain') {\n results.push(item.getAsString(function(string) {\n return $(div).trigger('pasteText', {\n text: string\n });\n }));\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n }\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "bd7e7f79e48e5f869ed796d781bf584a7d88f20d", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/bd7e7f79e48e5f869ed796d781bf584a7d88f20d/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar $, getImageData, readImagesFromEditable;\n\n$ = jQuery;\n\nreadImagesFromEditable = function(element, cb) {\n return setTimeout((function() {\n console.log($(element).find('img').length);\n return $(element).find('img').each(function(i, img) {\n return getImageData(img.src, cb);\n });\n }), 1);\n};\n\ngetImageData = function(src, cb) {\n var loader;\n loader = new Image();\n loader.onload = function() {\n var canvas, ctx, dataURL;\n canvas = document.createElement('canvas');\n canvas.width = loader.width;\n canvas.height = loader.height;\n ctx = canvas.getContext('2d');\n ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);\n dataURL = null;\n try {\n dataURL = canvas.toDataURL('image/png');\n } catch (error) {\n\n }\n if (dataURL) {\n return cb({\n dataURL: dataURL,\n width: loader.width,\n height: loader.height\n });\n }\n };\n return loader.src = src;\n};\n\n$.paste = function() {\n var div;\n div = document.createElement('div');\n div.contentEditable = true;\n return $(div).css({\n width: 1,\n height: 1,\n position: 'fixed',\n left: -100,\n overflow: 'hidden'\n // backgroundColor: '#ccc'\n }).on('paste', function(ev) {\n var clipboardData, item, j, len, reader, ref, ref1, results;\n if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {\n clipboardData = ev.originalEvent.clipboardData;\n if (clipboardData.items) { //webkit\n ref1 = clipboardData.items;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n item = ref1[j];\n if (item.type.match(/^image\\//)) {\n reader = new FileReader();\n reader.onload = (event) => {\n return getImageData(event.target.result, function(data) {\n return $(div).trigger('pasteImage', data);\n });\n };\n reader.readAsDataURL(item.getAsFile());\n }\n if (item.type === 'text/plain') {\n results.push(item.getAsString(function(string) {\n return $(div).trigger('pasteText', {\n text: string\n });\n }));\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n }\n });\n};\n```", "response": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n console.log $(element).find('img').length\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src\n\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "bd7e7f79e48e5f869ed796d781bf584a7d88f20d", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/bd7e7f79e48e5f869ed796d781bf584a7d88f20d/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:1:completion", "type": "completion", "prompt": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n console.log $(element).find('img').length\n $(element).find('img').each (i, img)->\n getImageData img.src, cb\n ), 1\ngetImageData = (src, cb)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n if dataURL\n cb\n dataURL: dataURL\n width: loader.width\n height: loader.height\n loader.src = src", "response": "$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = (event)=>\n getImageData event.target.result, (data)->\n $(div).trigger 'pasteImage', data\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "bd7e7f79e48e5f869ed796d781bf584a7d88f20d", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/bd7e7f79e48e5f869ed796d781bf584a7d88f20d/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n if clipboardData.types.length\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n if clipboardData = window.clipboardData # ie\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n\n setTimeout (->\n $(div).html('')\n ), 2\n return $ div", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "bd7e7f79e48e5f869ed796d781bf584a7d88f20d", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/bd7e7f79e48e5f869ed796d781bf584a7d88f20d/paste.coffee", "line_start": 51, "line_end": 68} {"id": "layerssss/paste.js:paste.coffee:2:completion", "type": "completion", "prompt": "else\n if clipboardData.types.length\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n if clipboardData = window.clipboardData # ie\n if (text = clipboardData.getData 'Text')?.length", "response": "$(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (data)->\n $(div).trigger 'pasteImage', data\n\n setTimeout (->\n $(div).html('')\n ), 2\n return $ div", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "bd7e7f79e48e5f869ed796d781bf584a7d88f20d", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/bd7e7f79e48e5f869ed796d781bf584a7d88f20d/paste.coffee", "line_start": 51, "line_end": 68} {"id": "layerssss/paste.js:paste.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n console.log $(element).find('img').length\n $(element).find('img').each (i, img)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n cb dataURL if dataURL\n loader.src = img.src\n ), 1\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1\n position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = =>\n $(div).trigger 'pasteImage', dataURL: event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string\n else\n if clipboardData.types.length\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (dataURL)->\n $(div).trigger 'pasteImage', dataURL: dataURL\n if clipboardData = window.clipboardData # ie", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "64b0e0418b4460889d92071742ecca12788bf2d3", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/64b0e0418b4460889d92071742ecca12788bf2d3/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:1:completion", "type": "completion", "prompt": "$ = jQuery\nreadImagesFromEditable = (element, cb)->\n setTimeout (->\n console.log $(element).find('img').length\n $(element).find('img').each (i, img)->\n loader = new Image()\n loader.onload = ->\n canvas = document.createElement 'canvas'\n canvas.width = loader.width\n canvas.height = loader.height\n ctx = canvas.getContext '2d'\n ctx.drawImage loader, 0, 0, canvas.width, canvas.height\n dataURL = null\n try\n dataURL = canvas.toDataURL 'image/png'\n catch\n cb dataURL if dataURL\n loader.src = img.src\n ), 1\n$.paste = ->\n div = document.createElement 'div'\n div.contentEditable = true\n $(div).css\n width: 1\n height: 1", "response": "position: 'fixed'\n left: -100\n overflow: 'hidden'\n # backgroundColor: '#ccc'\n .on 'paste', (ev)->\n if ev.originalEvent?.clipboardData?\n clipboardData = ev.originalEvent.clipboardData\n if clipboardData.items #webkit\n for item in clipboardData.items\n if item.type.match /^image\\//\n reader = new FileReader()\n reader.onload = =>\n $(div).trigger 'pasteImage', dataURL: event.target.result\n reader.readAsDataURL item.getAsFile()\n if item.type == 'text/plain'\n item.getAsString (string)->\n $(div).trigger 'pasteText', text: string\n else\n if clipboardData.types.length\n if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (dataURL)->\n $(div).trigger 'pasteImage', dataURL: dataURL\n if clipboardData = window.clipboardData # ie", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "64b0e0418b4460889d92071742ecca12788bf2d3", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/64b0e0418b4460889d92071742ecca12788bf2d3/paste.coffee", "line_start": 1, "line_end": 50} {"id": "layerssss/paste.js:paste.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (dataURL)->\n $(div).trigger 'pasteImage', dataURL: dataURL\n\n setTimeout (->\n $(div).html('')\n ), 2\n return $ div", "source_lang": "", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "64b0e0418b4460889d92071742ecca12788bf2d3", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/64b0e0418b4460889d92071742ecca12788bf2d3/paste.coffee", "line_start": 51, "line_end": 60} {"id": "layerssss/paste.js:paste.coffee:2:completion", "type": "completion", "prompt": "if (text = clipboardData.getData 'Text')?.length\n $(div).trigger 'pasteText', text: text\n else\n readImagesFromEditable div, (dataURL)->\n $(div).trigger 'pasteImage', dataURL: dataURL", "response": "setTimeout (->\n $(div).html('')\n ), 2\n return $ div", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "layerssss/paste.js", "path": "paste.coffee", "license": "MIT", "commit": "64b0e0418b4460889d92071742ecca12788bf2d3", "stars": 461, "source_url": "https://github.com/layerssss/paste.js/blob/64b0e0418b4460889d92071742ecca12788bf2d3/paste.coffee", "line_start": 51, "line_end": 60} {"id": "jianliaoim/talk-os:talk-api2x/server/config/request.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "req.validators =\n _general: (val, key) ->\n if key.match /^_.*id$/i # _ObjectId type\n return if \"#{val}\".match /[0-9a-f]{24}/ then true else false\n if key.match /Date$/i # Date type\n val = Number(val) if val.match /^\\d{13}$/\n date = new Date(val)\n return if date.getDate() then true else false\n if key.match /url$/i\n return if validator.isURL(val) then true else false\n return true\n limit: (limit) ->\n limit = parseInt(limit)\n return true if 0 < limit < 100\n return false\n email: (email) ->\n email = email.trim()\n return false unless validator.isEmail(email)\n return true\n mobile: (mobile) ->\n /^\\+?[0-9]{1}[0-9]{3,14}$/.test mobile\n emails: (emails) ->\n return false unless toString.call(emails) is '[object Array]'\n return emails.every (email) -> validator.isEmail(email)\n role: (role) ->\n return role in ['owner', 'admin', 'member']\n shortName: (shortName) ->\n return true if shortName.match /^[a-z_-]+$/i\n false\n timezone: (timezone) -> if moment().tz(timezone)._z then true else false\n\n# Custom setter for specific key", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/request.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/request.coffee", "line_start": 57, "line_end": 88} {"id": "jianliaoim/talk-os:talk-api2x/server/config/request.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreq.validators =\n _general: (val, key) ->\n if key.match /^_.*id$/i # _ObjectId type\n return if \"#{val}\".match /[0-9a-f]{24}/ then true else false\n if key.match /Date$/i # Date type\n val = Number(val) if val.match /^\\d{13}$/\n date = new Date(val)\n return if date.getDate() then true else false\n if key.match /url$/i\n return if validator.isURL(val) then true else false\n return true\n limit: (limit) ->\n limit = parseInt(limit)\n return true if 0 < limit < 100\n return false\n email: (email) ->\n email = email.trim()\n return false unless validator.isEmail(email)\n return true\n mobile: (mobile) ->\n /^\\+?[0-9]{1}[0-9]{3,14}$/.test mobile\n emails: (emails) ->\n return false unless toString.call(emails) is '[object Array]'\n return emails.every (email) -> validator.isEmail(email)\n role: (role) ->\n return role in ['owner', 'admin', 'member']\n shortName: (shortName) ->\n return true if shortName.match /^[a-z_-]+$/i\n false\n timezone: (timezone) -> if moment().tz(timezone)._z then true else false\n\n# Custom setter for specific key\n```", "response": "req.validators = {\n _general: function(val, key) {\n var date;\n if (key.match(/^_.*id$/i)) { // _ObjectId type\n if (`${val}`.match(/[0-9a-f]{24}/)) {\n return true;\n } else {\n return false;\n }\n }\n if (key.match(/Date$/i)) { // Date type\n if (val.match(/^\\d{13}$/)) {\n val = Number(val);\n }\n date = new Date(val);\n if (date.getDate()) {\n return true;\n } else {\n return false;\n }\n }\n if (key.match(/url$/i)) {\n if (validator.isURL(val)) {\n return true;\n } else {\n return false;\n }\n }\n return true;\n },\n limit: function(limit) {\n limit = parseInt(limit);\n if ((0 < limit && limit < 100)) {\n return true;\n }\n return false;\n },\n email: function(email) {\n email = email.trim();\n if (!validator.isEmail(email)) {\n return false;\n }\n return true;\n },\n mobile: function(mobile) {\n return /^\\+?[0-9]{1}[0-9]{3,14}$/.test(mobile);\n },\n emails: function(emails) {\n if (toString.call(emails) !== '[object Array]') {\n return false;\n }\n return emails.every(function(email) {\n return validator.isEmail(email);\n });\n },\n role: function(role) {\n return role === 'owner' || role === 'admin' || role === 'member';\n },\n shortName: function(shortName) {\n if (shortName.match(/^[a-z_-]+$/i)) {\n return true;\n }\n return false;\n },\n timezone: function(timezone) {\n if (moment().tz(timezone)._z) {\n return true;\n } else {\n return false;\n }\n }\n};\n\n// Custom setter for specific key", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/request.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/request.coffee", "line_start": 57, "line_end": 88} {"id": "jianliaoim/talk-os:talk-api2x/server/config/request.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nreq.validators = {\n _general: function(val, key) {\n var date;\n if (key.match(/^_.*id$/i)) { // _ObjectId type\n if (`${val}`.match(/[0-9a-f]{24}/)) {\n return true;\n } else {\n return false;\n }\n }\n if (key.match(/Date$/i)) { // Date type\n if (val.match(/^\\d{13}$/)) {\n val = Number(val);\n }\n date = new Date(val);\n if (date.getDate()) {\n return true;\n } else {\n return false;\n }\n }\n if (key.match(/url$/i)) {\n if (validator.isURL(val)) {\n return true;\n } else {\n return false;\n }\n }\n return true;\n },\n limit: function(limit) {\n limit = parseInt(limit);\n if ((0 < limit && limit < 100)) {\n return true;\n }\n return false;\n },\n email: function(email) {\n email = email.trim();\n if (!validator.isEmail(email)) {\n return false;\n }\n return true;\n },\n mobile: function(mobile) {\n return /^\\+?[0-9]{1}[0-9]{3,14}$/.test(mobile);\n },\n emails: function(emails) {\n if (toString.call(emails) !== '[object Array]') {\n return false;\n }\n return emails.every(function(email) {\n return validator.isEmail(email);\n });\n },\n role: function(role) {\n return role === 'owner' || role === 'admin' || role === 'member';\n },\n shortName: function(shortName) {\n if (shortName.match(/^[a-z_-]+$/i)) {\n return true;\n }\n return false;\n },\n timezone: function(timezone) {\n if (moment().tz(timezone)._z) {\n return true;\n } else {\n return false;\n }\n }\n};\n\n// Custom setter for specific key\n```", "response": "req.validators =\n _general: (val, key) ->\n if key.match /^_.*id$/i # _ObjectId type\n return if \"#{val}\".match /[0-9a-f]{24}/ then true else false\n if key.match /Date$/i # Date type\n val = Number(val) if val.match /^\\d{13}$/\n date = new Date(val)\n return if date.getDate() then true else false\n if key.match /url$/i\n return if validator.isURL(val) then true else false\n return true\n limit: (limit) ->\n limit = parseInt(limit)\n return true if 0 < limit < 100\n return false\n email: (email) ->\n email = email.trim()\n return false unless validator.isEmail(email)\n return true\n mobile: (mobile) ->\n /^\\+?[0-9]{1}[0-9]{3,14}$/.test mobile\n emails: (emails) ->\n return false unless toString.call(emails) is '[object Array]'\n return emails.every (email) -> validator.isEmail(email)\n role: (role) ->\n return role in ['owner', 'admin', 'member']\n shortName: (shortName) ->\n return true if shortName.match /^[a-z_-]+$/i\n false\n timezone: (timezone) -> if moment().tz(timezone)._z then true else false\n\n# Custom setter for specific key", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/request.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/request.coffee", "line_start": 57, "line_end": 88} {"id": "jianliaoim/talk-os:talk-api2x/server/config/request.coffee:1:completion", "type": "completion", "prompt": "req.validators =\n _general: (val, key) ->\n if key.match /^_.*id$/i # _ObjectId type\n return if \"#{val}\".match /[0-9a-f]{24}/ then true else false\n if key.match /Date$/i # Date type\n val = Number(val) if val.match /^\\d{13}$/\n date = new Date(val)\n return if date.getDate() then true else false\n if key.match /url$/i\n return if validator.isURL(val) then true else false\n return true\n limit: (limit) ->\n limit = parseInt(limit)\n return true if 0 < limit < 100\n return false\n email: (email) ->", "response": "email = email.trim()\n return false unless validator.isEmail(email)\n return true\n mobile: (mobile) ->\n /^\\+?[0-9]{1}[0-9]{3,14}$/.test mobile\n emails: (emails) ->\n return false unless toString.call(emails) is '[object Array]'\n return emails.every (email) -> validator.isEmail(email)\n role: (role) ->\n return role in ['owner', 'admin', 'member']\n shortName: (shortName) ->\n return true if shortName.match /^[a-z_-]+$/i\n false\n timezone: (timezone) -> if moment().tz(timezone)._z then true else false\n\n# Custom setter for specific key", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/request.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/request.coffee", "line_start": 57, "line_end": 88} {"id": "jianliaoim/talk-os:talk-api2x/server/config/request.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "req.setters =\n _tagIds: (_tagIds) -> _.uniq _tagIds\n limit: (limit) -> Number(limit)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/request.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/request.coffee", "line_start": 89, "line_end": 91} {"id": "jianliaoim/talk-os:talk-api2x/server/config/request.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreq.setters =\n _tagIds: (_tagIds) -> _.uniq _tagIds\n limit: (limit) -> Number(limit)\n```", "response": "req.setters = {\n _tagIds: function(_tagIds) {\n return _.uniq(_tagIds);\n },\n limit: function(limit) {\n return Number(limit);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/request.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/request.coffee", "line_start": 89, "line_end": 91} {"id": "jianliaoim/talk-os:talk-api2x/server/config/request.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nreq.setters = {\n _tagIds: function(_tagIds) {\n return _.uniq(_tagIds);\n },\n limit: function(limit) {\n return Number(limit);\n }\n};\n```", "response": "req.setters =\n _tagIds: (_tagIds) -> _.uniq _tagIds\n limit: (limit) -> Number(limit)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/config/request.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/config/request.coffee", "line_start": 89, "line_end": 91} {"id": "cdglabs/apparatus:src/Evaluator/spread.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\n\n\nmodule.exports = spread = (start, end, increment=1) ->\n if _.isArray(start)\n return new Dataflow.Spread(start)\n\n if increment == 0\n throw \"Spread increment cannot be 0\"\n if !_.isFinite(increment)\n throw \"Spread increment must be finite\"\n\n n = (end - start) / increment\n array = (start + increment * i for i in [0 ... n])\n return new Dataflow.Spread(array)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Evaluator/spread.coffee", "license": "MIT", "commit": "e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a/src/Evaluator/spread.coffee", "line_start": 1, "line_end": 16} {"id": "cdglabs/apparatus:src/Evaluator/spread.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\n\n\nmodule.exports = spread = (start, end, increment=1) ->\n if _.isArray(start)\n return new Dataflow.Spread(start)\n\n if increment == 0\n throw \"Spread increment cannot be 0\"\n if !_.isFinite(increment)\n throw \"Spread increment must be finite\"\n\n n = (end - start) / increment\n array = (start + increment * i for i in [0 ... n])\n return new Dataflow.Spread(array)\n```", "response": "var Dataflow, _, spread;\n\n_ = require(\"underscore\");\n\nDataflow = require(\"../Dataflow/Dataflow\");\n\nmodule.exports = spread = function(start, end, increment = 1) {\n var array, i, n;\n if (_.isArray(start)) {\n return new Dataflow.Spread(start);\n }\n if (increment === 0) {\n throw \"Spread increment cannot be 0\";\n }\n if (!_.isFinite(increment)) {\n throw \"Spread increment must be finite\";\n }\n n = (end - start) / increment;\n array = (function() {\n var j, ref, results;\n results = [];\n for (i = j = 0, ref = n; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {\n results.push(start + increment * i);\n }\n return results;\n })();\n return new Dataflow.Spread(array);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "cdglabs/apparatus", "path": "src/Evaluator/spread.coffee", "license": "MIT", "commit": "e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a/src/Evaluator/spread.coffee", "line_start": 1, "line_end": 16} {"id": "cdglabs/apparatus:src/Evaluator/spread.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Dataflow, _, spread;\n\n_ = require(\"underscore\");\n\nDataflow = require(\"../Dataflow/Dataflow\");\n\nmodule.exports = spread = function(start, end, increment = 1) {\n var array, i, n;\n if (_.isArray(start)) {\n return new Dataflow.Spread(start);\n }\n if (increment === 0) {\n throw \"Spread increment cannot be 0\";\n }\n if (!_.isFinite(increment)) {\n throw \"Spread increment must be finite\";\n }\n n = (end - start) / increment;\n array = (function() {\n var j, ref, results;\n results = [];\n for (i = j = 0, ref = n; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {\n results.push(start + increment * i);\n }\n return results;\n })();\n return new Dataflow.Spread(array);\n};\n```", "response": "_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\n\n\nmodule.exports = spread = (start, end, increment=1) ->\n if _.isArray(start)\n return new Dataflow.Spread(start)\n\n if increment == 0\n throw \"Spread increment cannot be 0\"\n if !_.isFinite(increment)\n throw \"Spread increment must be finite\"\n\n n = (end - start) / increment\n array = (start + increment * i for i in [0 ... n])\n return new Dataflow.Spread(array)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Evaluator/spread.coffee", "license": "MIT", "commit": "e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a/src/Evaluator/spread.coffee", "line_start": 1, "line_end": 16} {"id": "cdglabs/apparatus:src/Evaluator/spread.coffee:1:completion", "type": "completion", "prompt": "_ = require \"underscore\"\nDataflow = require \"../Dataflow/Dataflow\"\n\n\nmodule.exports = spread = (start, end, increment=1) ->\n if _.isArray(start)\n return new Dataflow.Spread(start)", "response": "if increment == 0\n throw \"Spread increment cannot be 0\"\n if !_.isFinite(increment)\n throw \"Spread increment must be finite\"\n\n n = (end - start) / increment\n array = (start + increment * i for i in [0 ... n])\n return new Dataflow.Spread(array)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "cdglabs/apparatus", "path": "src/Evaluator/spread.coffee", "license": "MIT", "commit": "e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a", "stars": 1052, "source_url": "https://github.com/cdglabs/apparatus/blob/e12a991c0d8bd3ae6bcd06c057d52d2b2438b82a/src/Evaluator/spread.coffee", "line_start": 1, "line_end": 16} {"id": "lmaccherone/node-localstorage:test/SameDirectoryTwiceTest.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{LocalStorage} = require('../')\n\nexports.SameDirectoryTwiceTest =\n\n theTest: (test) ->\n localStorage1 = new LocalStorage('./scratch10')\n localStorage2 = new LocalStorage('./scratch10')\n\n localStorage1.setItem(\"key1\", \"value1\")\n\n test.equal(localStorage1.getItem('key1'), localStorage2.getItem('key1'))\n\n localStorage1._deleteLocation()\n test.done()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "lmaccherone/node-localstorage", "path": "test/SameDirectoryTwiceTest.coffee", "license": "MIT", "commit": "b45249ecdc97374f1f20f0d260c2a4f7c6e701f5", "stars": 460, "source_url": "https://github.com/lmaccherone/node-localstorage/blob/b45249ecdc97374f1f20f0d260c2a4f7c6e701f5/test/SameDirectoryTwiceTest.coffee", "line_start": 1, "line_end": 14} {"id": "lmaccherone/node-localstorage:test/SameDirectoryTwiceTest.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{LocalStorage} = require('../')\n\nexports.SameDirectoryTwiceTest =\n\n theTest: (test) ->\n localStorage1 = new LocalStorage('./scratch10')\n localStorage2 = new LocalStorage('./scratch10')\n\n localStorage1.setItem(\"key1\", \"value1\")\n\n test.equal(localStorage1.getItem('key1'), localStorage2.getItem('key1'))\n\n localStorage1._deleteLocation()\n test.done()\n```", "response": "var LocalStorage;\n\n({LocalStorage} = require('../'));\n\nexports.SameDirectoryTwiceTest = {\n theTest: function(test) {\n var localStorage1, localStorage2;\n localStorage1 = new LocalStorage('./scratch10');\n localStorage2 = new LocalStorage('./scratch10');\n localStorage1.setItem(\"key1\", \"value1\");\n test.equal(localStorage1.getItem('key1'), localStorage2.getItem('key1'));\n localStorage1._deleteLocation();\n return test.done();\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "lmaccherone/node-localstorage", "path": "test/SameDirectoryTwiceTest.coffee", "license": "MIT", "commit": "b45249ecdc97374f1f20f0d260c2a4f7c6e701f5", "stars": 460, "source_url": "https://github.com/lmaccherone/node-localstorage/blob/b45249ecdc97374f1f20f0d260c2a4f7c6e701f5/test/SameDirectoryTwiceTest.coffee", "line_start": 1, "line_end": 14} {"id": "lmaccherone/node-localstorage:test/SameDirectoryTwiceTest.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar LocalStorage;\n\n({LocalStorage} = require('../'));\n\nexports.SameDirectoryTwiceTest = {\n theTest: function(test) {\n var localStorage1, localStorage2;\n localStorage1 = new LocalStorage('./scratch10');\n localStorage2 = new LocalStorage('./scratch10');\n localStorage1.setItem(\"key1\", \"value1\");\n test.equal(localStorage1.getItem('key1'), localStorage2.getItem('key1'));\n localStorage1._deleteLocation();\n return test.done();\n }\n};\n```", "response": "{LocalStorage} = require('../')\n\nexports.SameDirectoryTwiceTest =\n\n theTest: (test) ->\n localStorage1 = new LocalStorage('./scratch10')\n localStorage2 = new LocalStorage('./scratch10')\n\n localStorage1.setItem(\"key1\", \"value1\")\n\n test.equal(localStorage1.getItem('key1'), localStorage2.getItem('key1'))\n\n localStorage1._deleteLocation()\n test.done()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "lmaccherone/node-localstorage", "path": "test/SameDirectoryTwiceTest.coffee", "license": "MIT", "commit": "b45249ecdc97374f1f20f0d260c2a4f7c6e701f5", "stars": 460, "source_url": "https://github.com/lmaccherone/node-localstorage/blob/b45249ecdc97374f1f20f0d260c2a4f7c6e701f5/test/SameDirectoryTwiceTest.coffee", "line_start": 1, "line_end": 14} {"id": "lmaccherone/node-localstorage:test/SameDirectoryTwiceTest.coffee:1:completion", "type": "completion", "prompt": "{LocalStorage} = require('../')\n\nexports.SameDirectoryTwiceTest =\n\n theTest: (test) ->\n localStorage1 = new LocalStorage('./scratch10')\n localStorage2 = new LocalStorage('./scratch10')", "response": "localStorage1.setItem(\"key1\", \"value1\")\n\n test.equal(localStorage1.getItem('key1'), localStorage2.getItem('key1'))\n\n localStorage1._deleteLocation()\n test.done()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "lmaccherone/node-localstorage", "path": "test/SameDirectoryTwiceTest.coffee", "license": "MIT", "commit": "b45249ecdc97374f1f20f0d260c2a4f7c6e701f5", "stars": 460, "source_url": "https://github.com/lmaccherone/node-localstorage/blob/b45249ecdc97374f1f20f0d260c2a4f7c6e701f5/test/SameDirectoryTwiceTest.coffee", "line_start": 1, "line_end": 14} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n cancel = end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "7296aa6bc321370c1b92de005c9b55b9e1365596", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n cancel = end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n```", "response": "/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(base) {\n var GAP, ROTATION_LIMIT, _last, _num_rotations, _start, _target, cancel, end, move, start;\n GAP = 5;\n ROTATION_LIMIT = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > ROTATION_LIMIT) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n return cancel = end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n })(Quo.Gestures)\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "7296aa6bc321370c1b92de005c9b55b9e1365596", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(base) {\n var GAP, ROTATION_LIMIT, _last, _num_rotations, _start, _target, cancel, end, move, start;\n GAP = 5;\n ROTATION_LIMIT = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > ROTATION_LIMIT) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n return cancel = end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n })(Quo.Gestures)\n});\n```", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n cancel = end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "7296aa6bc321370c1b92de005c9b55b9e1365596", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:completion", "type": "completion", "prompt": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null", "response": "start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n cancel = end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "7296aa6bc321370c1b92de005c9b55b9e1365596", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->\n theta = Math.atan2(A.y-B.y, A.x-B.x)\n (if theta < 0 then theta + 2 * Math.PI else theta) * 180 / Math.PI\n\n _check = (moving) ->\n if moving\n base.trigger _target, \"rotating\", _last\n else if Math.abs(_last.delta) > GAP\n base.trigger _target, \"rotate\", _last\n ev = if _last.delta > 0 then \"rotateRight\" else \"rotateLeft\"\n base.trigger _target, ev, _last\n\n start: start\n move: move\n end: end", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "7296aa6bc321370c1b92de005c9b55b9e1365596", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/source/quo.gestures.rotation.coffee", "line_start": 51, "line_end": 67} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:2:completion", "type": "completion", "prompt": "_sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->\n theta = Math.atan2(A.y-B.y, A.x-B.x)\n (if theta < 0 then theta + 2 * Math.PI else theta) * 180 / Math.PI\n\n _check = (moving) ->\n if moving", "response": "base.trigger _target, \"rotating\", _last\n else if Math.abs(_last.delta) > GAP\n base.trigger _target, \"rotate\", _last\n ev = if _last.delta > 0 then \"rotateRight\" else \"rotateLeft\"\n base.trigger _target, ev, _last\n\n start: start\n move: move\n end: end", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "7296aa6bc321370c1b92de005c9b55b9e1365596", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7296aa6bc321370c1b92de005c9b55b9e1365596/source/quo.gestures.rotation.coffee", "line_start": 51, "line_end": 67} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ef4a79667bc693ccc1f8e75dcb902652dc0dca28", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ef4a79667bc693ccc1f8e75dcb902652dc0dca28/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n```", "response": "/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(base) {\n var GAP, ROTATION_LIMIT, _last, _num_rotations, _start, _target, end, move, start;\n GAP = 5;\n ROTATION_LIMIT = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > ROTATION_LIMIT) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n return end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n })(Quo.Gestures)\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ef4a79667bc693ccc1f8e75dcb902652dc0dca28", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ef4a79667bc693ccc1f8e75dcb902652dc0dca28/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(base) {\n var GAP, ROTATION_LIMIT, _last, _num_rotations, _start, _target, end, move, start;\n GAP = 5;\n ROTATION_LIMIT = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > ROTATION_LIMIT) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n return end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n })(Quo.Gestures)\n});\n```", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ef4a79667bc693ccc1f8e75dcb902652dc0dca28", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ef4a79667bc693ccc1f8e75dcb902652dc0dca28/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:completion", "type": "completion", "prompt": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Javier Jimenez Villar || @soyjavi\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null", "response": "start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ef4a79667bc693ccc1f8e75dcb902652dc0dca28", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ef4a79667bc693ccc1f8e75dcb902652dc0dca28/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "1ae37dec9559e15872daa8be159849e329456005", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/1ae37dec9559e15872daa8be159849e329456005/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n```", "response": "/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(base) {\n var GAP, ROTATION_LIMIT, _last, _num_rotations, _start, _target, end, move, start;\n GAP = 5;\n ROTATION_LIMIT = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > ROTATION_LIMIT) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n return end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n })(Quo.Gestures)\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "1ae37dec9559e15872daa8be159849e329456005", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/1ae37dec9559e15872daa8be159849e329456005/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(base) {\n var GAP, ROTATION_LIMIT, _last, _num_rotations, _start, _target, end, move, start;\n GAP = 5;\n ROTATION_LIMIT = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > ROTATION_LIMIT) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n return end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n })(Quo.Gestures)\n});\n```", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "1ae37dec9559e15872daa8be159849e329456005", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/1ae37dec9559e15872daa8be159849e329456005/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:completion", "type": "completion", "prompt": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@namespace Quo.Gestures\n@class Rotation\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n\n handler : do (base = Quo.Gestures) ->\n GAP = 5\n ROTATION_LIMIT = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null", "response": "start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > ROTATION_LIMIT\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "1ae37dec9559e15872daa8be159849e329456005", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/1ae37dec9559e15872daa8be159849e329456005/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->\n theta = Math.atan2(A.y-B.y, A.x-B.x)\n (if theta < 0 then theta + 2 * Math.PI else theta) * 180 / Math.PI\n\n _check = (moving) ->\n if moving then base.trigger _target, \"rotating\", _last\n else if Math.abs(_last.delta) > GAP\n base.trigger _target, \"rotate\", _last\n ev = if _last.delta > 0 then \"rotateRight\" else \"rotateLeft\"\n base.trigger _target, ev, _last\n\n start: start\n move: move\n end: end", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "1ae37dec9559e15872daa8be159849e329456005", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/1ae37dec9559e15872daa8be159849e329456005/source/quo.gestures.rotation.coffee", "line_start": 51, "line_end": 66} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:2:completion", "type": "completion", "prompt": "_sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->\n theta = Math.atan2(A.y-B.y, A.x-B.x)\n (if theta < 0 then theta + 2 * Math.PI else theta) * 180 / Math.PI\n\n _check = (moving) ->\n if moving then base.trigger _target, \"rotating\", _last", "response": "else if Math.abs(_last.delta) > GAP\n base.trigger _target, \"rotate\", _last\n ev = if _last.delta > 0 then \"rotateRight\" else \"rotateLeft\"\n base.trigger _target, ev, _last\n\n start: start\n move: move\n end: end", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "1ae37dec9559e15872daa8be159849e329456005", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/1ae37dec9559e15872daa8be159849e329456005/source/quo.gestures.rotation.coffee", "line_start": 51, "line_end": 66} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.Gestures) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "3e94097849c8265b1e1f85eded77562ec42e7672", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3e94097849c8265b1e1f85eded77562ec42e7672/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.Gestures) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->\n```", "response": "/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: \"rotate,rotating,rotateLeft,rotateRight\".split(\",\"),\n handler: (function(gm) {\n var IMPOSIBLE_ROTATION_FACTOR, TRIGGER_ANGLE, _last, _num_rotations, _rotation, _sign, _start, _target, end, move, start;\n TRIGGER_ANGLE = 5;\n IMPOSIBLE_ROTATION_FACTOR = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n _sign = function(num) {\n if (num < 0) {\n return -1;\n } else {\n return 1;\n }\n };\n return _rotation = function(A, B) {};\n })(Quo.Gestures)\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "3e94097849c8265b1e1f85eded77562ec42e7672", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3e94097849c8265b1e1f85eded77562ec42e7672/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.Gestures.add({\n name: \"rotation\",\n events: \"rotate,rotating,rotateLeft,rotateRight\".split(\",\"),\n handler: (function(gm) {\n var IMPOSIBLE_ROTATION_FACTOR, TRIGGER_ANGLE, _last, _num_rotations, _rotation, _sign, _start, _target, end, move, start;\n TRIGGER_ANGLE = 5;\n IMPOSIBLE_ROTATION_FACTOR = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n _sign = function(num) {\n if (num < 0) {\n return -1;\n } else {\n return 1;\n }\n };\n return _rotation = function(A, B) {};\n })(Quo.Gestures)\n});\n```", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.Gestures) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "3e94097849c8265b1e1f85eded77562ec42e7672", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3e94097849c8265b1e1f85eded77562ec42e7672/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:completion", "type": "completion", "prompt": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.Gestures.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.Gestures) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0", "response": "_start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "3e94097849c8265b1e1f85eded77562ec42e7672", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3e94097849c8265b1e1f85eded77562ec42e7672/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "theta = Math.atan2(A.y-B.y, A.x-B.x)\n (if theta < 0 then theta + 2 * Math.PI else theta) * 180 / Math.PI\n\n _check = (is_moving) ->\n if is_moving then gm.trigger _target, \"rotating\", _last\n else if Math.abs(_last.delta) > TRIGGER_ANGLE\n gm.trigger _target, \"rotate\", _last\n ev = if _last.delta > 0 then \"rotateRight\" else \"rotateLeft\"\n gm.trigger _target, ev, _last\n\n start: start\n move: move\n end: end", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "3e94097849c8265b1e1f85eded77562ec42e7672", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3e94097849c8265b1e1f85eded77562ec42e7672/source/quo.gestures.rotation.coffee", "line_start": 51, "line_end": 63} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:2:completion", "type": "completion", "prompt": "theta = Math.atan2(A.y-B.y, A.x-B.x)\n (if theta < 0 then theta + 2 * Math.PI else theta) * 180 / Math.PI\n\n _check = (is_moving) ->\n if is_moving then gm.trigger _target, \"rotating\", _last\n else if Math.abs(_last.delta) > TRIGGER_ANGLE", "response": "gm.trigger _target, \"rotate\", _last\n ev = if _last.delta > 0 then \"rotateRight\" else \"rotateLeft\"\n gm.trigger _target, ev, _last\n\n start: start\n move: move\n end: end", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "3e94097849c8265b1e1f85eded77562ec42e7672", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3e94097849c8265b1e1f85eded77562ec42e7672/source/quo.gestures.rotation.coffee", "line_start": 51, "line_end": 63} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ff24a23aa557eabf4db8c0adbe9712f8a960293d", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ff24a23aa557eabf4db8c0adbe9712f8a960293d/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->\n```", "response": "/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.gesture.add({\n name: \"rotation\",\n events: \"rotate,rotating,rotateLeft,rotateRight\".split(\",\"),\n handler: (function(gm) {\n var IMPOSIBLE_ROTATION_FACTOR, TRIGGER_ANGLE, _last, _num_rotations, _rotation, _sign, _start, _target, end, move, start;\n TRIGGER_ANGLE = 5;\n IMPOSIBLE_ROTATION_FACTOR = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n _sign = function(num) {\n if (num < 0) {\n return -1;\n } else {\n return 1;\n }\n };\n return _rotation = function(A, B) {};\n })(Quo.gesture)\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ff24a23aa557eabf4db8c0adbe9712f8a960293d", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ff24a23aa557eabf4db8c0adbe9712f8a960293d/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.gesture.add({\n name: \"rotation\",\n events: \"rotate,rotating,rotateLeft,rotateRight\".split(\",\"),\n handler: (function(gm) {\n var IMPOSIBLE_ROTATION_FACTOR, TRIGGER_ANGLE, _last, _num_rotations, _rotation, _sign, _start, _target, end, move, start;\n TRIGGER_ANGLE = 5;\n IMPOSIBLE_ROTATION_FACTOR = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n _sign = function(num) {\n if (num < 0) {\n return -1;\n } else {\n return 1;\n }\n };\n return _rotation = function(A, B) {};\n })(Quo.gesture)\n});\n```", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ff24a23aa557eabf4db8c0adbe9712f8a960293d", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ff24a23aa557eabf4db8c0adbe9712f8a960293d/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:completion", "type": "completion", "prompt": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : \"rotate,rotating,rotateLeft,rotateRight\".split(\",\")\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0", "response": "_start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "ff24a23aa557eabf4db8c0adbe9712f8a960293d", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/ff24a23aa557eabf4db8c0adbe9712f8a960293d/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "c5b858856bd2fb3f2b9d54d724df6127ae364049", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/c5b858856bd2fb3f2b9d54d724df6127ae364049/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->\n```", "response": "/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.gesture.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(gm) {\n var IMPOSIBLE_ROTATION_FACTOR, TRIGGER_ANGLE, _last, _num_rotations, _rotation, _sign, _start, _target, end, move, start;\n TRIGGER_ANGLE = 5;\n IMPOSIBLE_ROTATION_FACTOR = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n _sign = function(num) {\n if (num < 0) {\n return -1;\n } else {\n return 1;\n }\n };\n return _rotation = function(A, B) {};\n })(Quo.gesture)\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "c5b858856bd2fb3f2b9d54d724df6127ae364049", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/c5b858856bd2fb3f2b9d54d724df6127ae364049/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n*/\n\"use strict\";\nQuo.gesture.add({\n name: \"rotation\",\n events: [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"],\n handler: (function(gm) {\n var IMPOSIBLE_ROTATION_FACTOR, TRIGGER_ANGLE, _last, _num_rotations, _rotation, _sign, _start, _target, end, move, start;\n TRIGGER_ANGLE = 5;\n IMPOSIBLE_ROTATION_FACTOR = 20;\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n start = function(target, data) {\n if (data.length === 2) {\n _target = target;\n _num_rotations = 0;\n return _start = _rotation(data[0], data[1]);\n }\n };\n move = function(target, data) {\n var delta;\n if (_start && data.length === 2) {\n delta = _rotation(data[0], data[1]) - _start;\n if (_last && Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR) {\n delta += 360 * _sign(_last.delta);\n }\n if (Math.abs(delta) > 360) {\n _num_rotations++;\n delta -= 360 * _sign(_last.delta);\n }\n _last = {\n touches: data,\n delta: delta,\n rotationsCount: _num_rotations\n };\n return _check(true);\n }\n };\n end = function(target, data) {\n if (_start && _last) {\n _check(false);\n _target = null;\n _num_rotations = 0;\n _start = null;\n _last = null;\n return _start = null;\n }\n };\n _sign = function(num) {\n if (num < 0) {\n return -1;\n } else {\n return 1;\n }\n };\n return _rotation = function(A, B) {};\n })(Quo.gesture)\n});\n```", "response": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0\n _start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "c5b858856bd2fb3f2b9d54d724df6127ae364049", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/c5b858856bd2fb3f2b9d54d724df6127ae364049/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "soyjavi/QuoJS:source/quo.gestures.rotation.coffee:1:completion", "type": "completion", "prompt": "###\nQuo Rotation Gestures: rotate, rotating, rotateLeft, rotateRight\n\n@author Ignacio Olalde Ramos || @piniphone\n###\n\"use strict\"\n\n\nQuo.gesture.add\n name : \"rotation\"\n events : [\"rotate\", \"rotating\", \"rotateLeft\", \"rotateRight\"]\n handler : do (gm = Quo.gesture) ->\n\n TRIGGER_ANGLE = 5\n IMPOSIBLE_ROTATION_FACTOR = 20\n\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n\n start = (target, data) ->\n if data.length is 2\n _target = target\n _num_rotations = 0", "response": "_start = _rotation(data[0], data[1])\n\n move = (target, data) ->\n if _start and data.length is 2\n delta = _rotation(data[0], data[1]) - _start\n if _last and Math.abs(_last.delta - delta) > IMPOSIBLE_ROTATION_FACTOR\n delta += (360 * _sign(_last.delta))\n if Math.abs(delta) > 360\n _num_rotations++\n delta -= (360 * _sign(_last.delta))\n _last = {touches: data, delta: delta, rotationsCount: _num_rotations}\n _check(true)\n\n end = (target, data) ->\n if _start and _last\n _check(false)\n _target = null\n _num_rotations = 0\n _start = null\n _last = null\n _start = null\n\n _sign = (num) -> if num < 0 then -1 else 1\n\n _rotation = (A, B) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "source/quo.gestures.rotation.coffee", "license": "MIT", "commit": "c5b858856bd2fb3f2b9d54d724df6127ae364049", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/c5b858856bd2fb3f2b9d54d724df6127ae364049/source/quo.gestures.rotation.coffee", "line_start": 1, "line_end": 50} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.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 'tableauWidget', ->\n {\n restrict: 'CA'\n\n link: ($scope, element, $attrs) ->\n $element = $(element)\n $scope.actualHeight = $element.height()\n $scope.actualWidth = $element.width()\n #$viz = $element.find('.tableauViz')\n #$viz.attr('height', actualHeight)\n #$viz.attr('width', actualWidth)\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "line_start": 1, "line_end": 28} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.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 'tableauWidget', ->\n {\n restrict: 'CA'\n\n link: ($scope, element, $attrs) ->\n $element = $(element)\n $scope.actualHeight = $element.height()\n $scope.actualWidth = $element.width()\n #$viz = $element.find('.tableauViz')\n #$viz.attr('height', actualHeight)\n #$viz.attr('width', actualWidth)\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('tableauWidget', function() {\n return {\n restrict: 'CA',\n link: function($scope, element, $attrs) {\n var $element;\n $element = $(element);\n $scope.actualHeight = $element.height();\n return $scope.actualWidth = $element.width();\n }\n };\n});\n\n//$viz = $element.find('.tableauViz')\n//$viz.attr('height', actualHeight)\n//$viz.attr('width', actualWidth)", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "line_start": 1, "line_end": 28} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.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('tableauWidget', function() {\n return {\n restrict: 'CA',\n link: function($scope, element, $attrs) {\n var $element;\n $element = $(element);\n $scope.actualHeight = $element.height();\n return $scope.actualWidth = $element.width();\n }\n };\n});\n\n//$viz = $element.find('.tableauViz')\n//$viz.attr('height', actualHeight)\n//$viz.attr('width', actualWidth)\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 'tableauWidget', ->\n {\n restrict: 'CA'\n\n link: ($scope, element, $attrs) ->\n $element = $(element)\n $scope.actualHeight = $element.height()\n $scope.actualWidth = $element.width()\n #$viz = $element.find('.tableauViz')\n #$viz.attr('height', actualHeight)\n #$viz.attr('width', actualWidth)\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "line_start": 1, "line_end": 28} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.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.", "response": "###\n\ncyclotronDirectives.directive 'tableauWidget', ->\n {\n restrict: 'CA'\n\n link: ($scope, element, $attrs) ->\n $element = $(element)\n $scope.actualHeight = $element.height()\n $scope.actualWidth = $element.width()\n #$viz = $element.find('.tableauViz')\n #$viz.attr('height', actualHeight)\n #$viz.attr('width', actualWidth)\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/tableau/directives.tableauPlaceholder.coffee", "line_start": 1, "line_end": 28} {"id": "Pagedraw/pagedraw:library-index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# polyfill in case we're on old node js, which naturally doesn't have exotic\n# built in string methods like .endsWith()\nrequire('string.prototype.endswith')\n\n# initialize the compiler\nrequire('./src/load_compiler')\n\n_l = require 'lodash'\nReact = require 'react'\n\n{Doc} = require './src/doc'\ncore = require './src/core'\n{foreachPdom} = require './src/pdom'\nDynamic = require './src/dynamic'\nevalPdom = require './src/eval-pdom'\n{pdomToReact} = require './src/editor/pdom-to-react'\nutil = require './src/util'\n\nexports.get_components = (pd_json_obj) ->\n # parse and deserialize the doc\n doc = Doc.deserialize(pd_json_obj)\n doc.enterReadonlyMode()\n\n getCompiledComponentByUniqueKey = util.memoized_on _l.identity, (uniqueKey) ->\n componentBlockTree = doc.getBlockTreeByUniqueKey(uniqueKey)\n return undefined if not componentBlockTree?\n pdom = core.compileComponent(componentBlockTree, {\n templateLang: 'JSX'\n for_editor: false\n for_component_instance_editor: false\n getCompiledComponentByUniqueKey: getCompiledComponentByUniqueKey\n })\n\n core.foreachPdom pdom, (pd) ->\n pd.boxSizing = 'border-box'\n if pd.event_handlers?\n pd[event + \"Attr\"] = new Dynamic(code, undefined) for {event, code} in pd.event_handlers\n delete pd.event_handlers\n\n return pdom\n\n # compile the doc\n return _l.mapValues _l.keyBy(doc.getComponents(), 'name'), (component) ->\n return (props) ->\n\n pdom = evalPdom(\n {tag: component, props},\n getCompiledComponentByUniqueKey,\n 'JSX',\n window.innerWidth", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "library-index.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/library-index.coffee", "line_start": 1, "line_end": 50} {"id": "Pagedraw/pagedraw:library-index.coffee:1:completion", "type": "completion", "prompt": "# polyfill in case we're on old node js, which naturally doesn't have exotic\n# built in string methods like .endsWith()\nrequire('string.prototype.endswith')\n\n# initialize the compiler\nrequire('./src/load_compiler')\n\n_l = require 'lodash'\nReact = require 'react'\n\n{Doc} = require './src/doc'\ncore = require './src/core'\n{foreachPdom} = require './src/pdom'\nDynamic = require './src/dynamic'\nevalPdom = require './src/eval-pdom'\n{pdomToReact} = require './src/editor/pdom-to-react'\nutil = require './src/util'\n\nexports.get_components = (pd_json_obj) ->\n # parse and deserialize the doc\n doc = Doc.deserialize(pd_json_obj)\n doc.enterReadonlyMode()\n\n getCompiledComponentByUniqueKey = util.memoized_on _l.identity, (uniqueKey) ->\n componentBlockTree = doc.getBlockTreeByUniqueKey(uniqueKey)", "response": "return undefined if not componentBlockTree?\n pdom = core.compileComponent(componentBlockTree, {\n templateLang: 'JSX'\n for_editor: false\n for_component_instance_editor: false\n getCompiledComponentByUniqueKey: getCompiledComponentByUniqueKey\n })\n\n core.foreachPdom pdom, (pd) ->\n pd.boxSizing = 'border-box'\n if pd.event_handlers?\n pd[event + \"Attr\"] = new Dynamic(code, undefined) for {event, code} in pd.event_handlers\n delete pd.event_handlers\n\n return pdom\n\n # compile the doc\n return _l.mapValues _l.keyBy(doc.getComponents(), 'name'), (component) ->\n return (props) ->\n\n pdom = evalPdom(\n {tag: component, props},\n getCompiledComponentByUniqueKey,\n 'JSX',\n window.innerWidth", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "library-index.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/library-index.coffee", "line_start": 1, "line_end": 50} {"id": "Glavin001/atom-beautify:src/beautifiers/ruby-beautify.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires https://github.com/erniebrodeur/ruby-beautify\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class RubyBeautify extends Beautifier\n name: \"Ruby Beautify\"\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n isPreInstalled: false\n\n options: {\n Ruby:\n indent_size: true\n indent_char: true\n }\n\n beautify: (text, language, options) ->\n @run(\"rbeautify\", [\n if options.indent_char is '\\t' then \"--tabs\" else \"--spaces\"\n \"--indent_count\", options.indent_size\n @tempFile(\"input\", text)\n ], help: {\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n })", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/ruby-beautify.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/ruby-beautify.coffee", "line_start": 1, "line_end": 26} {"id": "Glavin001/atom-beautify:src/beautifiers/ruby-beautify.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires https://github.com/erniebrodeur/ruby-beautify\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class RubyBeautify extends Beautifier\n name: \"Ruby Beautify\"\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n isPreInstalled: false\n\n options: {\n Ruby:\n indent_size: true\n indent_char: true\n }\n\n beautify: (text, language, options) ->\n @run(\"rbeautify\", [\n if options.indent_char is '\\t' then \"--tabs\" else \"--spaces\"\n \"--indent_count\", options.indent_size\n @tempFile(\"input\", text)\n ], help: {\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n })\n```", "response": "/*\nRequires https://github.com/erniebrodeur/ruby-beautify\n*/\n\"use strict\";\nvar Beautifier, RubyBeautify;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = RubyBeautify = (function() {\n class RubyBeautify extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"rbeautify\", [options.indent_char === '\\t' ? \"--tabs\" : \"--spaces\", \"--indent_count\", options.indent_size, this.tempFile(\"input\", text)], {\n help: {\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n }\n });\n }\n\n };\n\n RubyBeautify.prototype.name = \"Ruby Beautify\";\n\n RubyBeautify.prototype.link = \"https://github.com/erniebrodeur/ruby-beautify\";\n\n RubyBeautify.prototype.isPreInstalled = false;\n\n RubyBeautify.prototype.options = {\n Ruby: {\n indent_size: true,\n indent_char: true\n }\n };\n\n return RubyBeautify;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/ruby-beautify.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/ruby-beautify.coffee", "line_start": 1, "line_end": 26} {"id": "Glavin001/atom-beautify:src/beautifiers/ruby-beautify.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires https://github.com/erniebrodeur/ruby-beautify\n*/\n\"use strict\";\nvar Beautifier, RubyBeautify;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = RubyBeautify = (function() {\n class RubyBeautify extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"rbeautify\", [options.indent_char === '\\t' ? \"--tabs\" : \"--spaces\", \"--indent_count\", options.indent_size, this.tempFile(\"input\", text)], {\n help: {\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n }\n });\n }\n\n };\n\n RubyBeautify.prototype.name = \"Ruby Beautify\";\n\n RubyBeautify.prototype.link = \"https://github.com/erniebrodeur/ruby-beautify\";\n\n RubyBeautify.prototype.isPreInstalled = false;\n\n RubyBeautify.prototype.options = {\n Ruby: {\n indent_size: true,\n indent_char: true\n }\n };\n\n return RubyBeautify;\n\n}).call(this);\n```", "response": "###\nRequires https://github.com/erniebrodeur/ruby-beautify\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class RubyBeautify extends Beautifier\n name: \"Ruby Beautify\"\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n isPreInstalled: false\n\n options: {\n Ruby:\n indent_size: true\n indent_char: true\n }\n\n beautify: (text, language, options) ->\n @run(\"rbeautify\", [\n if options.indent_char is '\\t' then \"--tabs\" else \"--spaces\"\n \"--indent_count\", options.indent_size\n @tempFile(\"input\", text)\n ], help: {\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n })", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/ruby-beautify.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/ruby-beautify.coffee", "line_start": 1, "line_end": 26} {"id": "Glavin001/atom-beautify:src/beautifiers/ruby-beautify.coffee:1:completion", "type": "completion", "prompt": "###\nRequires https://github.com/erniebrodeur/ruby-beautify\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class RubyBeautify extends Beautifier\n name: \"Ruby Beautify\"\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n isPreInstalled: false\n\n options: {", "response": "Ruby:\n indent_size: true\n indent_char: true\n }\n\n beautify: (text, language, options) ->\n @run(\"rbeautify\", [\n if options.indent_char is '\\t' then \"--tabs\" else \"--spaces\"\n \"--indent_count\", options.indent_size\n @tempFile(\"input\", text)\n ], help: {\n link: \"https://github.com/erniebrodeur/ruby-beautify\"\n })", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/ruby-beautify.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/ruby-beautify.coffee", "line_start": 1, "line_end": 26} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "initContentWindowGlobals = (contentWindow) ->\n if not contentWindow.pd__loaded_libs?\n contentWindow.pd__loaded_libs = new Set()\n contentWindow.pd__loading_libs = new Map()\n contentWindow.pd__dataForId = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 15, "line_end": 19} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ninitContentWindowGlobals = (contentWindow) ->\n if not contentWindow.pd__loaded_libs?\n contentWindow.pd__loaded_libs = new Set()\n contentWindow.pd__loading_libs = new Map()\n contentWindow.pd__dataForId = {}\n```", "response": "var initContentWindowGlobals;\n\ninitContentWindowGlobals = function(contentWindow) {\n if (contentWindow.pd__loaded_libs == null) {\n contentWindow.pd__loaded_libs = new Set();\n contentWindow.pd__loading_libs = new Map();\n return contentWindow.pd__dataForId = {};\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 15, "line_end": 19} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar initContentWindowGlobals;\n\ninitContentWindowGlobals = function(contentWindow) {\n if (contentWindow.pd__loaded_libs == null) {\n contentWindow.pd__loaded_libs = new Set();\n contentWindow.pd__loading_libs = new Map();\n return contentWindow.pd__dataForId = {};\n }\n};\n```", "response": "initContentWindowGlobals = (contentWindow) ->\n if not contentWindow.pd__loaded_libs?\n contentWindow.pd__loaded_libs = new Set()\n contentWindow.pd__loading_libs = new Map()\n contentWindow.pd__dataForId = {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 15, "line_end": 19} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:1:completion", "type": "completion", "prompt": "initContentWindowGlobals = (contentWindow) ->\n if not contentWindow.pd__loaded_libs?", "response": "contentWindow.pd__loaded_libs = new Set()\n contentWindow.pd__loading_libs = new Map()\n contentWindow.pd__dataForId = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 15, "line_end": 19} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.loadDevLibrary = (contentWindow) ->\n initContentWindowGlobals(contentWindow)\n loadLibrary(contentWindow, '__internal_dev_lib_id', \"#{devcodeserver}/bundle.js\")", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 21, "line_end": 23} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.loadDevLibrary = (contentWindow) ->\n initContentWindowGlobals(contentWindow)\n loadLibrary(contentWindow, '__internal_dev_lib_id', \"#{devcodeserver}/bundle.js\")\n```", "response": "exports.loadDevLibrary = function(contentWindow) {\n initContentWindowGlobals(contentWindow);\n return loadLibrary(contentWindow, '__internal_dev_lib_id', `${devcodeserver}/bundle.js`);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 21, "line_end": 23} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.loadDevLibrary = function(contentWindow) {\n initContentWindowGlobals(contentWindow);\n return loadLibrary(contentWindow, '__internal_dev_lib_id', `${devcodeserver}/bundle.js`);\n};\n```", "response": "exports.loadDevLibrary = (contentWindow) ->\n initContentWindowGlobals(contentWindow)\n loadLibrary(contentWindow, '__internal_dev_lib_id', \"#{devcodeserver}/bundle.js\")", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 21, "line_end": 23} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.loadProdLibrary = (contentWindow, id) ->\n initContentWindowGlobals(contentWindow)\n loadLibrary(contentWindow, id, \"#{extcodeserver}/#{id}\")\n\n\n# NOTE: I'm doing window. here to guarantee our bundling process won't change the name of this function,\n# since router.cjsx error handling searches for this function name to know if there was an error in user code\nwindow?.__evalBundleWrapperForErrorDetector = (contentWindow, bundle) ->\n wrapBundle = (bundle) -> \"\"\"\n {\"use strict\";\n #{bundle}\n ;\\nreturn PagedrawSpecs;\\n}\n \"\"\"\n return (contentWindow.Function(wrapBundle(bundle)))()\n\n# loadLibrary :: (contentWindow, id, url) -> Promise<{status: 'ok', data: any} | {status: 'net-err', error} | {status: 'user-err', userError}>\n# status 'ok' == data successfully loaded\n# status 'no-op' == data previously loaded\n# status 'net-err' == no internet connection available\n# status 'user-err' == user code has errors\n# promise throws == pagedraw fucked up, crash", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 25, "line_end": 45} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.loadProdLibrary = (contentWindow, id) ->\n initContentWindowGlobals(contentWindow)\n loadLibrary(contentWindow, id, \"#{extcodeserver}/#{id}\")\n\n\n# NOTE: I'm doing window. here to guarantee our bundling process won't change the name of this function,\n# since router.cjsx error handling searches for this function name to know if there was an error in user code\nwindow?.__evalBundleWrapperForErrorDetector = (contentWindow, bundle) ->\n wrapBundle = (bundle) -> \"\"\"\n {\"use strict\";\n #{bundle}\n ;\\nreturn PagedrawSpecs;\\n}\n \"\"\"\n return (contentWindow.Function(wrapBundle(bundle)))()\n\n# loadLibrary :: (contentWindow, id, url) -> Promise<{status: 'ok', data: any} | {status: 'net-err', error} | {status: 'user-err', userError}>\n# status 'ok' == data successfully loaded\n# status 'no-op' == data previously loaded\n# status 'net-err' == no internet connection available\n# status 'user-err' == user code has errors\n# promise throws == pagedraw fucked up, crash\n```", "response": "exports.loadProdLibrary = function(contentWindow, id) {\n initContentWindowGlobals(contentWindow);\n return loadLibrary(contentWindow, id, `${extcodeserver}/${id}`);\n};\n\n// NOTE: I'm doing window. here to guarantee our bundling process won't change the name of this function,\n// since router.cjsx error handling searches for this function name to know if there was an error in user code\nif (typeof window !== \"undefined\" && window !== null) {\n window.__evalBundleWrapperForErrorDetector = function(contentWindow, bundle) {\n var wrapBundle;\n wrapBundle = function(bundle) {\n return `{\"use strict\";\n${bundle}\n;\\nreturn PagedrawSpecs;\\n}`;\n };\n return (contentWindow.Function(wrapBundle(bundle)))();\n };\n}\n\n// loadLibrary :: (contentWindow, id, url) -> Promise<{status: 'ok', data: any} | {status: 'net-err', error} | {status: 'user-err', userError}>\n// status 'ok' == data successfully loaded\n// status 'no-op' == data previously loaded\n// status 'net-err' == no internet connection available\n// status 'user-err' == user code has errors\n// promise throws == pagedraw fucked up, crash", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 25, "line_end": 45} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.loadProdLibrary = function(contentWindow, id) {\n initContentWindowGlobals(contentWindow);\n return loadLibrary(contentWindow, id, `${extcodeserver}/${id}`);\n};\n\n// NOTE: I'm doing window. here to guarantee our bundling process won't change the name of this function,\n// since router.cjsx error handling searches for this function name to know if there was an error in user code\nif (typeof window !== \"undefined\" && window !== null) {\n window.__evalBundleWrapperForErrorDetector = function(contentWindow, bundle) {\n var wrapBundle;\n wrapBundle = function(bundle) {\n return `{\"use strict\";\n${bundle}\n;\\nreturn PagedrawSpecs;\\n}`;\n };\n return (contentWindow.Function(wrapBundle(bundle)))();\n };\n}\n\n// loadLibrary :: (contentWindow, id, url) -> Promise<{status: 'ok', data: any} | {status: 'net-err', error} | {status: 'user-err', userError}>\n// status 'ok' == data successfully loaded\n// status 'no-op' == data previously loaded\n// status 'net-err' == no internet connection available\n// status 'user-err' == user code has errors\n// promise throws == pagedraw fucked up, crash\n```", "response": "exports.loadProdLibrary = (contentWindow, id) ->\n initContentWindowGlobals(contentWindow)\n loadLibrary(contentWindow, id, \"#{extcodeserver}/#{id}\")\n\n\n# NOTE: I'm doing window. here to guarantee our bundling process won't change the name of this function,\n# since router.cjsx error handling searches for this function name to know if there was an error in user code\nwindow?.__evalBundleWrapperForErrorDetector = (contentWindow, bundle) ->\n wrapBundle = (bundle) -> \"\"\"\n {\"use strict\";\n #{bundle}\n ;\\nreturn PagedrawSpecs;\\n}\n \"\"\"\n return (contentWindow.Function(wrapBundle(bundle)))()\n\n# loadLibrary :: (contentWindow, id, url) -> Promise<{status: 'ok', data: any} | {status: 'net-err', error} | {status: 'user-err', userError}>\n# status 'ok' == data successfully loaded\n# status 'no-op' == data previously loaded\n# status 'net-err' == no internet connection available\n# status 'user-err' == user code has errors\n# promise throws == pagedraw fucked up, crash", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 25, "line_end": 45} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:3:completion", "type": "completion", "prompt": "exports.loadProdLibrary = (contentWindow, id) ->\n initContentWindowGlobals(contentWindow)\n loadLibrary(contentWindow, id, \"#{extcodeserver}/#{id}\")\n\n\n# NOTE: I'm doing window. here to guarantee our bundling process won't change the name of this function,\n# since router.cjsx error handling searches for this function name to know if there was an error in user code\nwindow?.__evalBundleWrapperForErrorDetector = (contentWindow, bundle) ->\n wrapBundle = (bundle) -> \"\"\"\n {\"use strict\";", "response": "#{bundle}\n ;\\nreturn PagedrawSpecs;\\n}\n \"\"\"\n return (contentWindow.Function(wrapBundle(bundle)))()\n\n# loadLibrary :: (contentWindow, id, url) -> Promise<{status: 'ok', data: any} | {status: 'net-err', error} | {status: 'user-err', userError}>\n# status 'ok' == data successfully loaded\n# status 'no-op' == data previously loaded\n# status 'net-err' == no internet connection available\n# status 'user-err' == user code has errors\n# promise throws == pagedraw fucked up, crash", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 25, "line_end": 45} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "loadLibrary = (contentWindow, id, url) ->\n new Promise (resolve, reject) ->\n if contentWindow.pd__loaded_libs.has(id)\n console.warn \"Attempt to load already loaded library #{id}. Not loading.\"\n return resolve {status: 'no-op', data: contentWindow.pd__dataForId[id]}\n\n if (loading = contentWindow.pd__loading_libs.get(id))?\n console.warn \"Attempt to load loading library #{id}. Waiting...\"\n callback = (specs, errType, error, userError) ->\n if not err?\n then resolve({status: 'ok', data: specs})\n else resolve({status: errType, error, userError})\n loading.callbacks.push(callback)\n else\n contentWindow.pd__loading_libs.set(id, {callbacks: []})\n\n get_code = ->\n fetch(url).then((r) -> r.text()).then((bundle) ->\n {error: null, bundle}\n ).catch (error) ->\n {error}\n\n resolve_with_error = (errType, error, userError) ->\n resolve({status: errType, error: error, userError})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks\n contentWindow.pd__loading_libs.delete(id)\n callback(undefined, errType, error, userError) for callback in callbacks\n\n get_code().then(({error, bundle}) ->\n if error? then resolve_with_error('net-err', error, null)\n else\n eval_result = window.__evalBundleWrapperForErrorDetector(contentWindow, bundle)\n specs = if (typeof eval_result == 'object') and eval_result.default? then eval_result.default else eval_result\n\n contentWindow.pd__loaded_libs.add(id)\n\n # FIXME: This might leak too much memory\n contentWindow.pd__dataForId[id] = specs\n\n resolve({status: 'ok', data: specs})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks\n contentWindow.pd__loading_libs.delete(id)\n callback(specs) for callback in callbacks\n ).catch (e) ->\n # we threw while evaluating user code.\n resolve_with_error('user-err', null, e)\n\n\nconnection_timeout = 20000\nconnection = {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 46, "line_end": 95} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nloadLibrary = (contentWindow, id, url) ->\n new Promise (resolve, reject) ->\n if contentWindow.pd__loaded_libs.has(id)\n console.warn \"Attempt to load already loaded library #{id}. Not loading.\"\n return resolve {status: 'no-op', data: contentWindow.pd__dataForId[id]}\n\n if (loading = contentWindow.pd__loading_libs.get(id))?\n console.warn \"Attempt to load loading library #{id}. Waiting...\"\n callback = (specs, errType, error, userError) ->\n if not err?\n then resolve({status: 'ok', data: specs})\n else resolve({status: errType, error, userError})\n loading.callbacks.push(callback)\n else\n contentWindow.pd__loading_libs.set(id, {callbacks: []})\n\n get_code = ->\n fetch(url).then((r) -> r.text()).then((bundle) ->\n {error: null, bundle}\n ).catch (error) ->\n {error}\n\n resolve_with_error = (errType, error, userError) ->\n resolve({status: errType, error: error, userError})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks\n contentWindow.pd__loading_libs.delete(id)\n callback(undefined, errType, error, userError) for callback in callbacks\n\n get_code().then(({error, bundle}) ->\n if error? then resolve_with_error('net-err', error, null)\n else\n eval_result = window.__evalBundleWrapperForErrorDetector(contentWindow, bundle)\n specs = if (typeof eval_result == 'object') and eval_result.default? then eval_result.default else eval_result\n\n contentWindow.pd__loaded_libs.add(id)\n\n # FIXME: This might leak too much memory\n contentWindow.pd__dataForId[id] = specs\n\n resolve({status: 'ok', data: specs})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks\n contentWindow.pd__loading_libs.delete(id)\n callback(specs) for callback in callbacks\n ).catch (e) ->\n # we threw while evaluating user code.\n resolve_with_error('user-err', null, e)\n\n\nconnection_timeout = 20000\nconnection = {}\n```", "response": "var connection, connection_timeout, loadLibrary;\n\nloadLibrary = function(contentWindow, id, url) {\n return new Promise(function(resolve, reject) {\n var callback, get_code, loading, resolve_with_error;\n if (contentWindow.pd__loaded_libs.has(id)) {\n console.warn(`Attempt to load already loaded library ${id}. Not loading.`);\n return resolve({\n status: 'no-op',\n data: contentWindow.pd__dataForId[id]\n });\n }\n if ((loading = contentWindow.pd__loading_libs.get(id)) != null) {\n console.warn(`Attempt to load loading library ${id}. Waiting...`);\n callback = function(specs, errType, error, userError) {\n if (typeof err === \"undefined\" || err === null) {\n return resolve({\n status: 'ok',\n data: specs\n });\n } else {\n return resolve({\n status: errType,\n error,\n userError\n });\n }\n };\n return loading.callbacks.push(callback);\n } else {\n contentWindow.pd__loading_libs.set(id, {\n callbacks: []\n });\n get_code = function() {\n return fetch(url).then(function(r) {\n return r.text();\n }).then(function(bundle) {\n return {\n error: null,\n bundle\n };\n }).catch(function(error) {\n return {error};\n });\n };\n resolve_with_error = function(errType, error, userError) {\n var callbacks, i, len, results;\n resolve({\n status: errType,\n error: error,\n userError\n });\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks;\n contentWindow.pd__loading_libs.delete(id);\n results = [];\n for (i = 0, len = callbacks.length; i < len; i++) {\n callback = callbacks[i];\n results.push(callback(void 0, errType, error, userError));\n }\n return results;\n };\n return get_code().then(function({error, bundle}) {\n var callbacks, eval_result, i, len, results, specs;\n if (error != null) {\n return resolve_with_error('net-err', error, null);\n } else {\n eval_result = window.__evalBundleWrapperForErrorDetector(contentWindow, bundle);\n specs = (typeof eval_result === 'object') && (eval_result.default != null) ? eval_result.default : eval_result;\n contentWindow.pd__loaded_libs.add(id);\n // FIXME: This might leak too much memory\n contentWindow.pd__dataForId[id] = specs;\n resolve({\n status: 'ok',\n data: specs\n });\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks;\n contentWindow.pd__loading_libs.delete(id);\n results = [];\n for (i = 0, len = callbacks.length; i < len; i++) {\n callback = callbacks[i];\n results.push(callback(specs));\n }\n return results;\n }\n }).catch(function(e) {\n // we threw while evaluating user code.\n return resolve_with_error('user-err', null, e);\n });\n }\n });\n};\n\nconnection_timeout = 20000;\n\nconnection = {};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 46, "line_end": 95} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar connection, connection_timeout, loadLibrary;\n\nloadLibrary = function(contentWindow, id, url) {\n return new Promise(function(resolve, reject) {\n var callback, get_code, loading, resolve_with_error;\n if (contentWindow.pd__loaded_libs.has(id)) {\n console.warn(`Attempt to load already loaded library ${id}. Not loading.`);\n return resolve({\n status: 'no-op',\n data: contentWindow.pd__dataForId[id]\n });\n }\n if ((loading = contentWindow.pd__loading_libs.get(id)) != null) {\n console.warn(`Attempt to load loading library ${id}. Waiting...`);\n callback = function(specs, errType, error, userError) {\n if (typeof err === \"undefined\" || err === null) {\n return resolve({\n status: 'ok',\n data: specs\n });\n } else {\n return resolve({\n status: errType,\n error,\n userError\n });\n }\n };\n return loading.callbacks.push(callback);\n } else {\n contentWindow.pd__loading_libs.set(id, {\n callbacks: []\n });\n get_code = function() {\n return fetch(url).then(function(r) {\n return r.text();\n }).then(function(bundle) {\n return {\n error: null,\n bundle\n };\n }).catch(function(error) {\n return {error};\n });\n };\n resolve_with_error = function(errType, error, userError) {\n var callbacks, i, len, results;\n resolve({\n status: errType,\n error: error,\n userError\n });\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks;\n contentWindow.pd__loading_libs.delete(id);\n results = [];\n for (i = 0, len = callbacks.length; i < len; i++) {\n callback = callbacks[i];\n results.push(callback(void 0, errType, error, userError));\n }\n return results;\n };\n return get_code().then(function({error, bundle}) {\n var callbacks, eval_result, i, len, results, specs;\n if (error != null) {\n return resolve_with_error('net-err', error, null);\n } else {\n eval_result = window.__evalBundleWrapperForErrorDetector(contentWindow, bundle);\n specs = (typeof eval_result === 'object') && (eval_result.default != null) ? eval_result.default : eval_result;\n contentWindow.pd__loaded_libs.add(id);\n // FIXME: This might leak too much memory\n contentWindow.pd__dataForId[id] = specs;\n resolve({\n status: 'ok',\n data: specs\n });\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks;\n contentWindow.pd__loading_libs.delete(id);\n results = [];\n for (i = 0, len = callbacks.length; i < len; i++) {\n callback = callbacks[i];\n results.push(callback(specs));\n }\n return results;\n }\n }).catch(function(e) {\n // we threw while evaluating user code.\n return resolve_with_error('user-err', null, e);\n });\n }\n });\n};\n\nconnection_timeout = 20000;\n\nconnection = {};\n```", "response": "loadLibrary = (contentWindow, id, url) ->\n new Promise (resolve, reject) ->\n if contentWindow.pd__loaded_libs.has(id)\n console.warn \"Attempt to load already loaded library #{id}. Not loading.\"\n return resolve {status: 'no-op', data: contentWindow.pd__dataForId[id]}\n\n if (loading = contentWindow.pd__loading_libs.get(id))?\n console.warn \"Attempt to load loading library #{id}. Waiting...\"\n callback = (specs, errType, error, userError) ->\n if not err?\n then resolve({status: 'ok', data: specs})\n else resolve({status: errType, error, userError})\n loading.callbacks.push(callback)\n else\n contentWindow.pd__loading_libs.set(id, {callbacks: []})\n\n get_code = ->\n fetch(url).then((r) -> r.text()).then((bundle) ->\n {error: null, bundle}\n ).catch (error) ->\n {error}\n\n resolve_with_error = (errType, error, userError) ->\n resolve({status: errType, error: error, userError})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks\n contentWindow.pd__loading_libs.delete(id)\n callback(undefined, errType, error, userError) for callback in callbacks\n\n get_code().then(({error, bundle}) ->\n if error? then resolve_with_error('net-err', error, null)\n else\n eval_result = window.__evalBundleWrapperForErrorDetector(contentWindow, bundle)\n specs = if (typeof eval_result == 'object') and eval_result.default? then eval_result.default else eval_result\n\n contentWindow.pd__loaded_libs.add(id)\n\n # FIXME: This might leak too much memory\n contentWindow.pd__dataForId[id] = specs\n\n resolve({status: 'ok', data: specs})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks\n contentWindow.pd__loading_libs.delete(id)\n callback(specs) for callback in callbacks\n ).catch (e) ->\n # we threw while evaluating user code.\n resolve_with_error('user-err', null, e)\n\n\nconnection_timeout = 20000\nconnection = {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 46, "line_end": 95} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:4:completion", "type": "completion", "prompt": "loadLibrary = (contentWindow, id, url) ->\n new Promise (resolve, reject) ->\n if contentWindow.pd__loaded_libs.has(id)\n console.warn \"Attempt to load already loaded library #{id}. Not loading.\"\n return resolve {status: 'no-op', data: contentWindow.pd__dataForId[id]}\n\n if (loading = contentWindow.pd__loading_libs.get(id))?\n console.warn \"Attempt to load loading library #{id}. Waiting...\"\n callback = (specs, errType, error, userError) ->\n if not err?\n then resolve({status: 'ok', data: specs})\n else resolve({status: errType, error, userError})\n loading.callbacks.push(callback)\n else\n contentWindow.pd__loading_libs.set(id, {callbacks: []})\n\n get_code = ->\n fetch(url).then((r) -> r.text()).then((bundle) ->\n {error: null, bundle}\n ).catch (error) ->\n {error}\n\n resolve_with_error = (errType, error, userError) ->\n resolve({status: errType, error: error, userError})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks", "response": "contentWindow.pd__loading_libs.delete(id)\n callback(undefined, errType, error, userError) for callback in callbacks\n\n get_code().then(({error, bundle}) ->\n if error? then resolve_with_error('net-err', error, null)\n else\n eval_result = window.__evalBundleWrapperForErrorDetector(contentWindow, bundle)\n specs = if (typeof eval_result == 'object') and eval_result.default? then eval_result.default else eval_result\n\n contentWindow.pd__loaded_libs.add(id)\n\n # FIXME: This might leak too much memory\n contentWindow.pd__dataForId[id] = specs\n\n resolve({status: 'ok', data: specs})\n callbacks = contentWindow.pd__loading_libs.get(id).callbacks\n contentWindow.pd__loading_libs.delete(id)\n callback(specs) for callback in callbacks\n ).catch (e) ->\n # we threw while evaluating user code.\n resolve_with_error('user-err', null, e)\n\n\nconnection_timeout = 20000\nconnection = {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 46, "line_end": 95} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.subscribeToDevServer = (on_build) ->\n # library in development always has id == $0\n # when we add support for multiple libraries we'll need to\n # add support for more ids too, which should be of the format\n # $1, $2, $3...\n disconnect = ->\n if connection.timeout_timer? then clearInterval(connection.timeout_timer)\n connection.source?.close()\n delete connection.source\n on_build(\"0\", ['disconnected'])\n\n connection.source = source = new window.EventSource(\"#{devcodeserver}/__webpack_hmr\")\n source.onopen = -> connection.last_active = new Date()\n source.onerror = ->\n disconnect()\n source.onmessage = (event) ->\n connection.last_active = new Date()\n return if event.data == \"\\uD83D\\uDC93\" #dev server heartbeat\n try\n data = JSON.parse(event.data)\n on_build(\"$0\", data.errors || []) if data.action == 'built'\n catch e\n console.warn(\"HR Error: #{e}\")\n\n window.addEventListener(\"beforeunload\", disconnect)\n\n connection.timeout_timer = setInterval((-> if connection.last_active? and new Date() - connection.last_active > connection_timeout then disconnect()), connection_timeout)\n\n# publishDevLibrary :: (static_id) -> Promise<{status: 'ok', hash: string} | {status: 'net-err', error} | {status: 'user-err', error}>\n# status 'ok' == library was successfully uploaded\n# status 'net-err' == Unable to reach the CLI\n# status 'user-err' == user code has errors\n# promise throws = pagedraw error, crash", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 97, "line_end": 129} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.subscribeToDevServer = (on_build) ->\n # library in development always has id == $0\n # when we add support for multiple libraries we'll need to\n # add support for more ids too, which should be of the format\n # $1, $2, $3...\n disconnect = ->\n if connection.timeout_timer? then clearInterval(connection.timeout_timer)\n connection.source?.close()\n delete connection.source\n on_build(\"0\", ['disconnected'])\n\n connection.source = source = new window.EventSource(\"#{devcodeserver}/__webpack_hmr\")\n source.onopen = -> connection.last_active = new Date()\n source.onerror = ->\n disconnect()\n source.onmessage = (event) ->\n connection.last_active = new Date()\n return if event.data == \"\\uD83D\\uDC93\" #dev server heartbeat\n try\n data = JSON.parse(event.data)\n on_build(\"$0\", data.errors || []) if data.action == 'built'\n catch e\n console.warn(\"HR Error: #{e}\")\n\n window.addEventListener(\"beforeunload\", disconnect)\n\n connection.timeout_timer = setInterval((-> if connection.last_active? and new Date() - connection.last_active > connection_timeout then disconnect()), connection_timeout)\n\n# publishDevLibrary :: (static_id) -> Promise<{status: 'ok', hash: string} | {status: 'net-err', error} | {status: 'user-err', error}>\n# status 'ok' == library was successfully uploaded\n# status 'net-err' == Unable to reach the CLI\n# status 'user-err' == user code has errors\n# promise throws = pagedraw error, crash\n```", "response": "exports.subscribeToDevServer = function(on_build) {\n var disconnect, source;\n // library in development always has id == $0\n // when we add support for multiple libraries we'll need to\n // add support for more ids too, which should be of the format\n // $1, $2, $3...\n disconnect = function() {\n var ref;\n if (connection.timeout_timer != null) {\n clearInterval(connection.timeout_timer);\n }\n if ((ref = connection.source) != null) {\n ref.close();\n }\n delete connection.source;\n return on_build(\"0\", ['disconnected']);\n };\n connection.source = source = new window.EventSource(`${devcodeserver}/__webpack_hmr`);\n source.onopen = function() {\n return connection.last_active = new Date();\n };\n source.onerror = function() {\n return disconnect();\n };\n source.onmessage = function(event) {\n var data, e;\n connection.last_active = new Date();\n if (event.data === \"\\uD83D\\uDC93\") { //dev server heartbeat\n return;\n }\n try {\n data = JSON.parse(event.data);\n if (data.action === 'built') {\n return on_build(\"$0\", data.errors || []);\n }\n } catch (error) {\n e = error;\n return console.warn(`HR Error: ${e}`);\n }\n };\n window.addEventListener(\"beforeunload\", disconnect);\n return connection.timeout_timer = setInterval((function() {\n if ((connection.last_active != null) && new Date() - connection.last_active > connection_timeout) {\n return disconnect();\n }\n }), connection_timeout);\n};\n\n// publishDevLibrary :: (static_id) -> Promise<{status: 'ok', hash: string} | {status: 'net-err', error} | {status: 'user-err', error}>\n// status 'ok' == library was successfully uploaded\n// status 'net-err' == Unable to reach the CLI\n// status 'user-err' == user code has errors\n// promise throws = pagedraw error, crash", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 97, "line_end": 129} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.subscribeToDevServer = function(on_build) {\n var disconnect, source;\n // library in development always has id == $0\n // when we add support for multiple libraries we'll need to\n // add support for more ids too, which should be of the format\n // $1, $2, $3...\n disconnect = function() {\n var ref;\n if (connection.timeout_timer != null) {\n clearInterval(connection.timeout_timer);\n }\n if ((ref = connection.source) != null) {\n ref.close();\n }\n delete connection.source;\n return on_build(\"0\", ['disconnected']);\n };\n connection.source = source = new window.EventSource(`${devcodeserver}/__webpack_hmr`);\n source.onopen = function() {\n return connection.last_active = new Date();\n };\n source.onerror = function() {\n return disconnect();\n };\n source.onmessage = function(event) {\n var data, e;\n connection.last_active = new Date();\n if (event.data === \"\\uD83D\\uDC93\") { //dev server heartbeat\n return;\n }\n try {\n data = JSON.parse(event.data);\n if (data.action === 'built') {\n return on_build(\"$0\", data.errors || []);\n }\n } catch (error) {\n e = error;\n return console.warn(`HR Error: ${e}`);\n }\n };\n window.addEventListener(\"beforeunload\", disconnect);\n return connection.timeout_timer = setInterval((function() {\n if ((connection.last_active != null) && new Date() - connection.last_active > connection_timeout) {\n return disconnect();\n }\n }), connection_timeout);\n};\n\n// publishDevLibrary :: (static_id) -> Promise<{status: 'ok', hash: string} | {status: 'net-err', error} | {status: 'user-err', error}>\n// status 'ok' == library was successfully uploaded\n// status 'net-err' == Unable to reach the CLI\n// status 'user-err' == user code has errors\n// promise throws = pagedraw error, crash\n```", "response": "exports.subscribeToDevServer = (on_build) ->\n # library in development always has id == $0\n # when we add support for multiple libraries we'll need to\n # add support for more ids too, which should be of the format\n # $1, $2, $3...\n disconnect = ->\n if connection.timeout_timer? then clearInterval(connection.timeout_timer)\n connection.source?.close()\n delete connection.source\n on_build(\"0\", ['disconnected'])\n\n connection.source = source = new window.EventSource(\"#{devcodeserver}/__webpack_hmr\")\n source.onopen = -> connection.last_active = new Date()\n source.onerror = ->\n disconnect()\n source.onmessage = (event) ->\n connection.last_active = new Date()\n return if event.data == \"\\uD83D\\uDC93\" #dev server heartbeat\n try\n data = JSON.parse(event.data)\n on_build(\"$0\", data.errors || []) if data.action == 'built'\n catch e\n console.warn(\"HR Error: #{e}\")\n\n window.addEventListener(\"beforeunload\", disconnect)\n\n connection.timeout_timer = setInterval((-> if connection.last_active? and new Date() - connection.last_active > connection_timeout then disconnect()), connection_timeout)\n\n# publishDevLibrary :: (static_id) -> Promise<{status: 'ok', hash: string} | {status: 'net-err', error} | {status: 'user-err', error}>\n# status 'ok' == library was successfully uploaded\n# status 'net-err' == Unable to reach the CLI\n# status 'user-err' == user code has errors\n# promise throws = pagedraw error, crash", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 97, "line_end": 129} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:6:completion", "type": "completion", "prompt": "exports.subscribeToDevServer = (on_build) ->\n # library in development always has id == $0\n # when we add support for multiple libraries we'll need to\n # add support for more ids too, which should be of the format\n # $1, $2, $3...\n disconnect = ->\n if connection.timeout_timer? then clearInterval(connection.timeout_timer)\n connection.source?.close()\n delete connection.source\n on_build(\"0\", ['disconnected'])\n\n connection.source = source = new window.EventSource(\"#{devcodeserver}/__webpack_hmr\")\n source.onopen = -> connection.last_active = new Date()\n source.onerror = ->\n disconnect()\n source.onmessage = (event) ->", "response": "connection.last_active = new Date()\n return if event.data == \"\\uD83D\\uDC93\" #dev server heartbeat\n try\n data = JSON.parse(event.data)\n on_build(\"$0\", data.errors || []) if data.action == 'built'\n catch e\n console.warn(\"HR Error: #{e}\")\n\n window.addEventListener(\"beforeunload\", disconnect)\n\n connection.timeout_timer = setInterval((-> if connection.last_active? and new Date() - connection.last_active > connection_timeout then disconnect()), connection_timeout)\n\n# publishDevLibrary :: (static_id) -> Promise<{status: 'ok', hash: string} | {status: 'net-err', error} | {status: 'user-err', error}>\n# status 'ok' == library was successfully uploaded\n# status 'net-err' == Unable to reach the CLI\n# status 'user-err' == user code has errors\n# promise throws = pagedraw error, crash", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 97, "line_end": 129} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.publishDevLibrary = (static_id) ->\n new Promise (resolve, reject) ->\n uploadLibraryData(static_id).then(({status, error, id}) ->\n if status =='internal-err' then reject(new Error(\"Internal error while uploading library\"))\n else resolve({status, error, hash: id})\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 130, "line_end": 135} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.publishDevLibrary = (static_id) ->\n new Promise (resolve, reject) ->\n uploadLibraryData(static_id).then(({status, error, id}) ->\n if status =='internal-err' then reject(new Error(\"Internal error while uploading library\"))\n else resolve({status, error, hash: id})\n )\n```", "response": "exports.publishDevLibrary = function(static_id) {\n return new Promise(function(resolve, reject) {\n return uploadLibraryData(static_id).then(function({status, error, id}) {\n if (status === 'internal-err') {\n return reject(new Error(\"Internal error while uploading library\"));\n } else {\n return resolve({\n status,\n error,\n hash: id\n });\n }\n });\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 130, "line_end": 135} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.publishDevLibrary = function(static_id) {\n return new Promise(function(resolve, reject) {\n return uploadLibraryData(static_id).then(function({status, error, id}) {\n if (status === 'internal-err') {\n return reject(new Error(\"Internal error while uploading library\"));\n } else {\n return resolve({\n status,\n error,\n hash: id\n });\n }\n });\n });\n};\n```", "response": "exports.publishDevLibrary = (static_id) ->\n new Promise (resolve, reject) ->\n uploadLibraryData(static_id).then(({status, error, id}) ->\n if status =='internal-err' then reject(new Error(\"Internal error while uploading library\"))\n else resolve({status, error, hash: id})\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 130, "line_end": 135} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:7:completion", "type": "completion", "prompt": "exports.publishDevLibrary = (static_id) ->\n new Promise (resolve, reject) ->\n uploadLibraryData(static_id).then(({status, error, id}) ->", "response": "if status =='internal-err' then reject(new Error(\"Internal error while uploading library\"))\n else resolve({status, error, hash: id})\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 130, "line_end": 135} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "uploadLibraryData = (static_id) ->\n payload = { static_id, host: extcodeserver, metaserver: config.metaserver }\n fetch(\"#{devcodeserver}/exit_dev\", {\n method: 'POST',\n headers: {\"Content-Type\": \"application/json\"},\n body: JSON.stringify(payload)\n }).then((response) ->\n if not response.ok then throw new Error()\n else return response.json()\n ).catch (error) ->\n return { status: 'net-err', error: new Error('Unable to connect to the CLI')}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 138, "line_end": 148} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nuploadLibraryData = (static_id) ->\n payload = { static_id, host: extcodeserver, metaserver: config.metaserver }\n fetch(\"#{devcodeserver}/exit_dev\", {\n method: 'POST',\n headers: {\"Content-Type\": \"application/json\"},\n body: JSON.stringify(payload)\n }).then((response) ->\n if not response.ok then throw new Error()\n else return response.json()\n ).catch (error) ->\n return { status: 'net-err', error: new Error('Unable to connect to the CLI')}\n```", "response": "var uploadLibraryData;\n\nuploadLibraryData = function(static_id) {\n var payload;\n payload = {\n static_id,\n host: extcodeserver,\n metaserver: config.metaserver\n };\n return fetch(`${devcodeserver}/exit_dev`, {\n method: 'POST',\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(payload)\n }).then(function(response) {\n if (!response.ok) {\n throw new Error();\n } else {\n return response.json();\n }\n }).catch(function(error) {\n return {\n status: 'net-err',\n error: new Error('Unable to connect to the CLI')\n };\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 138, "line_end": 148} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar uploadLibraryData;\n\nuploadLibraryData = function(static_id) {\n var payload;\n payload = {\n static_id,\n host: extcodeserver,\n metaserver: config.metaserver\n };\n return fetch(`${devcodeserver}/exit_dev`, {\n method: 'POST',\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(payload)\n }).then(function(response) {\n if (!response.ok) {\n throw new Error();\n } else {\n return response.json();\n }\n }).catch(function(error) {\n return {\n status: 'net-err',\n error: new Error('Unable to connect to the CLI')\n };\n });\n};\n```", "response": "uploadLibraryData = (static_id) ->\n payload = { static_id, host: extcodeserver, metaserver: config.metaserver }\n fetch(\"#{devcodeserver}/exit_dev\", {\n method: 'POST',\n headers: {\"Content-Type\": \"application/json\"},\n body: JSON.stringify(payload)\n }).then((response) ->\n if not response.ok then throw new Error()\n else return response.json()\n ).catch (error) ->\n return { status: 'net-err', error: new Error('Unable to connect to the CLI')}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 138, "line_end": 148} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:8:completion", "type": "completion", "prompt": "uploadLibraryData = (static_id) ->\n payload = { static_id, host: extcodeserver, metaserver: config.metaserver }\n fetch(\"#{devcodeserver}/exit_dev\", {\n method: 'POST',\n headers: {\"Content-Type\": \"application/json\"},", "response": "body: JSON.stringify(payload)\n }).then((response) ->\n if not response.ok then throw new Error()\n else return response.json()\n ).catch (error) ->\n return { status: 'net-err', error: new Error('Unable to connect to the CLI')}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 138, "line_end": 148} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.libraryCliAlive = ->\n fetch(\"#{devcodeserver}/are-you-alive\").then((response) ->\n response.ok\n ).catch(-> false)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 150, "line_end": 153} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:9:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.libraryCliAlive = ->\n fetch(\"#{devcodeserver}/are-you-alive\").then((response) ->\n response.ok\n ).catch(-> false)\n```", "response": "exports.libraryCliAlive = function() {\n return fetch(`${devcodeserver}/are-you-alive`).then(function(response) {\n return response.ok;\n }).catch(function() {\n return false;\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 150, "line_end": 153} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:9:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.libraryCliAlive = function() {\n return fetch(`${devcodeserver}/are-you-alive`).then(function(response) {\n return response.ok;\n }).catch(function() {\n return false;\n });\n};\n```", "response": "exports.libraryCliAlive = ->\n fetch(\"#{devcodeserver}/are-you-alive\").then((response) ->\n response.ok\n ).catch(-> false)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 150, "line_end": 153} {"id": "Pagedraw/pagedraw:src/lib-cli-client.coffee:9:completion", "type": "completion", "prompt": "exports.libraryCliAlive = ->\n fetch(\"#{devcodeserver}/are-you-alive\").then((response) ->", "response": "response.ok\n ).catch(-> false)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Pagedraw/pagedraw", "path": "src/lib-cli-client.coffee", "license": "MIT", "commit": "aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e", "stars": 3558, "source_url": "https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/lib-cli-client.coffee", "line_start": 150, "line_end": 153} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event\n\n $$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 1, "line_end": 41} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event\n\n $$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return\n```", "response": "(function($$) {\n var ELEMENT_ID, EVENTS_DESKTOP, EVENT_METHODS, HANDLERS, READY_EXPRESSION;\n ELEMENT_ID = 1;\n HANDLERS = {};\n EVENT_METHODS = {\n preventDefault: \"isDefaultPrevented\",\n stopImmediatePropagation: \"isImmediatePropagationStopped\",\n stopPropagation: \"isPropagationStopped\"\n };\n EVENTS_DESKTOP = {\n touchstart: \"mousedown\",\n touchmove: \"mousemove\",\n touchend: \"mouseup\",\n touch: \"click\",\n doubletap: \"dblclick\",\n orientationchange: \"resize\"\n };\n READY_EXPRESSION = /complete|loaded|interactive/;\n $$.fn.on = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n return callback($$);\n } else {\n return $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n };\n $$.Event = function(type, touch) {\n var event, property;\n event = document.createEvent(\"Events\");\n event.initEvent(type, true, true, null, null, null, null, null, null, null, null, null, null, null, null);\n if (touch) {\n for (property in touch) {\n event[property] = touch[property];\n }\n }\n return event;\n };\n return $$.fn.bind = function(event, callback) {\n return this.each(function() {\n _subscribe(this, event, callback);\n });\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 1, "line_end": 41} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var ELEMENT_ID, EVENTS_DESKTOP, EVENT_METHODS, HANDLERS, READY_EXPRESSION;\n ELEMENT_ID = 1;\n HANDLERS = {};\n EVENT_METHODS = {\n preventDefault: \"isDefaultPrevented\",\n stopImmediatePropagation: \"isImmediatePropagationStopped\",\n stopPropagation: \"isPropagationStopped\"\n };\n EVENTS_DESKTOP = {\n touchstart: \"mousedown\",\n touchmove: \"mousemove\",\n touchend: \"mouseup\",\n touch: \"click\",\n doubletap: \"dblclick\",\n orientationchange: \"resize\"\n };\n READY_EXPRESSION = /complete|loaded|interactive/;\n $$.fn.on = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n return callback($$);\n } else {\n return $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n };\n $$.Event = function(type, touch) {\n var event, property;\n event = document.createEvent(\"Events\");\n event.initEvent(type, true, true, null, null, null, null, null, null, null, null, null, null, null, null);\n if (touch) {\n for (property in touch) {\n event[property] = touch[property];\n }\n }\n return event;\n };\n return $$.fn.bind = function(event, callback) {\n return this.each(function() {\n _subscribe(this, event, callback);\n });\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event\n\n $$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 1, "line_end": 41} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))", "response": "$$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event\n\n $$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 1, "line_end": 41} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch, originalEvent) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n event.originalEvent = originalEvent if originalEvent?\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 43, "line_end": 87} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch, originalEvent) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n event.originalEvent = originalEvent if originalEvent?\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null\n```", "response": "$$.fn.unbind = function(event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback);\n });\n};\n\n$$.fn.delegate = function(selector, event, callback) {\n return this.each(function(i, element) {\n _subscribe(element, event, callback, selector, function(fn) {\n return function(e) {\n var evt, match;\n match = $$(e.target).closest(selector, element).get(0);\n if (match) {\n evt = $$.extend(_createProxy(e), {\n currentTarget: match,\n liveFired: element\n });\n return fn.apply(match, [evt].concat([].slice.call(arguments, 1)));\n }\n };\n });\n });\n};\n\n$$.fn.undelegate = function(selector, event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback, selector);\n });\n};\n\n$$.fn.trigger = function(event, touch, originalEvent) {\n if ($$.toType(event) === \"string\") {\n event = $$.Event(event, touch);\n }\n if (originalEvent != null) {\n event.originalEvent = originalEvent;\n }\n return this.each(function() {\n this.dispatchEvent(event);\n });\n};\n\n$$.fn.addEvent = function(element, event_name, callback) {\n if (element.addEventListener) {\n return element.addEventListener(event_name, callback, false);\n } else if (element.attachEvent) {\n return element.attachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = callback;\n }\n};\n\n$$.fn.removeEvent = function(element, event_name, callback) {\n if (element.removeEventListener) {\n return element.removeEventListener(event_name, callback, false);\n } else if (element.detachEvent) {\n return element.detachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = null;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 43, "line_end": 87} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$$.fn.unbind = function(event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback);\n });\n};\n\n$$.fn.delegate = function(selector, event, callback) {\n return this.each(function(i, element) {\n _subscribe(element, event, callback, selector, function(fn) {\n return function(e) {\n var evt, match;\n match = $$(e.target).closest(selector, element).get(0);\n if (match) {\n evt = $$.extend(_createProxy(e), {\n currentTarget: match,\n liveFired: element\n });\n return fn.apply(match, [evt].concat([].slice.call(arguments, 1)));\n }\n };\n });\n });\n};\n\n$$.fn.undelegate = function(selector, event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback, selector);\n });\n};\n\n$$.fn.trigger = function(event, touch, originalEvent) {\n if ($$.toType(event) === \"string\") {\n event = $$.Event(event, touch);\n }\n if (originalEvent != null) {\n event.originalEvent = originalEvent;\n }\n return this.each(function() {\n this.dispatchEvent(event);\n });\n};\n\n$$.fn.addEvent = function(element, event_name, callback) {\n if (element.addEventListener) {\n return element.addEventListener(event_name, callback, false);\n } else if (element.attachEvent) {\n return element.attachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = callback;\n }\n};\n\n$$.fn.removeEvent = function(element, event_name, callback) {\n if (element.removeEventListener) {\n return element.removeEventListener(event_name, callback, false);\n } else if (element.detachEvent) {\n return element.detachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = null;\n }\n};\n```", "response": "$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch, originalEvent) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n event.originalEvent = originalEvent if originalEvent?\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 43, "line_end": 87} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:completion", "type": "completion", "prompt": "$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return", "response": "$$.fn.trigger = (event, touch, originalEvent) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n event.originalEvent = originalEvent if originalEvent?\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 43, "line_end": 87} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.callback is fn) and (not selector or handler.selector is selector)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 89, "line_end": 129} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.callback is fn) and (not selector or handler.selector is selector)\n```", "response": "var _createProxyCallback, _environmentEvent, _findHandlers, _getElementId, _subscribe, _unsubscribe;\n\n_subscribe = function(element, event, callback, selector, delegate_callback) {\n var delegate, element_handlers, element_id, handler;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n element_handlers = HANDLERS[element_id] || (HANDLERS[element_id] = []);\n delegate = delegate_callback && delegate_callback(callback, event);\n handler = {\n event: event,\n callback: callback,\n selector: selector,\n proxy: _createProxyCallback(delegate, callback, element),\n delegate: delegate,\n index: element_handlers.length\n };\n element_handlers.push(handler);\n return $$.fn.addEvent(element, handler.event, handler.proxy);\n};\n\n_unsubscribe = function(element, event, callback, selector) {\n var element_id;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n return _findHandlers(element_id, event, callback, selector).forEach(function(handler) {\n delete HANDLERS[element_id][handler.index];\n return $$.fn.removeEvent(element, handler.event, handler.proxy);\n });\n};\n\n_getElementId = function(element) {\n return element._id || (element._id = ELEMENT_ID++);\n};\n\n_environmentEvent = function(event) {\n var environment_event;\n environment_event = (($$.isMobile()) ? event : EVENTS_DESKTOP[event]);\n return environment_event || event;\n};\n\n_createProxyCallback = function(delegate, callback, element) {\n var proxy;\n callback = delegate || callback;\n proxy = function(event) {\n var result;\n result = callback.apply(element, [event].concat(event.data));\n if (result === false) {\n event.preventDefault();\n }\n return result;\n };\n return proxy;\n};\n\n_findHandlers = function(element_id, event, fn, selector) {\n return (HANDLERS[element_id] || []).filter(function(handler) {\n return handler && (!event || handler.event === event) && (!fn || handler.callback === fn) && (!selector || handler.selector === selector);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 89, "line_end": 129} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _createProxyCallback, _environmentEvent, _findHandlers, _getElementId, _subscribe, _unsubscribe;\n\n_subscribe = function(element, event, callback, selector, delegate_callback) {\n var delegate, element_handlers, element_id, handler;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n element_handlers = HANDLERS[element_id] || (HANDLERS[element_id] = []);\n delegate = delegate_callback && delegate_callback(callback, event);\n handler = {\n event: event,\n callback: callback,\n selector: selector,\n proxy: _createProxyCallback(delegate, callback, element),\n delegate: delegate,\n index: element_handlers.length\n };\n element_handlers.push(handler);\n return $$.fn.addEvent(element, handler.event, handler.proxy);\n};\n\n_unsubscribe = function(element, event, callback, selector) {\n var element_id;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n return _findHandlers(element_id, event, callback, selector).forEach(function(handler) {\n delete HANDLERS[element_id][handler.index];\n return $$.fn.removeEvent(element, handler.event, handler.proxy);\n });\n};\n\n_getElementId = function(element) {\n return element._id || (element._id = ELEMENT_ID++);\n};\n\n_environmentEvent = function(event) {\n var environment_event;\n environment_event = (($$.isMobile()) ? event : EVENTS_DESKTOP[event]);\n return environment_event || event;\n};\n\n_createProxyCallback = function(delegate, callback, element) {\n var proxy;\n callback = delegate || callback;\n proxy = function(event) {\n var result;\n result = callback.apply(element, [event].concat(event.data));\n if (result === false) {\n event.preventDefault();\n }\n return result;\n };\n return proxy;\n};\n\n_findHandlers = function(element_id, event, fn, selector) {\n return (HANDLERS[element_id] || []).filter(function(handler) {\n return handler && (!event || handler.event === event) && (!fn || handler.callback === fn) && (!selector || handler.selector === selector);\n });\n};\n```", "response": "_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.callback is fn) and (not selector or handler.selector is selector)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 89, "line_end": 129} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:completion", "type": "completion", "prompt": "_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->", "response": "delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.callback is fn) and (not selector or handler.selector is selector)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 89, "line_end": 129} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->\n @[method] = ->\n true\n\n event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 131, "line_end": 142} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->\n @[method] = ->\n true\n\n event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy\n```", "response": "var _createProxy;\n\n_createProxy = function(event) {\n var proxy;\n proxy = $$.extend({\n originalEvent: event\n }, event);\n $$.each(EVENT_METHODS, function(name, method) {\n proxy[name] = function() {\n this[method] = function() {\n return true;\n };\n return event[name].apply(event, arguments);\n };\n return proxy[method] = function() {\n return false;\n };\n });\n return proxy;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 131, "line_end": 142} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _createProxy;\n\n_createProxy = function(event) {\n var proxy;\n proxy = $$.extend({\n originalEvent: event\n }, event);\n $$.each(EVENT_METHODS, function(name, method) {\n proxy[name] = function() {\n this[method] = function() {\n return true;\n };\n return event[name].apply(event, arguments);\n };\n return proxy[method] = function() {\n return false;\n };\n });\n return proxy;\n};\n```", "response": "_createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->\n @[method] = ->\n true\n\n event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 131, "line_end": 142} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:completion", "type": "completion", "prompt": "_createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->\n @[method] = ->\n true", "response": "event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "db5124bd6dad3e3803dc6059dc5c2e87d7c5236e", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/db5124bd6dad3e3803dc6059dc5c2e87d7c5236e/src/quo.events.coffee", "line_start": 131, "line_end": 142} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "dc53547d2215519234be873615adf5759904053c", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/dc53547d2215519234be873615adf5759904053c/src/quo.events.coffee", "line_start": 43, "line_end": 86} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null\n```", "response": "$$.fn.unbind = function(event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback);\n });\n};\n\n$$.fn.delegate = function(selector, event, callback) {\n return this.each(function(i, element) {\n _subscribe(element, event, callback, selector, function(fn) {\n return function(e) {\n var evt, match;\n match = $$(e.target).closest(selector, element).get(0);\n if (match) {\n evt = $$.extend(_createProxy(e), {\n currentTarget: match,\n liveFired: element\n });\n return fn.apply(match, [evt].concat([].slice.call(arguments, 1)));\n }\n };\n });\n });\n};\n\n$$.fn.undelegate = function(selector, event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback, selector);\n });\n};\n\n$$.fn.trigger = function(event, touch) {\n if ($$.toType(event) === \"string\") {\n event = $$.Event(event, touch);\n }\n return this.each(function() {\n this.dispatchEvent(event);\n });\n};\n\n$$.fn.addEvent = function(element, event_name, callback) {\n if (element.addEventListener) {\n return element.addEventListener(event_name, callback, false);\n } else if (element.attachEvent) {\n return element.attachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = callback;\n }\n};\n\n$$.fn.removeEvent = function(element, event_name, callback) {\n if (element.removeEventListener) {\n return element.removeEventListener(event_name, callback, false);\n } else if (element.detachEvent) {\n return element.detachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = null;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "dc53547d2215519234be873615adf5759904053c", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/dc53547d2215519234be873615adf5759904053c/src/quo.events.coffee", "line_start": 43, "line_end": 86} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$$.fn.unbind = function(event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback);\n });\n};\n\n$$.fn.delegate = function(selector, event, callback) {\n return this.each(function(i, element) {\n _subscribe(element, event, callback, selector, function(fn) {\n return function(e) {\n var evt, match;\n match = $$(e.target).closest(selector, element).get(0);\n if (match) {\n evt = $$.extend(_createProxy(e), {\n currentTarget: match,\n liveFired: element\n });\n return fn.apply(match, [evt].concat([].slice.call(arguments, 1)));\n }\n };\n });\n });\n};\n\n$$.fn.undelegate = function(selector, event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback, selector);\n });\n};\n\n$$.fn.trigger = function(event, touch) {\n if ($$.toType(event) === \"string\") {\n event = $$.Event(event, touch);\n }\n return this.each(function() {\n this.dispatchEvent(event);\n });\n};\n\n$$.fn.addEvent = function(element, event_name, callback) {\n if (element.addEventListener) {\n return element.addEventListener(event_name, callback, false);\n } else if (element.attachEvent) {\n return element.attachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = callback;\n }\n};\n\n$$.fn.removeEvent = function(element, event_name, callback) {\n if (element.removeEventListener) {\n return element.removeEventListener(event_name, callback, false);\n } else if (element.detachEvent) {\n return element.detachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = null;\n }\n};\n```", "response": "$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "dc53547d2215519234be873615adf5759904053c", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/dc53547d2215519234be873615adf5759904053c/src/quo.events.coffee", "line_start": 43, "line_end": 86} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:completion", "type": "completion", "prompt": "$$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return", "response": "$$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n\n $$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "dc53547d2215519234be873615adf5759904053c", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/dc53547d2215519234be873615adf5759904053c/src/quo.events.coffee", "line_start": 43, "line_end": 86} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "4b9c210511d0676bdee8544f431bd8d2c6767559", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/4b9c210511d0676bdee8544f431bd8d2c6767559/src/quo.events.coffee", "line_start": 88, "line_end": 128} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)\n```", "response": "var _createProxyCallback, _environmentEvent, _findHandlers, _getElementId, _subscribe, _unsubscribe;\n\n_subscribe = function(element, event, callback, selector, delegate_callback) {\n var delegate, element_handlers, element_id, handler;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n element_handlers = HANDLERS[element_id] || (HANDLERS[element_id] = []);\n delegate = delegate_callback && delegate_callback(callback, event);\n handler = {\n event: event,\n callback: callback,\n selector: selector,\n proxy: _createProxyCallback(delegate, callback, element),\n delegate: delegate,\n index: element_handlers.length\n };\n element_handlers.push(handler);\n return $$.fn.addEvent(element, handler.event, handler.proxy);\n};\n\n_unsubscribe = function(element, event, callback, selector) {\n var element_id;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n return _findHandlers(element_id, event, callback, selector).forEach(function(handler) {\n delete HANDLERS[element_id][handler.index];\n return $$.fn.removeEvent(element, handler.event, handler.proxy);\n });\n};\n\n_getElementId = function(element) {\n return element._id || (element._id = ELEMENT_ID++);\n};\n\n_environmentEvent = function(event) {\n var environment_event;\n environment_event = (($$.isMobile()) ? event : EVENTS_DESKTOP[event]);\n return environment_event || event;\n};\n\n_createProxyCallback = function(delegate, callback, element) {\n var proxy;\n callback = delegate || callback;\n proxy = function(event) {\n var result;\n result = callback.apply(element, [event].concat(event.data));\n if (result === false) {\n event.preventDefault();\n }\n return result;\n };\n return proxy;\n};\n\n_findHandlers = function(element_id, event, fn, selector) {\n return (HANDLERS[element_id] || []).filter(function(handler) {\n return handler && (!event || handler.event === event) && (!fn || handler.fn === fn) && (!selector || handler.selector === selector);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "4b9c210511d0676bdee8544f431bd8d2c6767559", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/4b9c210511d0676bdee8544f431bd8d2c6767559/src/quo.events.coffee", "line_start": 88, "line_end": 128} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _createProxyCallback, _environmentEvent, _findHandlers, _getElementId, _subscribe, _unsubscribe;\n\n_subscribe = function(element, event, callback, selector, delegate_callback) {\n var delegate, element_handlers, element_id, handler;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n element_handlers = HANDLERS[element_id] || (HANDLERS[element_id] = []);\n delegate = delegate_callback && delegate_callback(callback, event);\n handler = {\n event: event,\n callback: callback,\n selector: selector,\n proxy: _createProxyCallback(delegate, callback, element),\n delegate: delegate,\n index: element_handlers.length\n };\n element_handlers.push(handler);\n return $$.fn.addEvent(element, handler.event, handler.proxy);\n};\n\n_unsubscribe = function(element, event, callback, selector) {\n var element_id;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n return _findHandlers(element_id, event, callback, selector).forEach(function(handler) {\n delete HANDLERS[element_id][handler.index];\n return $$.fn.removeEvent(element, handler.event, handler.proxy);\n });\n};\n\n_getElementId = function(element) {\n return element._id || (element._id = ELEMENT_ID++);\n};\n\n_environmentEvent = function(event) {\n var environment_event;\n environment_event = (($$.isMobile()) ? event : EVENTS_DESKTOP[event]);\n return environment_event || event;\n};\n\n_createProxyCallback = function(delegate, callback, element) {\n var proxy;\n callback = delegate || callback;\n proxy = function(event) {\n var result;\n result = callback.apply(element, [event].concat(event.data));\n if (result === false) {\n event.preventDefault();\n }\n return result;\n };\n return proxy;\n};\n\n_findHandlers = function(element_id, event, fn, selector) {\n return (HANDLERS[element_id] || []).filter(function(handler) {\n return handler && (!event || handler.event === event) && (!fn || handler.fn === fn) && (!selector || handler.selector === selector);\n });\n};\n```", "response": "_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "4b9c210511d0676bdee8544f431bd8d2c6767559", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/4b9c210511d0676bdee8544f431bd8d2c6767559/src/quo.events.coffee", "line_start": 88, "line_end": 128} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:completion", "type": "completion", "prompt": "_subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->", "response": "delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n\n _findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "4b9c210511d0676bdee8544f431bd8d2c6767559", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/4b9c210511d0676bdee8544f431bd8d2c6767559/src/quo.events.coffee", "line_start": 88, "line_end": 128} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"tap\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"tap\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event\n```", "response": "(function($$) {\n var ELEMENT_ID, EVENTS_DESKTOP, EVENT_METHODS, HANDLERS, READY_EXPRESSION, SHORTCUTS;\n ELEMENT_ID = 1;\n HANDLERS = {};\n EVENT_METHODS = {\n preventDefault: \"isDefaultPrevented\",\n stopImmediatePropagation: \"isImmediatePropagationStopped\",\n stopPropagation: \"isPropagationStopped\"\n };\n EVENTS_DESKTOP = {\n touchstart: \"mousedown\",\n touchmove: \"mousemove\",\n touchend: \"mouseup\",\n touch: \"click\",\n doubletap: \"dblclick\",\n orientationchange: \"resize\"\n };\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"tap\"];\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, event, callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n return callback($$);\n } else {\n return $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n };\n return $$.Event = function(type, touch) {\n var event, property;\n event = document.createEvent(\"Events\");\n event.initEvent(type, true, true, null, null, null, null, null, null, null, null, null, null, null, null);\n if (touch) {\n for (property in touch) {\n event[property] = touch[property];\n }\n }\n return event;\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var ELEMENT_ID, EVENTS_DESKTOP, EVENT_METHODS, HANDLERS, READY_EXPRESSION, SHORTCUTS;\n ELEMENT_ID = 1;\n HANDLERS = {};\n EVENT_METHODS = {\n preventDefault: \"isDefaultPrevented\",\n stopImmediatePropagation: \"isImmediatePropagationStopped\",\n stopPropagation: \"isPropagationStopped\"\n };\n EVENTS_DESKTOP = {\n touchstart: \"mousedown\",\n touchmove: \"mousemove\",\n touchend: \"mouseup\",\n touch: \"click\",\n doubletap: \"dblclick\",\n orientationchange: \"resize\"\n };\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"tap\"];\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, event, callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n return callback($$);\n } else {\n return $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n };\n return $$.Event = function(type, touch) {\n var event, property;\n event = document.createEvent(\"Events\");\n event.initEvent(type, true, true, null, null, null, null, null, null, null, null, null, null, null, null);\n if (touch) {\n for (property in touch) {\n event[property] = touch[property];\n }\n }\n return event;\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"tap\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"tap\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->", "response": "$$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return\n\n $$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 44, "line_end": 84} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return\n\n $$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback\n```", "response": "$$.fn.bind = function(event, callback) {\n return this.each(function() {\n _subscribe(this, event, callback);\n });\n};\n\n$$.fn.unbind = function(event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback);\n });\n};\n\n$$.fn.delegate = function(selector, event, callback) {\n return this.each(function(i, element) {\n _subscribe(element, event, callback, selector, function(fn) {\n return function(e) {\n var evt, match;\n match = $$(e.target).closest(selector, element).get(0);\n if (match) {\n evt = $$.extend(_createProxy(e), {\n currentTarget: match,\n liveFired: element\n });\n return fn.apply(match, [evt].concat([].slice.call(arguments, 1)));\n }\n };\n });\n });\n};\n\n$$.fn.undelegate = function(selector, event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback, selector);\n });\n};\n\n$$.fn.trigger = function(event, touch) {\n if ($$.toType(event) === \"string\") {\n event = $$.Event(event, touch);\n }\n return this.each(function() {\n this.dispatchEvent(event);\n });\n};\n\n$$.fn.addEvent = function(element, event_name, callback) {\n if (element.addEventListener) {\n return element.addEventListener(event_name, callback, false);\n } else if (element.attachEvent) {\n return element.attachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = callback;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 44, "line_end": 84} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$$.fn.bind = function(event, callback) {\n return this.each(function() {\n _subscribe(this, event, callback);\n });\n};\n\n$$.fn.unbind = function(event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback);\n });\n};\n\n$$.fn.delegate = function(selector, event, callback) {\n return this.each(function(i, element) {\n _subscribe(element, event, callback, selector, function(fn) {\n return function(e) {\n var evt, match;\n match = $$(e.target).closest(selector, element).get(0);\n if (match) {\n evt = $$.extend(_createProxy(e), {\n currentTarget: match,\n liveFired: element\n });\n return fn.apply(match, [evt].concat([].slice.call(arguments, 1)));\n }\n };\n });\n });\n};\n\n$$.fn.undelegate = function(selector, event, callback) {\n return this.each(function() {\n _unsubscribe(this, event, callback, selector);\n });\n};\n\n$$.fn.trigger = function(event, touch) {\n if ($$.toType(event) === \"string\") {\n event = $$.Event(event, touch);\n }\n return this.each(function() {\n this.dispatchEvent(event);\n });\n};\n\n$$.fn.addEvent = function(element, event_name, callback) {\n if (element.addEventListener) {\n return element.addEventListener(event_name, callback, false);\n } else if (element.attachEvent) {\n return element.attachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = callback;\n }\n};\n```", "response": "$$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return\n\n $$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )\n fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 44, "line_end": 84} {"id": "soyjavi/QuoJS:src/quo.events.coffee:2:completion", "type": "completion", "prompt": "$$.fn.bind = (event, callback) ->\n @each ->\n _subscribe @, event, callback\n return\n\n $$.fn.unbind = (event, callback) ->\n @each ->\n _unsubscribe @, event, callback\n return\n\n $$.fn.delegate = (selector, event, callback) ->\n @each (i, element) ->\n _subscribe element, event, callback, selector, (fn) ->\n (e) ->\n match = $$(e.target).closest(selector, element).get(0)\n if match\n evt = $$.extend(_createProxy(e),\n currentTarget: match\n liveFired: element\n )", "response": "fn.apply match, [ evt ].concat([].slice.call(arguments, 1))\n return\n\n $$.fn.undelegate = (selector, event, callback) ->\n @each ->\n _unsubscribe @, event, callback, selector\n return\n\n $$.fn.trigger = (event, touch) ->\n event = $$.Event(event, touch) if $$.toType(event) is \"string\"\n @each ->\n @dispatchEvent event\n return\n\n $$.fn.addEvent = (element, event_name, callback) ->\n if element.addEventListener\n element.addEventListener event_name, callback, false\n else if element.attachEvent\n element.attachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = callback", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 44, "line_end": 84} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null\n\n _subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 86, "line_end": 130} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null\n\n _subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy\n```", "response": "var _createProxyCallback, _environmentEvent, _getElementId, _subscribe, _unsubscribe;\n\n$$.fn.removeEvent = function(element, event_name, callback) {\n if (element.removeEventListener) {\n return element.removeEventListener(event_name, callback, false);\n } else if (element.detachEvent) {\n return element.detachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = null;\n }\n};\n\n_subscribe = function(element, event, callback, selector, delegate_callback) {\n var delegate, element_handlers, element_id, handler;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n element_handlers = HANDLERS[element_id] || (HANDLERS[element_id] = []);\n delegate = delegate_callback && delegate_callback(callback, event);\n handler = {\n event: event,\n callback: callback,\n selector: selector,\n proxy: _createProxyCallback(delegate, callback, element),\n delegate: delegate,\n index: element_handlers.length\n };\n element_handlers.push(handler);\n return $$.fn.addEvent(element, handler.event, handler.proxy);\n};\n\n_unsubscribe = function(element, event, callback, selector) {\n var element_id;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n return _findHandlers(element_id, event, callback, selector).forEach(function(handler) {\n delete HANDLERS[element_id][handler.index];\n return $$.fn.removeEvent(element, handler.event, handler.proxy);\n });\n};\n\n_getElementId = function(element) {\n return element._id || (element._id = ELEMENT_ID++);\n};\n\n_environmentEvent = function(event) {\n var environment_event;\n environment_event = (($$.isMobile()) ? event : EVENTS_DESKTOP[event]);\n return environment_event || event;\n};\n\n_createProxyCallback = function(delegate, callback, element) {\n var proxy;\n callback = delegate || callback;\n proxy = function(event) {\n var result;\n result = callback.apply(element, [event].concat(event.data));\n if (result === false) {\n event.preventDefault();\n }\n return result;\n };\n return proxy;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 86, "line_end": 130} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _createProxyCallback, _environmentEvent, _getElementId, _subscribe, _unsubscribe;\n\n$$.fn.removeEvent = function(element, event_name, callback) {\n if (element.removeEventListener) {\n return element.removeEventListener(event_name, callback, false);\n } else if (element.detachEvent) {\n return element.detachEvent(\"on\" + event_name, callback);\n } else {\n return element[\"on\" + event_name] = null;\n }\n};\n\n_subscribe = function(element, event, callback, selector, delegate_callback) {\n var delegate, element_handlers, element_id, handler;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n element_handlers = HANDLERS[element_id] || (HANDLERS[element_id] = []);\n delegate = delegate_callback && delegate_callback(callback, event);\n handler = {\n event: event,\n callback: callback,\n selector: selector,\n proxy: _createProxyCallback(delegate, callback, element),\n delegate: delegate,\n index: element_handlers.length\n };\n element_handlers.push(handler);\n return $$.fn.addEvent(element, handler.event, handler.proxy);\n};\n\n_unsubscribe = function(element, event, callback, selector) {\n var element_id;\n event = _environmentEvent(event);\n element_id = _getElementId(element);\n return _findHandlers(element_id, event, callback, selector).forEach(function(handler) {\n delete HANDLERS[element_id][handler.index];\n return $$.fn.removeEvent(element, handler.event, handler.proxy);\n });\n};\n\n_getElementId = function(element) {\n return element._id || (element._id = ELEMENT_ID++);\n};\n\n_environmentEvent = function(event) {\n var environment_event;\n environment_event = (($$.isMobile()) ? event : EVENTS_DESKTOP[event]);\n return environment_event || event;\n};\n\n_createProxyCallback = function(delegate, callback, element) {\n var proxy;\n callback = delegate || callback;\n proxy = function(event) {\n var result;\n result = callback.apply(element, [event].concat(event.data));\n if (result === false) {\n event.preventDefault();\n }\n return result;\n };\n return proxy;\n};\n```", "response": "$$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null\n\n _subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler\n $$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 86, "line_end": 130} {"id": "soyjavi/QuoJS:src/quo.events.coffee:3:completion", "type": "completion", "prompt": "$$.fn.removeEvent = (element, event_name, callback) ->\n if element.removeEventListener\n element.removeEventListener event_name, callback, false\n else if element.detachEvent\n element.detachEvent \"on\" + event_name, callback\n else\n element[\"on\" + event_name] = null\n\n _subscribe = (element, event, callback, selector, delegate_callback) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n element_handlers = HANDLERS[element_id] or (HANDLERS[element_id] = [])\n delegate = delegate_callback and delegate_callback(callback, event)\n handler =\n event: event\n callback: callback\n selector: selector\n proxy: _createProxyCallback(delegate, callback, element)\n delegate: delegate\n index: element_handlers.length\n\n element_handlers.push handler", "response": "$$.fn.addEvent element, handler.event, handler.proxy\n\n _unsubscribe = (element, event, callback, selector) ->\n event = _environmentEvent(event)\n element_id = _getElementId(element)\n _findHandlers(element_id, event, callback, selector).forEach (handler) ->\n delete HANDLERS[element_id][handler.index]\n\n $$.fn.removeEvent element, handler.event, handler.proxy\n\n _getElementId = (element) -> element._id or (element._id = ELEMENT_ID++)\n\n _environmentEvent = (event) ->\n environment_event = (if ($$.isMobile()) then event else EVENTS_DESKTOP[event])\n (environment_event) or event\n\n _createProxyCallback = (delegate, callback, element) ->\n callback = delegate or callback\n proxy = (event) ->\n result = callback.apply(element, [ event ].concat(event.data))\n event.preventDefault() if result is false\n result\n proxy", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 86, "line_end": 130} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)\n\n _createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->\n @[method] = ->\n true\n\n event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 132, "line_end": 147} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)\n\n _createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->\n @[method] = ->\n true\n\n event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy\n```", "response": "var _createProxy, _findHandlers;\n\n_findHandlers = function(element_id, event, fn, selector) {\n return (HANDLERS[element_id] || []).filter(function(handler) {\n return handler && (!event || handler.event === event) && (!fn || handler.fn === fn) && (!selector || handler.selector === selector);\n });\n};\n\n_createProxy = function(event) {\n var proxy;\n proxy = $$.extend({\n originalEvent: event\n }, event);\n $$.each(EVENT_METHODS, function(name, method) {\n proxy[name] = function() {\n this[method] = function() {\n return true;\n };\n return event[name].apply(event, arguments);\n };\n return proxy[method] = function() {\n return false;\n };\n });\n return proxy;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 132, "line_end": 147} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _createProxy, _findHandlers;\n\n_findHandlers = function(element_id, event, fn, selector) {\n return (HANDLERS[element_id] || []).filter(function(handler) {\n return handler && (!event || handler.event === event) && (!fn || handler.fn === fn) && (!selector || handler.selector === selector);\n });\n};\n\n_createProxy = function(event) {\n var proxy;\n proxy = $$.extend({\n originalEvent: event\n }, event);\n $$.each(EVENT_METHODS, function(name, method) {\n proxy[name] = function() {\n this[method] = function() {\n return true;\n };\n return event[name].apply(event, arguments);\n };\n return proxy[method] = function() {\n return false;\n };\n });\n return proxy;\n};\n```", "response": "_findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)\n\n _createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->\n @[method] = ->\n true\n\n event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 132, "line_end": 147} {"id": "soyjavi/QuoJS:src/quo.events.coffee:4:completion", "type": "completion", "prompt": "_findHandlers = (element_id, event, fn, selector) ->\n (HANDLERS[element_id] or []).filter (handler) ->\n handler and (not event or handler.event is event) and (not fn or handler.fn is fn) and (not selector or handler.selector is selector)\n\n _createProxy = (event) ->\n proxy = $$.extend( originalEvent: event, event)\n $$.each EVENT_METHODS, (name, method) ->\n proxy[name] = ->", "response": "@[method] = ->\n true\n\n event[name].apply event, arguments\n\n proxy[method] = ->\n false\n proxy", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e86ec7adf4b8dc6f961c3e8c627644449d77e0e3", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e86ec7adf4b8dc6f961c3e8c627644449d77e0e3/src/quo.events.coffee", "line_start": 132, "line_end": 147} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"touch\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"touch\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event\n```", "response": "(function($$) {\n var ELEMENT_ID, EVENTS_DESKTOP, EVENT_METHODS, HANDLERS, READY_EXPRESSION, SHORTCUTS;\n ELEMENT_ID = 1;\n HANDLERS = {};\n EVENT_METHODS = {\n preventDefault: \"isDefaultPrevented\",\n stopImmediatePropagation: \"isImmediatePropagationStopped\",\n stopPropagation: \"isPropagationStopped\"\n };\n EVENTS_DESKTOP = {\n touchstart: \"mousedown\",\n touchmove: \"mousemove\",\n touchend: \"mouseup\",\n touch: \"click\",\n doubletap: \"dblclick\",\n orientationchange: \"resize\"\n };\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\"];\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, event, callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n return callback($$);\n } else {\n return $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n };\n return $$.Event = function(type, touch) {\n var event, property;\n event = document.createEvent(\"Events\");\n event.initEvent(type, true, true, null, null, null, null, null, null, null, null, null, null, null, null);\n if (touch) {\n for (property in touch) {\n event[property] = touch[property];\n }\n }\n return event;\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var ELEMENT_ID, EVENTS_DESKTOP, EVENT_METHODS, HANDLERS, READY_EXPRESSION, SHORTCUTS;\n ELEMENT_ID = 1;\n HANDLERS = {};\n EVENT_METHODS = {\n preventDefault: \"isDefaultPrevented\",\n stopImmediatePropagation: \"isImmediatePropagationStopped\",\n stopPropagation: \"isPropagationStopped\"\n };\n EVENTS_DESKTOP = {\n touchstart: \"mousedown\",\n touchmove: \"mousemove\",\n touchend: \"mouseup\",\n touch: \"click\",\n doubletap: \"dblclick\",\n orientationchange: \"resize\"\n };\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\"];\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, event, callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === \"undefined\" || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n return callback($$);\n } else {\n return $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n };\n return $$.Event = function(type, touch) {\n var event, property;\n event = document.createEvent(\"Events\");\n event.initEvent(type, true, true, null, null, null, null, null, null, null, null, null, null, null, null);\n if (touch) {\n for (property in touch) {\n event[property] = touch[property];\n }\n }\n return event;\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"touch\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n ELEMENT_ID = 1\n HANDLERS = {}\n EVENT_METHODS =\n preventDefault: \"isDefaultPrevented\"\n stopImmediatePropagation: \"isImmediatePropagationStopped\"\n stopPropagation: \"isPropagationStopped\"\n EVENTS_DESKTOP =\n touchstart: \"mousedown\"\n touchmove: \"mousemove\"\n touchend: \"mouseup\"\n touch: \"click\"\n doubletap: \"dblclick\"\n orientationchange: \"resize\"\n\n READY_EXPRESSION = /complete|loaded|interactive/\n\n SHORTCUTS = [ \"touch\" ]\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->", "response": "$$(document.body).delegate @selector, event, callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is \"undefined\" or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n\n $$.Event = (type, touch) ->\n event = document.createEvent(\"Events\")\n event.initEvent type, true, true, null, null, null, null, null, null, null, null, null, null, null, null\n if touch\n event[property] = touch[property] for property of touch\n event", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.events.coffee", "line_start": 1, "line_end": 42} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo\n```", "response": "/*\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var READY_EXPRESSION, SHORTCUTS, SHORTCUTS_EVENTS;\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\", \"tap\"];\n SHORTCUTS_EVENTS = {\n touch: \"touchstart\",\n tap: \"tap\"\n };\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, SHORTCUTS_EVENTS[event], callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n callback($$);\n } else {\n $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n return this;\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var READY_EXPRESSION, SHORTCUTS, SHORTCUTS_EVENTS;\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\", \"tap\"];\n SHORTCUTS_EVENTS = {\n touch: \"touchstart\",\n tap: \"tap\"\n };\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, SHORTCUTS_EVENTS[event], callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n callback($$);\n } else {\n $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n return this;\n };\n})(Quo);\n```", "response": "###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:completion", "type": "completion", "prompt": "###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback", "response": "@\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo\n```", "response": "/*\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var READY_EXPRESSION, SHORTCUTS, SHORTCUTS_EVENTS;\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\", \"tap\"];\n SHORTCUTS_EVENTS = {\n touch: \"touchstart\",\n tap: \"tap\"\n };\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, SHORTCUTS_EVENTS[event], callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n callback($$);\n } else {\n $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n return this;\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var READY_EXPRESSION, SHORTCUTS, SHORTCUTS_EVENTS;\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\", \"tap\"];\n SHORTCUTS_EVENTS = {\n touch: \"touchstart\",\n tap: \"tap\"\n };\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, SHORTCUTS_EVENTS[event], callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n callback($$);\n } else {\n $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n return this;\n };\n})(Quo);\n```", "response": "###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:completion", "type": "completion", "prompt": "###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback", "response": "@\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo\n```", "response": "/*\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var READY_EXPRESSION, SHORTCUTS, SHORTCUTS_EVENTS;\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\", \"tap\"];\n SHORTCUTS_EVENTS = {\n touch: \"touchstart\",\n tap: \"tap\"\n };\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, SHORTCUTS_EVENTS[event], callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n callback($$);\n } else {\n $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n return this;\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var READY_EXPRESSION, SHORTCUTS, SHORTCUTS_EVENTS;\n READY_EXPRESSION = /complete|loaded|interactive/;\n SHORTCUTS = [\"touch\", \"tap\"];\n SHORTCUTS_EVENTS = {\n touch: \"touchstart\",\n tap: \"tap\"\n };\n SHORTCUTS.forEach(function(event) {\n $$.fn[event] = function(callback) {\n return $$(document.body).delegate(this.selector, SHORTCUTS_EVENTS[event], callback);\n };\n return this;\n });\n $$.fn.on = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.bind(event, selector);\n } else {\n return this.delegate(selector, event, callback);\n }\n };\n $$.fn.off = function(event, selector, callback) {\n if (selector === undefined || $$.toType(selector) === \"function\") {\n return this.unbind(event, selector);\n } else {\n return this.undelegate(selector, event, callback);\n }\n };\n $$.fn.ready = function(callback) {\n if (READY_EXPRESSION.test(document.readyState)) {\n callback($$);\n } else {\n $$.fn.addEvent(document, \"DOMContentLoaded\", function() {\n return callback($$);\n });\n }\n return this;\n };\n})(Quo);\n```", "response": "###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback\n @\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "soyjavi/QuoJS:src/quo.events.coffee:1:completion", "type": "completion", "prompt": "###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n READY_EXPRESSION = /complete|loaded|interactive/\n SHORTCUTS = [ \"touch\", \"tap\" ]\n SHORTCUTS_EVENTS =\n touch: \"touchstart\"\n tap: \"tap\"\n\n SHORTCUTS.forEach (event) ->\n $$.fn[event] = (callback) ->\n $$(document.body).delegate @selector, SHORTCUTS_EVENTS[event], callback", "response": "@\n\n $$.fn.on = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @bind(event, selector) else @delegate(selector, event, callback))\n\n $$.fn.off = (event, selector, callback) ->\n (if (selector is `undefined` or $$.toType(selector) is \"function\") then @unbind(event, selector) else @undelegate(selector, event, callback))\n\n $$.fn.ready = (callback) ->\n if READY_EXPRESSION.test(document.readyState)\n callback $$\n else\n $$.fn.addEvent document, \"DOMContentLoaded\", -> callback $$\n @\n\n return\n\n) Quo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.events.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.events.coffee", "line_start": 1, "line_end": 35} {"id": "gss/engine:src/Variable.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n unlog: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCommand = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n unlog: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]\n```", "response": "var Command, Variable;\n\nCommand = require('./Command');\n\nVariable = (function() {\n class Variable extends Command {\n log() {}\n\n unlog() {}\n\n constructor() {}\n\n before(args, engine, operation, continuation, scope, ascender, ascending) {\n var ref, value;\n if ((value = ascending != null ? (ref = ascending.values) != null ? ref[args[0]] : void 0 : void 0) != null) {\n return value;\n }\n }\n\n // Declare variable within domain, initial value is zero\n declare(engine, name) {\n var variable, variables;\n variables = engine.variables;\n if (!(variable = variables[name])) {\n variable = variables[name] = engine.variable(name);\n }\n //if engine.nullified?[name]\n // delete engine.nullified[name]\n //if engine.replaced?[name]\n // delete engine.replaced[name]\n (engine.declared || (engine.declared = {}))[name] = variable;\n return variable;\n }\n\n // Undeclare variable in given domain, outputs \"null\" once\n undeclare(engine, variable, quick) {\n var ref;\n if (quick) {\n (engine.replaced || (engine.replaced = {}))[variable.name] = variable;\n } else {\n (engine.nullified || (engine.nullified = {}))[variable.name] = variable;\n if ((ref = engine.declared) != null ? ref[variable.name] : void 0) {\n delete engine.declared[variable.name];\n }\n }\n delete engine.values[variable.name];\n engine.nullify(variable);\n return engine.unedit(variable);\n }\n\n };\n\n Variable.prototype.type = 'Variable';\n\n Variable.prototype.signature = [\n {\n property: ['String']\n }\n ];\n\n return Variable;\n\n}).call(this);\n\nVariable.Expression = (function() {\n // Algebraic expression\n class Expression extends Variable {};\n\n Expression.prototype.signature = [\n {\n left: ['Variable',\n 'Number'],\n right: ['Variable',\n 'Number']\n }\n ];\n\n return Expression;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Command, Variable;\n\nCommand = require('./Command');\n\nVariable = (function() {\n class Variable extends Command {\n log() {}\n\n unlog() {}\n\n constructor() {}\n\n before(args, engine, operation, continuation, scope, ascender, ascending) {\n var ref, value;\n if ((value = ascending != null ? (ref = ascending.values) != null ? ref[args[0]] : void 0 : void 0) != null) {\n return value;\n }\n }\n\n // Declare variable within domain, initial value is zero\n declare(engine, name) {\n var variable, variables;\n variables = engine.variables;\n if (!(variable = variables[name])) {\n variable = variables[name] = engine.variable(name);\n }\n //if engine.nullified?[name]\n // delete engine.nullified[name]\n //if engine.replaced?[name]\n // delete engine.replaced[name]\n (engine.declared || (engine.declared = {}))[name] = variable;\n return variable;\n }\n\n // Undeclare variable in given domain, outputs \"null\" once\n undeclare(engine, variable, quick) {\n var ref;\n if (quick) {\n (engine.replaced || (engine.replaced = {}))[variable.name] = variable;\n } else {\n (engine.nullified || (engine.nullified = {}))[variable.name] = variable;\n if ((ref = engine.declared) != null ? ref[variable.name] : void 0) {\n delete engine.declared[variable.name];\n }\n }\n delete engine.values[variable.name];\n engine.nullify(variable);\n return engine.unedit(variable);\n }\n\n };\n\n Variable.prototype.type = 'Variable';\n\n Variable.prototype.signature = [\n {\n property: ['String']\n }\n ];\n\n return Variable;\n\n}).call(this);\n\nVariable.Expression = (function() {\n // Algebraic expression\n class Expression extends Variable {};\n\n Expression.prototype.signature = [\n {\n left: ['Variable',\n 'Number'],\n right: ['Variable',\n 'Number']\n }\n ];\n\n return Expression;\n\n}).call(this);\n```", "response": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n unlog: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:completion", "type": "completion", "prompt": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n unlog: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]", "response": "#if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Variable.Expression.algebra =\n '+': (left, right) ->\n return left + right\n\n '-': (left, right) ->\n return left - right\n\n '*': (left, right) ->\n return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 51, "line_end": 65} {"id": "gss/engine:src/Variable.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nVariable.Expression.algebra =\n '+': (left, right) ->\n return left + right\n\n '-': (left, right) ->\n return left - right\n\n '*': (left, right) ->\n return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable\n```", "response": "Variable.Expression.algebra = {\n '+': function(left, right) {\n return left + right;\n },\n '-': function(left, right) {\n return left - right;\n },\n '*': function(left, right) {\n return left * right;\n },\n '/': function(left, right) {\n return left / right;\n }\n};\n\nmodule.exports = Variable;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 51, "line_end": 65} {"id": "gss/engine:src/Variable.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nVariable.Expression.algebra = {\n '+': function(left, right) {\n return left + right;\n },\n '-': function(left, right) {\n return left - right;\n },\n '*': function(left, right) {\n return left * right;\n },\n '/': function(left, right) {\n return left / right;\n }\n};\n\nmodule.exports = Variable;\n```", "response": "Variable.Expression.algebra =\n '+': (left, right) ->\n return left + right\n\n '-': (left, right) ->\n return left - right\n\n '*': (left, right) ->\n return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 51, "line_end": 65} {"id": "gss/engine:src/Variable.coffee:2:completion", "type": "completion", "prompt": "Variable.Expression.algebra =\n '+': (left, right) ->\n return left + right\n\n '-': (left, right) ->\n return left - right", "response": "'*': (left, right) ->\n return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "a9d45d36de536c20679edcd35610f40ddeb179f9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/a9d45d36de536c20679edcd35610f40ddeb179f9/src/Variable.coffee", "line_start": 51, "line_end": 65} {"id": "gss/engine:src/Variable.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "e082e786df4007fe704faaf2e5f2858dd143eb30", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e082e786df4007fe704faaf2e5f2858dd143eb30/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCommand = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]\n```", "response": "var Command, Variable;\n\nCommand = require('./Command');\n\nVariable = (function() {\n class Variable extends Command {\n log() {}\n\n constructor() {}\n\n before(args, engine, operation, continuation, scope, ascender, ascending) {\n var ref, value;\n if ((value = ascending != null ? (ref = ascending.values) != null ? ref[args[0]] : void 0 : void 0) != null) {\n return value;\n }\n }\n\n // Declare variable within domain, initial value is zero\n declare(engine, name) {\n var variable, variables;\n variables = engine.variables;\n if (!(variable = variables[name])) {\n variable = variables[name] = engine.variable(name);\n }\n //if engine.nullified?[name]\n // delete engine.nullified[name]\n //if engine.replaced?[name]\n // delete engine.replaced[name]\n (engine.declared || (engine.declared = {}))[name] = variable;\n return variable;\n }\n\n // Undeclare variable in given domain, outputs \"null\" once\n undeclare(engine, variable, quick) {\n var ref;\n if (quick) {\n (engine.replaced || (engine.replaced = {}))[variable.name] = variable;\n } else {\n (engine.nullified || (engine.nullified = {}))[variable.name] = variable;\n if ((ref = engine.declared) != null ? ref[variable.name] : void 0) {\n delete engine.declared[variable.name];\n }\n }\n delete engine.values[variable.name];\n engine.nullify(variable);\n return engine.unedit(variable);\n }\n\n };\n\n Variable.prototype.type = 'Variable';\n\n Variable.prototype.signature = [\n {\n property: ['String']\n }\n ];\n\n return Variable;\n\n}).call(this);\n\nVariable.Expression = (function() {\n // Algebraic expression\n class Expression extends Variable {};\n\n Expression.prototype.signature = [\n {\n left: ['Variable',\n 'Number'],\n right: ['Variable',\n 'Number']\n }\n ];\n\n return Expression;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "e082e786df4007fe704faaf2e5f2858dd143eb30", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e082e786df4007fe704faaf2e5f2858dd143eb30/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Command, Variable;\n\nCommand = require('./Command');\n\nVariable = (function() {\n class Variable extends Command {\n log() {}\n\n constructor() {}\n\n before(args, engine, operation, continuation, scope, ascender, ascending) {\n var ref, value;\n if ((value = ascending != null ? (ref = ascending.values) != null ? ref[args[0]] : void 0 : void 0) != null) {\n return value;\n }\n }\n\n // Declare variable within domain, initial value is zero\n declare(engine, name) {\n var variable, variables;\n variables = engine.variables;\n if (!(variable = variables[name])) {\n variable = variables[name] = engine.variable(name);\n }\n //if engine.nullified?[name]\n // delete engine.nullified[name]\n //if engine.replaced?[name]\n // delete engine.replaced[name]\n (engine.declared || (engine.declared = {}))[name] = variable;\n return variable;\n }\n\n // Undeclare variable in given domain, outputs \"null\" once\n undeclare(engine, variable, quick) {\n var ref;\n if (quick) {\n (engine.replaced || (engine.replaced = {}))[variable.name] = variable;\n } else {\n (engine.nullified || (engine.nullified = {}))[variable.name] = variable;\n if ((ref = engine.declared) != null ? ref[variable.name] : void 0) {\n delete engine.declared[variable.name];\n }\n }\n delete engine.values[variable.name];\n engine.nullify(variable);\n return engine.unedit(variable);\n }\n\n };\n\n Variable.prototype.type = 'Variable';\n\n Variable.prototype.signature = [\n {\n property: ['String']\n }\n ];\n\n return Variable;\n\n}).call(this);\n\nVariable.Expression = (function() {\n // Algebraic expression\n class Expression extends Variable {};\n\n Expression.prototype.signature = [\n {\n left: ['Variable',\n 'Number'],\n right: ['Variable',\n 'Number']\n }\n ];\n\n return Expression;\n\n}).call(this);\n```", "response": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "e082e786df4007fe704faaf2e5f2858dd143eb30", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e082e786df4007fe704faaf2e5f2858dd143eb30/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:completion", "type": "completion", "prompt": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n log: ->\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]", "response": "#if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "e082e786df4007fe704faaf2e5f2858dd143eb30", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e082e786df4007fe704faaf2e5f2858dd143eb30/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]\n\nVariable.Expression.algebra =\n '+': (left, right) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCommand = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]\n\nVariable.Expression.algebra =\n '+': (left, right) ->\n```", "response": "var Command, Variable;\n\nCommand = require('./Command');\n\nVariable = (function() {\n class Variable extends Command {\n constructor() {}\n\n before(args, engine, operation, continuation, scope, ascender, ascending) {\n var ref, value;\n if ((value = ascending != null ? (ref = ascending.values) != null ? ref[args[0]] : void 0 : void 0) != null) {\n return value;\n }\n }\n\n // Declare variable within domain, initial value is zero\n declare(engine, name) {\n var variable, variables;\n variables = engine.variables;\n if (!(variable = variables[name])) {\n variable = variables[name] = engine.variable(name);\n }\n //if engine.nullified?[name]\n // delete engine.nullified[name]\n //if engine.replaced?[name]\n // delete engine.replaced[name]\n (engine.declared || (engine.declared = {}))[name] = variable;\n return variable;\n }\n\n // Undeclare variable in given domain, outputs \"null\" once\n undeclare(engine, variable, quick) {\n var ref;\n if (quick) {\n (engine.replaced || (engine.replaced = {}))[variable.name] = variable;\n } else {\n (engine.nullified || (engine.nullified = {}))[variable.name] = variable;\n if ((ref = engine.declared) != null ? ref[variable.name] : void 0) {\n delete engine.declared[variable.name];\n }\n }\n delete engine.values[variable.name];\n engine.nullify(variable);\n return engine.unedit(variable);\n }\n\n };\n\n Variable.prototype.type = 'Variable';\n\n Variable.prototype.signature = [\n {\n property: ['String']\n }\n ];\n\n return Variable;\n\n}).call(this);\n\nVariable.Expression = (function() {\n // Algebraic expression\n class Expression extends Variable {};\n\n Expression.prototype.signature = [\n {\n left: ['Variable',\n 'Number'],\n right: ['Variable',\n 'Number']\n }\n ];\n\n return Expression;\n\n}).call(this);\n\nVariable.Expression.algebra = {\n '+': function(left, right) {}\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Command, Variable;\n\nCommand = require('./Command');\n\nVariable = (function() {\n class Variable extends Command {\n constructor() {}\n\n before(args, engine, operation, continuation, scope, ascender, ascending) {\n var ref, value;\n if ((value = ascending != null ? (ref = ascending.values) != null ? ref[args[0]] : void 0 : void 0) != null) {\n return value;\n }\n }\n\n // Declare variable within domain, initial value is zero\n declare(engine, name) {\n var variable, variables;\n variables = engine.variables;\n if (!(variable = variables[name])) {\n variable = variables[name] = engine.variable(name);\n }\n //if engine.nullified?[name]\n // delete engine.nullified[name]\n //if engine.replaced?[name]\n // delete engine.replaced[name]\n (engine.declared || (engine.declared = {}))[name] = variable;\n return variable;\n }\n\n // Undeclare variable in given domain, outputs \"null\" once\n undeclare(engine, variable, quick) {\n var ref;\n if (quick) {\n (engine.replaced || (engine.replaced = {}))[variable.name] = variable;\n } else {\n (engine.nullified || (engine.nullified = {}))[variable.name] = variable;\n if ((ref = engine.declared) != null ? ref[variable.name] : void 0) {\n delete engine.declared[variable.name];\n }\n }\n delete engine.values[variable.name];\n engine.nullify(variable);\n return engine.unedit(variable);\n }\n\n };\n\n Variable.prototype.type = 'Variable';\n\n Variable.prototype.signature = [\n {\n property: ['String']\n }\n ];\n\n return Variable;\n\n}).call(this);\n\nVariable.Expression = (function() {\n // Algebraic expression\n class Expression extends Variable {};\n\n Expression.prototype.signature = [\n {\n left: ['Variable',\n 'Number'],\n right: ['Variable',\n 'Number']\n }\n ];\n\n return Expression;\n\n}).call(this);\n\nVariable.Expression.algebra = {\n '+': function(left, right) {}\n};\n```", "response": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable\n return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]\n\nVariable.Expression.algebra =\n '+': (left, right) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:1:completion", "type": "completion", "prompt": "Command = require('./Command')\n\nclass Variable extends Command\n type: 'Variable'\n\n signature: [\n property: ['String']\n ]\n\n constructor: ->\n\n before: (args, engine, operation, continuation, scope, ascender, ascending) ->\n if (value = ascending?.values?[args[0]])?\n return value\n\n # Declare variable within domain, initial value is zero\n declare: (engine, name) ->\n variables = engine.variables\n unless variable = variables[name]\n variable = variables[name] = engine.variable(name)\n #if engine.nullified?[name]\n # delete engine.nullified[name]\n #if engine.replaced?[name]\n # delete engine.replaced[name]\n (engine.declared ||= {})[name] = variable", "response": "return variable\n\n # Undeclare variable in given domain, outputs \"null\" once\n undeclare: (engine, variable, quick) ->\n if quick\n (engine.replaced ||= {})[variable.name] = variable\n else\n (engine.nullified ||= {})[variable.name] = variable\n if engine.declared?[variable.name]\n delete engine.declared[variable.name]\n\n delete engine.values[variable.name]\n engine.nullify(variable)\n engine.unedit(variable)\n\n# Algebraic expression\nclass Variable.Expression extends Variable\n\n signature: [\n left: ['Variable', 'Number']\n right: ['Variable', 'Number']\n ]\n\nVariable.Expression.algebra =\n '+': (left, right) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/Variable.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return left + right\n\n '-': (left, right) ->\n return left - right\n\n '*': (left, right) ->\n return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 51, "line_end": 62} {"id": "gss/engine:src/Variable.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreturn left + right\n\n '-': (left, right) ->\n return left - right\n\n '*': (left, right) ->\n return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable\n```", "response": "return left + right({\n '-': function(left, right) {\n return left - right;\n },\n '*': function(left, right) {\n return left * right;\n },\n '/': function(left, right) {\n return left / right;\n }\n});\n\nmodule.exports = Variable;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 51, "line_end": 62} {"id": "gss/engine:src/Variable.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nreturn left + right({\n '-': function(left, right) {\n return left - right;\n },\n '*': function(left, right) {\n return left * right;\n },\n '/': function(left, right) {\n return left / right;\n }\n});\n\nmodule.exports = Variable;\n```", "response": "return left + right\n\n '-': (left, right) ->\n return left - right\n\n '*': (left, right) ->\n return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 51, "line_end": 62} {"id": "gss/engine:src/Variable.coffee:2:completion", "type": "completion", "prompt": "return left + right\n\n '-': (left, right) ->\n return left - right\n\n '*': (left, right) ->", "response": "return left * right\n\n '/': (left, right) ->\n return left / right\n\nmodule.exports = Variable", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/Variable.coffee", "license": "MIT", "commit": "6dae7b8e2f0918f6320f895965a8d2079eb0ce47", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/6dae7b8e2f0918f6320f895965a8d2079eb0ce47/src/Variable.coffee", "line_start": 51, "line_end": 62} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_while.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "i: 5\nlist: while i -= 1\n i * 2\n\nok list.join(' ') is \"8 6 4 2\"\n\n\ni: 5\nlist: (i * 3 while i -= 1)\n\nok list.join(' ') is \"12 9 6 3\"\n\n\ni: 5\nfunc: (num) -> i -= num\nassert: -> ok i < 5 > 0\n\nresults: while func 1\n assert()\n i\n\nok results.join(' ') is '4 3 2 1'\n\n\ni: 10\nresults: while i -= 1 when i % 2 is 0\n i * 2\n\nok results.join(' ') is '16 12 8 4'\n\n\nvalue: false\ni: 0\nresults: until value\n value: true if i is 5\n i += 1\n\nok i is 6", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/test/test_while.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_while.coffee", "line_start": 1, "line_end": 38} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_while.coffee:1:completion", "type": "completion", "prompt": "i: 5\nlist: while i -= 1\n i * 2\n\nok list.join(' ') is \"8 6 4 2\"\n\n\ni: 5\nlist: (i * 3 while i -= 1)\n\nok list.join(' ') is \"12 9 6 3\"\n\n\ni: 5\nfunc: (num) -> i -= num\nassert: -> ok i < 5 > 0\n\nresults: while func 1\n assert()", "response": "i\n\nok results.join(' ') is '4 3 2 1'\n\n\ni: 10\nresults: while i -= 1 when i % 2 is 0\n i * 2\n\nok results.join(' ') is '16 12 8 4'\n\n\nvalue: false\ni: 0\nresults: until value\n value: true if i is 5\n i += 1\n\nok i is 6", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/test/test_while.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_while.coffee", "line_start": 1, "line_end": 38} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/login.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "async = require 'async'\nErr = require 'err1st'\nBaseMailer = require './base'\nutil = require '../util'\nlogger = require '../components/logger'\n\nclass LoginMailer extends BaseMailer\n\n delay: 0\n action: 'send'\n template: 'login'\n\n send: (user) ->\n\n self = this\n\n email =\n id: \"login#{user._id}\"\n user: user\n to: user.emailForLogin\n subject: \"[简聊] 欢迎来到简聊\"\n\n email.redirectTip = '点击按钮访问简聊:'\n email.redirectBtnTip = '访问简聊'\n email.redirectUrl = util.buildIndexUrl()\n\n self._sendByRender email\n\nmodule.exports = new LoginMailer", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/login.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/login.coffee", "line_start": 1, "line_end": 29} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/login.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nasync = require 'async'\nErr = require 'err1st'\nBaseMailer = require './base'\nutil = require '../util'\nlogger = require '../components/logger'\n\nclass LoginMailer extends BaseMailer\n\n delay: 0\n action: 'send'\n template: 'login'\n\n send: (user) ->\n\n self = this\n\n email =\n id: \"login#{user._id}\"\n user: user\n to: user.emailForLogin\n subject: \"[简聊] 欢迎来到简聊\"\n\n email.redirectTip = '点击按钮访问简聊:'\n email.redirectBtnTip = '访问简聊'\n email.redirectUrl = util.buildIndexUrl()\n\n self._sendByRender email\n\nmodule.exports = new LoginMailer\n```", "response": "var BaseMailer, Err, LoginMailer, async, logger, util;\n\nasync = require('async');\n\nErr = require('err1st');\n\nBaseMailer = require('./base');\n\nutil = require('../util');\n\nlogger = require('../components/logger');\n\nLoginMailer = (function() {\n class LoginMailer extends BaseMailer {\n send(user) {\n var email, self;\n self = this;\n email = {\n id: `login${user._id}`,\n user: user,\n to: user.emailForLogin,\n subject: \"[简聊] 欢迎来到简聊\"\n };\n email.redirectTip = '点击按钮访问简聊:';\n email.redirectBtnTip = '访问简聊';\n email.redirectUrl = util.buildIndexUrl();\n return self._sendByRender(email);\n }\n\n };\n\n LoginMailer.prototype.delay = 0;\n\n LoginMailer.prototype.action = 'send';\n\n LoginMailer.prototype.template = 'login';\n\n return LoginMailer;\n\n}).call(this);\n\nmodule.exports = new LoginMailer();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/login.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/login.coffee", "line_start": 1, "line_end": 29} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/login.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar BaseMailer, Err, LoginMailer, async, logger, util;\n\nasync = require('async');\n\nErr = require('err1st');\n\nBaseMailer = require('./base');\n\nutil = require('../util');\n\nlogger = require('../components/logger');\n\nLoginMailer = (function() {\n class LoginMailer extends BaseMailer {\n send(user) {\n var email, self;\n self = this;\n email = {\n id: `login${user._id}`,\n user: user,\n to: user.emailForLogin,\n subject: \"[简聊] 欢迎来到简聊\"\n };\n email.redirectTip = '点击按钮访问简聊:';\n email.redirectBtnTip = '访问简聊';\n email.redirectUrl = util.buildIndexUrl();\n return self._sendByRender(email);\n }\n\n };\n\n LoginMailer.prototype.delay = 0;\n\n LoginMailer.prototype.action = 'send';\n\n LoginMailer.prototype.template = 'login';\n\n return LoginMailer;\n\n}).call(this);\n\nmodule.exports = new LoginMailer();\n```", "response": "async = require 'async'\nErr = require 'err1st'\nBaseMailer = require './base'\nutil = require '../util'\nlogger = require '../components/logger'\n\nclass LoginMailer extends BaseMailer\n\n delay: 0\n action: 'send'\n template: 'login'\n\n send: (user) ->\n\n self = this\n\n email =\n id: \"login#{user._id}\"\n user: user\n to: user.emailForLogin\n subject: \"[简聊] 欢迎来到简聊\"\n\n email.redirectTip = '点击按钮访问简聊:'\n email.redirectBtnTip = '访问简聊'\n email.redirectUrl = util.buildIndexUrl()\n\n self._sendByRender email\n\nmodule.exports = new LoginMailer", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/login.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/login.coffee", "line_start": 1, "line_end": 29} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/login.coffee:1:completion", "type": "completion", "prompt": "async = require 'async'\nErr = require 'err1st'\nBaseMailer = require './base'\nutil = require '../util'\nlogger = require '../components/logger'\n\nclass LoginMailer extends BaseMailer\n\n delay: 0\n action: 'send'\n template: 'login'\n\n send: (user) ->", "response": "self = this\n\n email =\n id: \"login#{user._id}\"\n user: user\n to: user.emailForLogin\n subject: \"[简聊] 欢迎来到简聊\"\n\n email.redirectTip = '点击按钮访问简聊:'\n email.redirectBtnTip = '访问简聊'\n email.redirectUrl = util.buildIndexUrl()\n\n self._sendByRender email\n\nmodule.exports = new LoginMailer", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/login.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/login.coffee", "line_start": 1, "line_end": 29} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\ntmp.delete()\ntmp.create()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 13} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\ntmp.delete()\ntmp.create()\n```", "response": "var fs, rimraf, tempDir, tmp;\n\nrimraf = require('rimraf');\n\nfs = require('fs');\n\ntempDir = process.env.SPEC_TEMP_DIR = `${process.cwd()}/tmp`;\n\nmodule.exports = tmp = {\n create: function() {\n if (!fs.existsSync(tempDir)) {\n return fs.mkdirSync(tempDir);\n }\n },\n delete: function() {\n if (fs.existsSync(tempDir)) {\n return rimraf.sync(process.env.SPEC_TEMP_DIR);\n }\n }\n};\n\ntmp.delete();\n\ntmp.create();", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 13} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs, rimraf, tempDir, tmp;\n\nrimraf = require('rimraf');\n\nfs = require('fs');\n\ntempDir = process.env.SPEC_TEMP_DIR = `${process.cwd()}/tmp`;\n\nmodule.exports = tmp = {\n create: function() {\n if (!fs.existsSync(tempDir)) {\n return fs.mkdirSync(tempDir);\n }\n },\n delete: function() {\n if (fs.existsSync(tempDir)) {\n return rimraf.sync(process.env.SPEC_TEMP_DIR);\n }\n }\n};\n\ntmp.delete();\n\ntmp.create();\n```", "response": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\ntmp.delete()\ntmp.create()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 13} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:completion", "type": "completion", "prompt": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->", "response": "fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\ntmp.delete()\ntmp.create()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 13} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n tmp.delete()\n tmp.create()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n tmp.delete()\n tmp.create()\n```", "response": "var fs, rimraf, tempDir, tmp;\n\nrimraf = require('rimraf');\n\nfs = require('fs');\n\ntempDir = process.env.SPEC_TEMP_DIR = `${process.cwd()}/tmp`;\n\nmodule.exports = tmp = {\n create: function() {\n if (!fs.existsSync(tempDir)) {\n return fs.mkdirSync(tempDir);\n }\n },\n delete: function() {\n if (fs.existsSync(tempDir)) {\n return rimraf.sync(process.env.SPEC_TEMP_DIR);\n }\n }\n};\n\nbeforeAll(function() {\n tmp.delete();\n return tmp.create();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs, rimraf, tempDir, tmp;\n\nrimraf = require('rimraf');\n\nfs = require('fs');\n\ntempDir = process.env.SPEC_TEMP_DIR = `${process.cwd()}/tmp`;\n\nmodule.exports = tmp = {\n create: function() {\n if (!fs.existsSync(tempDir)) {\n return fs.mkdirSync(tempDir);\n }\n },\n delete: function() {\n if (fs.existsSync(tempDir)) {\n return rimraf.sync(process.env.SPEC_TEMP_DIR);\n }\n }\n};\n\nbeforeAll(function() {\n tmp.delete();\n return tmp.create();\n});\n```", "response": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n tmp.delete()\n tmp.create()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:completion", "type": "completion", "prompt": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = tmp =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)", "response": "delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n tmp.delete()\n tmp.create()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "221e35f69b4221369ff5e5a124965a2991639339", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/221e35f69b4221369ff5e5a124965a2991639339/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = self =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n self.delete()\n self.create()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "ba9f6d686ebff975e7f826ce86624111d50f0691", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ba9f6d686ebff975e7f826ce86624111d50f0691/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = self =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n self.delete()\n self.create()\n```", "response": "var fs, rimraf, self, tempDir;\n\nrimraf = require('rimraf');\n\nfs = require('fs');\n\ntempDir = process.env.SPEC_TEMP_DIR = `${process.cwd()}/tmp`;\n\nmodule.exports = self = {\n create: function() {\n if (!fs.existsSync(tempDir)) {\n return fs.mkdirSync(tempDir);\n }\n },\n delete: function() {\n if (fs.existsSync(tempDir)) {\n return rimraf.sync(process.env.SPEC_TEMP_DIR);\n }\n }\n};\n\nbeforeAll(function() {\n self.delete();\n return self.create();\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "ba9f6d686ebff975e7f826ce86624111d50f0691", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ba9f6d686ebff975e7f826ce86624111d50f0691/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs, rimraf, self, tempDir;\n\nrimraf = require('rimraf');\n\nfs = require('fs');\n\ntempDir = process.env.SPEC_TEMP_DIR = `${process.cwd()}/tmp`;\n\nmodule.exports = self = {\n create: function() {\n if (!fs.existsSync(tempDir)) {\n return fs.mkdirSync(tempDir);\n }\n },\n delete: function() {\n if (fs.existsSync(tempDir)) {\n return rimraf.sync(process.env.SPEC_TEMP_DIR);\n }\n }\n};\n\nbeforeAll(function() {\n self.delete();\n return self.create();\n});\n```", "response": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = self =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)\n delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n self.delete()\n self.create()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "ba9f6d686ebff975e7f826ce86624111d50f0691", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ba9f6d686ebff975e7f826ce86624111d50f0691/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:test/spec-e2e/helpers/tmp.coffee:1:completion", "type": "completion", "prompt": "rimraf = require('rimraf')\nfs = require('fs')\ntempDir = process.env.SPEC_TEMP_DIR = \"#{process.cwd()}/tmp\"\n\nmodule.exports = self =\n create: ->\n fs.mkdirSync(tempDir) unless fs.existsSync(tempDir)", "response": "delete: ->\n if fs.existsSync(tempDir)\n rimraf.sync(process.env.SPEC_TEMP_DIR)\n\nbeforeAll ->\n self.delete()\n self.create()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "test/spec-e2e/helpers/tmp.coffee", "license": "MIT", "commit": "ba9f6d686ebff975e7f826ce86624111d50f0691", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ba9f6d686ebff975e7f826ce86624111d50f0691/test/spec-e2e/helpers/tmp.coffee", "line_start": 1, "line_end": 14} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class Vector\n\n\t### Adds two vectors and returns the product. ###\n\t@add: (v1, v2) ->\n\t\tnew Vector v1.x + v2.x, v1.y + v2.y\n\n\t### Subtracts v2 from v1 and returns the product. ###\n\t@sub: (v1, v2) ->\n\t\tnew Vector v1.x - v2.x, v1.y - v2.y\n\n\t### Projects one vector (v1) onto another (v2) ###\n\t@project: (v1, v2) ->\n\t\tv1.clone().scale ((v1.dot v2) / v1.magSq())\n\n\t### Creates a new Vector instance. ###\n\tconstructor: (@x = 0.0, @y = 0.0) ->\n\n\t### Sets the components of this vector. ###\n\tset: (@x, @y) ->\n\t\t@\n\n\t### Add a vector to this one. ###\n\tadd: (v) ->\n\t\t@x += v.x; @y += v.y; @\n\n\t### Subtracts a vector from this one. ###\n\tsub: (v) ->\n\t\t@x -= v.x; @y -= v.y; @\n\n\t### Scales this vector by a value. ###\n\tscale: (f) ->\n\t\t@x *= f; @y *= f; @\n\n\t### Computes the dot product between vectors. ###\n\tdot: (v) ->\n\t\t@x * v.x + @y * v.y\n\n\t### Computes the cross product between vectors. ###\n\tcross: (v) ->\n\t\t(@x * v.y) - (@y * v.x)\n\n\t### Computes the magnitude (length). ###\n\tmag: ->\n\t\tMath.sqrt @x*@x + @y*@y\n\n\t### Computes the squared magnitude (length). ###\n\tmagSq: ->\n\t\t@x*@x + @y*@y\n\n\t### Computes the distance to another vector. ###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 3, "line_end": 52} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass Vector\n\n\t### Adds two vectors and returns the product. ###\n\t@add: (v1, v2) ->\n\t\tnew Vector v1.x + v2.x, v1.y + v2.y\n\n\t### Subtracts v2 from v1 and returns the product. ###\n\t@sub: (v1, v2) ->\n\t\tnew Vector v1.x - v2.x, v1.y - v2.y\n\n\t### Projects one vector (v1) onto another (v2) ###\n\t@project: (v1, v2) ->\n\t\tv1.clone().scale ((v1.dot v2) / v1.magSq())\n\n\t### Creates a new Vector instance. ###\n\tconstructor: (@x = 0.0, @y = 0.0) ->\n\n\t### Sets the components of this vector. ###\n\tset: (@x, @y) ->\n\t\t@\n\n\t### Add a vector to this one. ###\n\tadd: (v) ->\n\t\t@x += v.x; @y += v.y; @\n\n\t### Subtracts a vector from this one. ###\n\tsub: (v) ->\n\t\t@x -= v.x; @y -= v.y; @\n\n\t### Scales this vector by a value. ###\n\tscale: (f) ->\n\t\t@x *= f; @y *= f; @\n\n\t### Computes the dot product between vectors. ###\n\tdot: (v) ->\n\t\t@x * v.x + @y * v.y\n\n\t### Computes the cross product between vectors. ###\n\tcross: (v) ->\n\t\t(@x * v.y) - (@y * v.x)\n\n\t### Computes the magnitude (length). ###\n\tmag: ->\n\t\tMath.sqrt @x*@x + @y*@y\n\n\t### Computes the squared magnitude (length). ###\n\tmagSq: ->\n\t\t@x*@x + @y*@y\n\n\t### Computes the distance to another vector. ###\n```", "response": "var Vector;\n\nVector = class Vector {\n /* Adds two vectors and returns the product. */\n static add(v1, v2) {\n return new Vector(v1.x + v2.x, v1.y + v2.y);\n }\n\n /* Subtracts v2 from v1 and returns the product. */\n static sub(v1, v2) {\n return new Vector(v1.x - v2.x, v1.y - v2.y);\n }\n\n /* Projects one vector (v1) onto another (v2) */\n static project(v1, v2) {\n return v1.clone().scale((v1.dot(v2)) / v1.magSq());\n }\n\n /* Creates a new Vector instance. */\n constructor(x = 0.0, y = 0.0) {\n this.x = x;\n this.y = y;\n }\n\n /* Sets the components of this vector. */\n set(x, y) {\n this.x = x;\n this.y = y;\n return this;\n }\n\n /* Add a vector to this one. */\n add(v) {\n this.x += v.x;\n this.y += v.y;\n return this;\n }\n\n /* Subtracts a vector from this one. */\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n return this;\n }\n\n /* Scales this vector by a value. */\n scale(f) {\n this.x *= f;\n this.y *= f;\n return this;\n }\n\n /* Computes the dot product between vectors. */\n dot(v) {\n return this.x * v.x + this.y * v.y;\n }\n\n /* Computes the cross product between vectors. */\n cross(v) {\n return (this.x * v.y) - (this.y * v.x);\n }\n\n /* Computes the magnitude (length). */\n mag() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n\n /* Computes the squared magnitude (length). */\n magSq() {\n return this.x * this.x + this.y * this.y;\n }\n\n};\n\n/* Computes the distance to another vector. */", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 3, "line_end": 52} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Vector;\n\nVector = class Vector {\n /* Adds two vectors and returns the product. */\n static add(v1, v2) {\n return new Vector(v1.x + v2.x, v1.y + v2.y);\n }\n\n /* Subtracts v2 from v1 and returns the product. */\n static sub(v1, v2) {\n return new Vector(v1.x - v2.x, v1.y - v2.y);\n }\n\n /* Projects one vector (v1) onto another (v2) */\n static project(v1, v2) {\n return v1.clone().scale((v1.dot(v2)) / v1.magSq());\n }\n\n /* Creates a new Vector instance. */\n constructor(x = 0.0, y = 0.0) {\n this.x = x;\n this.y = y;\n }\n\n /* Sets the components of this vector. */\n set(x, y) {\n this.x = x;\n this.y = y;\n return this;\n }\n\n /* Add a vector to this one. */\n add(v) {\n this.x += v.x;\n this.y += v.y;\n return this;\n }\n\n /* Subtracts a vector from this one. */\n sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n return this;\n }\n\n /* Scales this vector by a value. */\n scale(f) {\n this.x *= f;\n this.y *= f;\n return this;\n }\n\n /* Computes the dot product between vectors. */\n dot(v) {\n return this.x * v.x + this.y * v.y;\n }\n\n /* Computes the cross product between vectors. */\n cross(v) {\n return (this.x * v.y) - (this.y * v.x);\n }\n\n /* Computes the magnitude (length). */\n mag() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n\n /* Computes the squared magnitude (length). */\n magSq() {\n return this.x * this.x + this.y * this.y;\n }\n\n};\n\n/* Computes the distance to another vector. */\n```", "response": "class Vector\n\n\t### Adds two vectors and returns the product. ###\n\t@add: (v1, v2) ->\n\t\tnew Vector v1.x + v2.x, v1.y + v2.y\n\n\t### Subtracts v2 from v1 and returns the product. ###\n\t@sub: (v1, v2) ->\n\t\tnew Vector v1.x - v2.x, v1.y - v2.y\n\n\t### Projects one vector (v1) onto another (v2) ###\n\t@project: (v1, v2) ->\n\t\tv1.clone().scale ((v1.dot v2) / v1.magSq())\n\n\t### Creates a new Vector instance. ###\n\tconstructor: (@x = 0.0, @y = 0.0) ->\n\n\t### Sets the components of this vector. ###\n\tset: (@x, @y) ->\n\t\t@\n\n\t### Add a vector to this one. ###\n\tadd: (v) ->\n\t\t@x += v.x; @y += v.y; @\n\n\t### Subtracts a vector from this one. ###\n\tsub: (v) ->\n\t\t@x -= v.x; @y -= v.y; @\n\n\t### Scales this vector by a value. ###\n\tscale: (f) ->\n\t\t@x *= f; @y *= f; @\n\n\t### Computes the dot product between vectors. ###\n\tdot: (v) ->\n\t\t@x * v.x + @y * v.y\n\n\t### Computes the cross product between vectors. ###\n\tcross: (v) ->\n\t\t(@x * v.y) - (@y * v.x)\n\n\t### Computes the magnitude (length). ###\n\tmag: ->\n\t\tMath.sqrt @x*@x + @y*@y\n\n\t### Computes the squared magnitude (length). ###\n\tmagSq: ->\n\t\t@x*@x + @y*@y\n\n\t### Computes the distance to another vector. ###", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 3, "line_end": 52} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:1:completion", "type": "completion", "prompt": "class Vector\n\n\t### Adds two vectors and returns the product. ###\n\t@add: (v1, v2) ->\n\t\tnew Vector v1.x + v2.x, v1.y + v2.y\n\n\t### Subtracts v2 from v1 and returns the product. ###\n\t@sub: (v1, v2) ->\n\t\tnew Vector v1.x - v2.x, v1.y - v2.y\n\n\t### Projects one vector (v1) onto another (v2) ###\n\t@project: (v1, v2) ->\n\t\tv1.clone().scale ((v1.dot v2) / v1.magSq())\n\n\t### Creates a new Vector instance. ###\n\tconstructor: (@x = 0.0, @y = 0.0) ->\n\n\t### Sets the components of this vector. ###\n\tset: (@x, @y) ->\n\t\t@\n\n\t### Add a vector to this one. ###\n\tadd: (v) ->\n\t\t@x += v.x; @y += v.y; @", "response": "### Subtracts a vector from this one. ###\n\tsub: (v) ->\n\t\t@x -= v.x; @y -= v.y; @\n\n\t### Scales this vector by a value. ###\n\tscale: (f) ->\n\t\t@x *= f; @y *= f; @\n\n\t### Computes the dot product between vectors. ###\n\tdot: (v) ->\n\t\t@x * v.x + @y * v.y\n\n\t### Computes the cross product between vectors. ###\n\tcross: (v) ->\n\t\t(@x * v.y) - (@y * v.x)\n\n\t### Computes the magnitude (length). ###\n\tmag: ->\n\t\tMath.sqrt @x*@x + @y*@y\n\n\t### Computes the squared magnitude (length). ###\n\tmagSq: ->\n\t\t@x*@x + @y*@y\n\n\t### Computes the distance to another vector. ###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 3, "line_end": 52} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "dist: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tMath.sqrt dx*dx + dy*dy\n\n\t### Computes the squared distance to another vector. ###\n\tdistSq: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tdx*dx + dy*dy\n\n\t### Normalises the vector, making it a unit vector (of length 1). ###\n\tnorm: ->\n\t\tm = Math.sqrt @x*@x + @y*@y\n\t\t@x /= m\n\t\t@y /= m\n\t\t@\n\n\t### Limits the vector length to a given amount. ###\n\tlimit: (l) ->\n\t\tmSq = @x*@x + @y*@y\n\t\tif mSq > l*l\n\t\t\tm = Math.sqrt mSq\n\t\t\t@x /= m; @y /= m\n\t\t\t@x *= l; @y *= l\n\t\t\t@\n\n\t### Copies components from another vector. ###\n\tcopy: (v) ->\n\t\t@x = v.x; @y = v.y; @\n\n\t### Clones this vector to a new itentical one. ###\n\tclone: ->\n\t\tnew Vector @x, @y\n\n\t### Resets the vector to zero. ###\n\tclear: ->\n\t\t@x = 0.0; @y = 0.0; @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 53, "line_end": 88} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndist: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tMath.sqrt dx*dx + dy*dy\n\n\t### Computes the squared distance to another vector. ###\n\tdistSq: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tdx*dx + dy*dy\n\n\t### Normalises the vector, making it a unit vector (of length 1). ###\n\tnorm: ->\n\t\tm = Math.sqrt @x*@x + @y*@y\n\t\t@x /= m\n\t\t@y /= m\n\t\t@\n\n\t### Limits the vector length to a given amount. ###\n\tlimit: (l) ->\n\t\tmSq = @x*@x + @y*@y\n\t\tif mSq > l*l\n\t\t\tm = Math.sqrt mSq\n\t\t\t@x /= m; @y /= m\n\t\t\t@x *= l; @y *= l\n\t\t\t@\n\n\t### Copies components from another vector. ###\n\tcopy: (v) ->\n\t\t@x = v.x; @y = v.y; @\n\n\t### Clones this vector to a new itentical one. ###\n\tclone: ->\n\t\tnew Vector @x, @y\n\n\t### Resets the vector to zero. ###\n\tclear: ->\n\t\t@x = 0.0; @y = 0.0; @\n```", "response": "({\n dist: function(v) {\n var dx, dy;\n dx = v.x - this.x;\n dy = v.y - this.y;\n return Math.sqrt(dx * dx + dy * dy);\n },\n /* Computes the squared distance to another vector. */\n distSq: function(v) {\n var dx, dy;\n dx = v.x - this.x;\n dy = v.y - this.y;\n return dx * dx + dy * dy;\n },\n /* Normalises the vector, making it a unit vector (of length 1). */\n norm: function() {\n var m;\n m = Math.sqrt(this.x * this.x + this.y * this.y);\n this.x /= m;\n this.y /= m;\n return this;\n },\n /* Limits the vector length to a given amount. */\n limit: function(l) {\n var m, mSq;\n mSq = this.x * this.x + this.y * this.y;\n if (mSq > l * l) {\n m = Math.sqrt(mSq);\n this.x /= m;\n this.y /= m;\n this.x *= l;\n this.y *= l;\n return this;\n }\n },\n /* Copies components from another vector. */\n copy: function(v) {\n this.x = v.x;\n this.y = v.y;\n return this;\n },\n /* Clones this vector to a new itentical one. */\n clone: function() {\n return new Vector(this.x, this.y);\n },\n /* Resets the vector to zero. */\n clear: function() {\n this.x = 0.0;\n this.y = 0.0;\n return this;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 53, "line_end": 88} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n dist: function(v) {\n var dx, dy;\n dx = v.x - this.x;\n dy = v.y - this.y;\n return Math.sqrt(dx * dx + dy * dy);\n },\n /* Computes the squared distance to another vector. */\n distSq: function(v) {\n var dx, dy;\n dx = v.x - this.x;\n dy = v.y - this.y;\n return dx * dx + dy * dy;\n },\n /* Normalises the vector, making it a unit vector (of length 1). */\n norm: function() {\n var m;\n m = Math.sqrt(this.x * this.x + this.y * this.y);\n this.x /= m;\n this.y /= m;\n return this;\n },\n /* Limits the vector length to a given amount. */\n limit: function(l) {\n var m, mSq;\n mSq = this.x * this.x + this.y * this.y;\n if (mSq > l * l) {\n m = Math.sqrt(mSq);\n this.x /= m;\n this.y /= m;\n this.x *= l;\n this.y *= l;\n return this;\n }\n },\n /* Copies components from another vector. */\n copy: function(v) {\n this.x = v.x;\n this.y = v.y;\n return this;\n },\n /* Clones this vector to a new itentical one. */\n clone: function() {\n return new Vector(this.x, this.y);\n },\n /* Resets the vector to zero. */\n clear: function() {\n this.x = 0.0;\n this.y = 0.0;\n return this;\n }\n});\n```", "response": "dist: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tMath.sqrt dx*dx + dy*dy\n\n\t### Computes the squared distance to another vector. ###\n\tdistSq: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tdx*dx + dy*dy\n\n\t### Normalises the vector, making it a unit vector (of length 1). ###\n\tnorm: ->\n\t\tm = Math.sqrt @x*@x + @y*@y\n\t\t@x /= m\n\t\t@y /= m\n\t\t@\n\n\t### Limits the vector length to a given amount. ###\n\tlimit: (l) ->\n\t\tmSq = @x*@x + @y*@y\n\t\tif mSq > l*l\n\t\t\tm = Math.sqrt mSq\n\t\t\t@x /= m; @y /= m\n\t\t\t@x *= l; @y *= l\n\t\t\t@\n\n\t### Copies components from another vector. ###\n\tcopy: (v) ->\n\t\t@x = v.x; @y = v.y; @\n\n\t### Clones this vector to a new itentical one. ###\n\tclone: ->\n\t\tnew Vector @x, @y\n\n\t### Resets the vector to zero. ###\n\tclear: ->\n\t\t@x = 0.0; @y = 0.0; @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 53, "line_end": 88} {"id": "soulwire/Coffee-Physics:source/math/Vector.coffee:2:completion", "type": "completion", "prompt": "dist: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tMath.sqrt dx*dx + dy*dy\n\n\t### Computes the squared distance to another vector. ###\n\tdistSq: (v) ->\n\t\tdx = v.x - @x; dy = v.y - @y\n\t\tdx*dx + dy*dy\n\n\t### Normalises the vector, making it a unit vector (of length 1). ###\n\tnorm: ->\n\t\tm = Math.sqrt @x*@x + @y*@y\n\t\t@x /= m\n\t\t@y /= m\n\t\t@\n\n\t### Limits the vector length to a given amount. ###\n\tlimit: (l) ->", "response": "mSq = @x*@x + @y*@y\n\t\tif mSq > l*l\n\t\t\tm = Math.sqrt mSq\n\t\t\t@x /= m; @y /= m\n\t\t\t@x *= l; @y *= l\n\t\t\t@\n\n\t### Copies components from another vector. ###\n\tcopy: (v) ->\n\t\t@x = v.x; @y = v.y; @\n\n\t### Clones this vector to a new itentical one. ###\n\tclone: ->\n\t\tnew Vector @x, @y\n\n\t### Resets the vector to zero. ###\n\tclear: ->\n\t\t@x = 0.0; @y = 0.0; @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soulwire/Coffee-Physics", "path": "source/math/Vector.coffee", "license": "MIT", "commit": "df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d", "stars": 1053, "source_url": "https://github.com/soulwire/Coffee-Physics/blob/df9d43d3153dfc6a734fef1b24eb5a90c2c61e4d/source/math/Vector.coffee", "line_start": 53, "line_end": 88} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->\n route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.hashedToken'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "27f885b12b32f43da9499daaa4c3836138f0ab9e", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->\n route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.hashedToken'\n```", "response": "if (Meteor.isServer) {\n describe('A route', function() {\n it('can be constructed with options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-1', {\n authRequired: true,\n roleRequired: ['admin', 'dev']\n }, {\n get: function() {\n return 'GET test-route-1';\n }\n });\n test.equal(route.path, 'test-route-1');\n test.isTrue(route.options.authRequired);\n test.isTrue(_.contains(route.options.roleRequired, 'admin'));\n test.isTrue(_.contains(route.options.roleRequired, 'dev'));\n return test.equal(route.endpoints.get(), 'GET test-route-1');\n });\n it('can be constructed without options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-2', {\n get: function() {\n return 'GET test-route-2';\n }\n });\n test.equal(route.path, 'test-route-2');\n return test.equal(route.endpoints.get(), 'GET test-route-2');\n });\n it('should support endpoints for all HTTP methods', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-3', {\n get: function() {\n return 'GET test-route-2';\n },\n post: function() {\n return 'POST test-route-2';\n },\n put: function() {\n return 'PUT test-route-2';\n },\n patch: function() {\n return 'PATCH test-route-2';\n },\n delete: function() {\n return 'DELETE test-route-2';\n },\n options: function() {\n return 'OPTIONS test-route-2';\n }\n });\n test.equal(route.endpoints.get(), 'GET test-route-2');\n test.equal(route.endpoints.post(), 'POST test-route-2');\n test.equal(route.endpoints.put(), 'PUT test-route-2');\n test.equal(route.endpoints.patch(), 'PATCH test-route-2');\n test.equal(route.endpoints.delete(), 'DELETE test-route-2');\n return test.equal(route.endpoints.options(), 'OPTIONS test-route-2');\n });\n return context('that\\'s initialized without options', function() {\n return it('should have the default configuration', function(test) {\n test.equal(Restivus.config.apiPath, 'api/');\n test.isFalse(Restivus.config.useAuth);\n test.isFalse(Restivus.config.prettyJson);\n return test.equal(Restivus.config.auth.token, 'services.resume.loginTokens.hashedToken');\n });\n });\n });\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "27f885b12b32f43da9499daaa4c3836138f0ab9e", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (Meteor.isServer) {\n describe('A route', function() {\n it('can be constructed with options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-1', {\n authRequired: true,\n roleRequired: ['admin', 'dev']\n }, {\n get: function() {\n return 'GET test-route-1';\n }\n });\n test.equal(route.path, 'test-route-1');\n test.isTrue(route.options.authRequired);\n test.isTrue(_.contains(route.options.roleRequired, 'admin'));\n test.isTrue(_.contains(route.options.roleRequired, 'dev'));\n return test.equal(route.endpoints.get(), 'GET test-route-1');\n });\n it('can be constructed without options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-2', {\n get: function() {\n return 'GET test-route-2';\n }\n });\n test.equal(route.path, 'test-route-2');\n return test.equal(route.endpoints.get(), 'GET test-route-2');\n });\n it('should support endpoints for all HTTP methods', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-3', {\n get: function() {\n return 'GET test-route-2';\n },\n post: function() {\n return 'POST test-route-2';\n },\n put: function() {\n return 'PUT test-route-2';\n },\n patch: function() {\n return 'PATCH test-route-2';\n },\n delete: function() {\n return 'DELETE test-route-2';\n },\n options: function() {\n return 'OPTIONS test-route-2';\n }\n });\n test.equal(route.endpoints.get(), 'GET test-route-2');\n test.equal(route.endpoints.post(), 'POST test-route-2');\n test.equal(route.endpoints.put(), 'PUT test-route-2');\n test.equal(route.endpoints.patch(), 'PATCH test-route-2');\n test.equal(route.endpoints.delete(), 'DELETE test-route-2');\n return test.equal(route.endpoints.options(), 'OPTIONS test-route-2');\n });\n return context('that\\'s initialized without options', function() {\n return it('should have the default configuration', function(test) {\n test.equal(Restivus.config.apiPath, 'api/');\n test.isFalse(Restivus.config.useAuth);\n test.isFalse(Restivus.config.prettyJson);\n return test.equal(Restivus.config.auth.token, 'services.resume.loginTokens.hashedToken');\n });\n });\n });\n}\n```", "response": "if Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->\n route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.hashedToken'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "27f885b12b32f43da9499daaa4c3836138f0ab9e", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:completion", "type": "completion", "prompt": "if Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->", "response": "route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.hashedToken'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "27f885b12b32f43da9499daaa4c3836138f0ab9e", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->\n route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.token'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "925b8ff7ee757da89d6f18bc284ab981b48846fa", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->\n route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.token'\n```", "response": "if (Meteor.isServer) {\n describe('A route', function() {\n it('can be constructed with options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-1', {\n authRequired: true,\n roleRequired: ['admin', 'dev']\n }, {\n get: function() {\n return 'GET test-route-1';\n }\n });\n test.equal(route.path, 'test-route-1');\n test.isTrue(route.options.authRequired);\n test.isTrue(_.contains(route.options.roleRequired, 'admin'));\n test.isTrue(_.contains(route.options.roleRequired, 'dev'));\n return test.equal(route.endpoints.get(), 'GET test-route-1');\n });\n it('can be constructed without options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-2', {\n get: function() {\n return 'GET test-route-2';\n }\n });\n test.equal(route.path, 'test-route-2');\n return test.equal(route.endpoints.get(), 'GET test-route-2');\n });\n it('should support endpoints for all HTTP methods', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-3', {\n get: function() {\n return 'GET test-route-2';\n },\n post: function() {\n return 'POST test-route-2';\n },\n put: function() {\n return 'PUT test-route-2';\n },\n patch: function() {\n return 'PATCH test-route-2';\n },\n delete: function() {\n return 'DELETE test-route-2';\n },\n options: function() {\n return 'OPTIONS test-route-2';\n }\n });\n test.equal(route.endpoints.get(), 'GET test-route-2');\n test.equal(route.endpoints.post(), 'POST test-route-2');\n test.equal(route.endpoints.put(), 'PUT test-route-2');\n test.equal(route.endpoints.patch(), 'PATCH test-route-2');\n test.equal(route.endpoints.delete(), 'DELETE test-route-2');\n return test.equal(route.endpoints.options(), 'OPTIONS test-route-2');\n });\n return context('that\\'s initialized without options', function() {\n return it('should have the default configuration', function(test) {\n test.equal(Restivus.config.apiPath, 'api/');\n test.isFalse(Restivus.config.useAuth);\n test.isFalse(Restivus.config.prettyJson);\n return test.equal(Restivus.config.auth.token, 'services.resume.loginTokens.token');\n });\n });\n });\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "925b8ff7ee757da89d6f18bc284ab981b48846fa", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (Meteor.isServer) {\n describe('A route', function() {\n it('can be constructed with options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-1', {\n authRequired: true,\n roleRequired: ['admin', 'dev']\n }, {\n get: function() {\n return 'GET test-route-1';\n }\n });\n test.equal(route.path, 'test-route-1');\n test.isTrue(route.options.authRequired);\n test.isTrue(_.contains(route.options.roleRequired, 'admin'));\n test.isTrue(_.contains(route.options.roleRequired, 'dev'));\n return test.equal(route.endpoints.get(), 'GET test-route-1');\n });\n it('can be constructed without options', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-2', {\n get: function() {\n return 'GET test-route-2';\n }\n });\n test.equal(route.path, 'test-route-2');\n return test.equal(route.endpoints.get(), 'GET test-route-2');\n });\n it('should support endpoints for all HTTP methods', function(test) {\n var route;\n route = new this.Route(new this.Restivus(), 'test-route-3', {\n get: function() {\n return 'GET test-route-2';\n },\n post: function() {\n return 'POST test-route-2';\n },\n put: function() {\n return 'PUT test-route-2';\n },\n patch: function() {\n return 'PATCH test-route-2';\n },\n delete: function() {\n return 'DELETE test-route-2';\n },\n options: function() {\n return 'OPTIONS test-route-2';\n }\n });\n test.equal(route.endpoints.get(), 'GET test-route-2');\n test.equal(route.endpoints.post(), 'POST test-route-2');\n test.equal(route.endpoints.put(), 'PUT test-route-2');\n test.equal(route.endpoints.patch(), 'PATCH test-route-2');\n test.equal(route.endpoints.delete(), 'DELETE test-route-2');\n return test.equal(route.endpoints.options(), 'OPTIONS test-route-2');\n });\n return context('that\\'s initialized without options', function() {\n return it('should have the default configuration', function(test) {\n test.equal(Restivus.config.apiPath, 'api/');\n test.isFalse(Restivus.config.useAuth);\n test.isFalse(Restivus.config.prettyJson);\n return test.equal(Restivus.config.auth.token, 'services.resume.loginTokens.token');\n });\n });\n });\n}\n```", "response": "if Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->\n route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.token'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "925b8ff7ee757da89d6f18bc284ab981b48846fa", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "kahmali/meteor-restivus:test/route_tests.coffee:1:completion", "type": "completion", "prompt": "if Meteor.isServer\n\n describe 'A route', ->\n\n it 'can be constructed with options', (test) ->\n route = new @Route new @Restivus, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},\n get: -> 'GET test-route-1'\n\n test.equal route.path, 'test-route-1'\n test.isTrue route.options.authRequired\n test.isTrue _.contains(route.options.roleRequired, 'admin')\n test.isTrue _.contains(route.options.roleRequired, 'dev')\n test.equal route.endpoints.get(), 'GET test-route-1'\n\n it 'can be constructed without options', (test) ->\n route = new @Route new @Restivus, 'test-route-2',\n get: -> 'GET test-route-2'\n\n test.equal route.path, 'test-route-2'\n test.equal route.endpoints.get(), 'GET test-route-2'\n\n it 'should support endpoints for all HTTP methods', (test) ->", "response": "route = new @Route new @Restivus, 'test-route-3',\n get: -> 'GET test-route-2'\n post: -> 'POST test-route-2'\n put: -> 'PUT test-route-2'\n patch: -> 'PATCH test-route-2'\n delete: -> 'DELETE test-route-2'\n options: -> 'OPTIONS test-route-2'\n\n test.equal route.endpoints.get(), 'GET test-route-2'\n test.equal route.endpoints.post(), 'POST test-route-2'\n test.equal route.endpoints.put(), 'PUT test-route-2'\n test.equal route.endpoints.patch(), 'PATCH test-route-2'\n test.equal route.endpoints.delete(), 'DELETE test-route-2'\n test.equal route.endpoints.options(), 'OPTIONS test-route-2'\n\n\n context 'that\\'s initialized without options', ->\n it 'should have the default configuration', (test) ->\n test.equal Restivus.config.apiPath, 'api/'\n test.isFalse Restivus.config.useAuth\n test.isFalse Restivus.config.prettyJson\n test.equal Restivus.config.auth.token, 'services.resume.loginTokens.token'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "kahmali/meteor-restivus", "path": "test/route_tests.coffee", "license": "MIT", "commit": "925b8ff7ee757da89d6f18bc284ab981b48846fa", "stars": 541, "source_url": "https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/route_tests.coffee", "line_start": 1, "line_end": 44} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "objectDiff = (obj1, obj2, options = {}) ->\n result = {}\n score = 0\n\n for own key, value1 of obj1 when !(key of obj2)\n result[\"#{key}__deleted\"] = value1\n score -= 30\n\n for own key, value2 of obj2 when !(key of obj1)\n result[\"#{key}__added\"] = value2\n score -= 30\n\n for own key, value1 of obj1 when key of obj2\n score += 20\n value2 = obj2[key]\n [subscore, change] = diffWithScore(value1, value2, options)\n if change\n result[key] = change\n else\n result[key] = value1\n # console.log \"key #{key} subscore=#{subscore} #{value1}\"\n score += Math.min(20, Math.max(-10, subscore / 5)) # BATMAN!\n\n if Object.keys(result).length is 0\n [score, result] = [100 * Math.max(Object.keys(obj1).length, 0.5), undefined]\n else\n score = Math.max(0, score)\n\n # console.log \"objectDiff(#{JSON.stringify(obj1, null, 2)} <=> #{JSON.stringify(obj2, null, 2)}) == #{JSON.stringify([score, result])}\"\n\n return [score, result]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 8, "line_end": 38} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nobjectDiff = (obj1, obj2, options = {}) ->\n result = {}\n score = 0\n\n for own key, value1 of obj1 when !(key of obj2)\n result[\"#{key}__deleted\"] = value1\n score -= 30\n\n for own key, value2 of obj2 when !(key of obj1)\n result[\"#{key}__added\"] = value2\n score -= 30\n\n for own key, value1 of obj1 when key of obj2\n score += 20\n value2 = obj2[key]\n [subscore, change] = diffWithScore(value1, value2, options)\n if change\n result[key] = change\n else\n result[key] = value1\n # console.log \"key #{key} subscore=#{subscore} #{value1}\"\n score += Math.min(20, Math.max(-10, subscore / 5)) # BATMAN!\n\n if Object.keys(result).length is 0\n [score, result] = [100 * Math.max(Object.keys(obj1).length, 0.5), undefined]\n else\n score = Math.max(0, score)\n\n # console.log \"objectDiff(#{JSON.stringify(obj1, null, 2)} <=> #{JSON.stringify(obj2, null, 2)}) == #{JSON.stringify([score, result])}\"\n\n return [score, result]\n```", "response": "var objectDiff,\n hasProp = {}.hasOwnProperty;\n\nobjectDiff = function(obj1, obj2, options = {}) {\n var change, key, result, score, subscore, value1, value2;\n result = {};\n score = 0;\n for (key in obj1) {\n if (!hasProp.call(obj1, key)) continue;\n value1 = obj1[key];\n if (!(!(key in obj2))) {\n continue;\n }\n result[`${key}__deleted`] = value1;\n score -= 30;\n }\n for (key in obj2) {\n if (!hasProp.call(obj2, key)) continue;\n value2 = obj2[key];\n if (!(!(key in obj1))) {\n continue;\n }\n result[`${key}__added`] = value2;\n score -= 30;\n }\n for (key in obj1) {\n if (!hasProp.call(obj1, key)) continue;\n value1 = obj1[key];\n if (!(key in obj2)) {\n continue;\n }\n score += 20;\n value2 = obj2[key];\n [subscore, change] = diffWithScore(value1, value2, options);\n if (change) {\n result[key] = change;\n } else {\n result[key] = value1;\n }\n // console.log \"key #{key} subscore=#{subscore} #{value1}\"\n score += Math.min(20, Math.max(-10, subscore / 5)); // BATMAN!\n }\n if (Object.keys(result).length === 0) {\n [score, result] = [100 * Math.max(Object.keys(obj1).length, 0.5), void 0];\n } else {\n score = Math.max(0, score);\n }\n // console.log \"objectDiff(#{JSON.stringify(obj1, null, 2)} <=> #{JSON.stringify(obj2, null, 2)}) == #{JSON.stringify([score, result])}\"\n return [score, result];\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 8, "line_end": 38} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar objectDiff,\n hasProp = {}.hasOwnProperty;\n\nobjectDiff = function(obj1, obj2, options = {}) {\n var change, key, result, score, subscore, value1, value2;\n result = {};\n score = 0;\n for (key in obj1) {\n if (!hasProp.call(obj1, key)) continue;\n value1 = obj1[key];\n if (!(!(key in obj2))) {\n continue;\n }\n result[`${key}__deleted`] = value1;\n score -= 30;\n }\n for (key in obj2) {\n if (!hasProp.call(obj2, key)) continue;\n value2 = obj2[key];\n if (!(!(key in obj1))) {\n continue;\n }\n result[`${key}__added`] = value2;\n score -= 30;\n }\n for (key in obj1) {\n if (!hasProp.call(obj1, key)) continue;\n value1 = obj1[key];\n if (!(key in obj2)) {\n continue;\n }\n score += 20;\n value2 = obj2[key];\n [subscore, change] = diffWithScore(value1, value2, options);\n if (change) {\n result[key] = change;\n } else {\n result[key] = value1;\n }\n // console.log \"key #{key} subscore=#{subscore} #{value1}\"\n score += Math.min(20, Math.max(-10, subscore / 5)); // BATMAN!\n }\n if (Object.keys(result).length === 0) {\n [score, result] = [100 * Math.max(Object.keys(obj1).length, 0.5), void 0];\n } else {\n score = Math.max(0, score);\n }\n // console.log \"objectDiff(#{JSON.stringify(obj1, null, 2)} <=> #{JSON.stringify(obj2, null, 2)}) == #{JSON.stringify([score, result])}\"\n return [score, result];\n};\n```", "response": "objectDiff = (obj1, obj2, options = {}) ->\n result = {}\n score = 0\n\n for own key, value1 of obj1 when !(key of obj2)\n result[\"#{key}__deleted\"] = value1\n score -= 30\n\n for own key, value2 of obj2 when !(key of obj1)\n result[\"#{key}__added\"] = value2\n score -= 30\n\n for own key, value1 of obj1 when key of obj2\n score += 20\n value2 = obj2[key]\n [subscore, change] = diffWithScore(value1, value2, options)\n if change\n result[key] = change\n else\n result[key] = value1\n # console.log \"key #{key} subscore=#{subscore} #{value1}\"\n score += Math.min(20, Math.max(-10, subscore / 5)) # BATMAN!\n\n if Object.keys(result).length is 0\n [score, result] = [100 * Math.max(Object.keys(obj1).length, 0.5), undefined]\n else\n score = Math.max(0, score)\n\n # console.log \"objectDiff(#{JSON.stringify(obj1, null, 2)} <=> #{JSON.stringify(obj2, null, 2)}) == #{JSON.stringify([score, result])}\"\n\n return [score, result]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 8, "line_end": 38} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:2:completion", "type": "completion", "prompt": "objectDiff = (obj1, obj2, options = {}) ->\n result = {}\n score = 0\n\n for own key, value1 of obj1 when !(key of obj2)\n result[\"#{key}__deleted\"] = value1\n score -= 30\n\n for own key, value2 of obj2 when !(key of obj1)\n result[\"#{key}__added\"] = value2\n score -= 30\n\n for own key, value1 of obj1 when key of obj2\n score += 20\n value2 = obj2[key]", "response": "[subscore, change] = diffWithScore(value1, value2, options)\n if change\n result[key] = change\n else\n result[key] = value1\n # console.log \"key #{key} subscore=#{subscore} #{value1}\"\n score += Math.min(20, Math.max(-10, subscore / 5)) # BATMAN!\n\n if Object.keys(result).length is 0\n [score, result] = [100 * Math.max(Object.keys(obj1).length, 0.5), undefined]\n else\n score = Math.max(0, score)\n\n # console.log \"objectDiff(#{JSON.stringify(obj1, null, 2)} <=> #{JSON.stringify(obj2, null, 2)}) == #{JSON.stringify([score, result])}\"\n\n return [score, result]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 8, "line_end": 38} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "findMatchingObject = (item, index, fuzzyOriginals) ->\n # console.log \"findMatchingObject: \" + JSON.stringify({item, fuzzyOriginals}, null, 2)\n bestMatch = null\n\n matchIndex = 0\n for own key, candidate of fuzzyOriginals when key isnt '__next'\n indexDistance = Math.abs(matchIndex - index)\n if extendedTypeOf(item) == extendedTypeOf(candidate)\n score = diffScore(item, candidate)\n if !bestMatch || score > bestMatch.score || (score == bestMatch.score && indexDistance < bestMatch.indexDistance)\n bestMatch = { score, key, indexDistance }\n matchIndex++\n\n # console.log \"findMatchingObject result = \" + JSON.stringify(bestMatch, null, 2)\n bestMatch", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 41, "line_end": 55} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfindMatchingObject = (item, index, fuzzyOriginals) ->\n # console.log \"findMatchingObject: \" + JSON.stringify({item, fuzzyOriginals}, null, 2)\n bestMatch = null\n\n matchIndex = 0\n for own key, candidate of fuzzyOriginals when key isnt '__next'\n indexDistance = Math.abs(matchIndex - index)\n if extendedTypeOf(item) == extendedTypeOf(candidate)\n score = diffScore(item, candidate)\n if !bestMatch || score > bestMatch.score || (score == bestMatch.score && indexDistance < bestMatch.indexDistance)\n bestMatch = { score, key, indexDistance }\n matchIndex++\n\n # console.log \"findMatchingObject result = \" + JSON.stringify(bestMatch, null, 2)\n bestMatch\n```", "response": "var findMatchingObject,\n hasProp = {}.hasOwnProperty;\n\nfindMatchingObject = function(item, index, fuzzyOriginals) {\n var bestMatch, candidate, indexDistance, key, matchIndex, score;\n // console.log \"findMatchingObject: \" + JSON.stringify({item, fuzzyOriginals}, null, 2)\n bestMatch = null;\n matchIndex = 0;\n for (key in fuzzyOriginals) {\n if (!hasProp.call(fuzzyOriginals, key)) continue;\n candidate = fuzzyOriginals[key];\n if (!(key !== '__next')) {\n continue;\n }\n indexDistance = Math.abs(matchIndex - index);\n if (extendedTypeOf(item) === extendedTypeOf(candidate)) {\n score = diffScore(item, candidate);\n if (!bestMatch || score > bestMatch.score || (score === bestMatch.score && indexDistance < bestMatch.indexDistance)) {\n bestMatch = {score, key, indexDistance};\n }\n }\n matchIndex++;\n }\n // console.log \"findMatchingObject result = \" + JSON.stringify(bestMatch, null, 2)\n return bestMatch;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 41, "line_end": 55} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findMatchingObject,\n hasProp = {}.hasOwnProperty;\n\nfindMatchingObject = function(item, index, fuzzyOriginals) {\n var bestMatch, candidate, indexDistance, key, matchIndex, score;\n // console.log \"findMatchingObject: \" + JSON.stringify({item, fuzzyOriginals}, null, 2)\n bestMatch = null;\n matchIndex = 0;\n for (key in fuzzyOriginals) {\n if (!hasProp.call(fuzzyOriginals, key)) continue;\n candidate = fuzzyOriginals[key];\n if (!(key !== '__next')) {\n continue;\n }\n indexDistance = Math.abs(matchIndex - index);\n if (extendedTypeOf(item) === extendedTypeOf(candidate)) {\n score = diffScore(item, candidate);\n if (!bestMatch || score > bestMatch.score || (score === bestMatch.score && indexDistance < bestMatch.indexDistance)) {\n bestMatch = {score, key, indexDistance};\n }\n }\n matchIndex++;\n }\n // console.log \"findMatchingObject result = \" + JSON.stringify(bestMatch, null, 2)\n return bestMatch;\n};\n```", "response": "findMatchingObject = (item, index, fuzzyOriginals) ->\n # console.log \"findMatchingObject: \" + JSON.stringify({item, fuzzyOriginals}, null, 2)\n bestMatch = null\n\n matchIndex = 0\n for own key, candidate of fuzzyOriginals when key isnt '__next'\n indexDistance = Math.abs(matchIndex - index)\n if extendedTypeOf(item) == extendedTypeOf(candidate)\n score = diffScore(item, candidate)\n if !bestMatch || score > bestMatch.score || (score == bestMatch.score && indexDistance < bestMatch.indexDistance)\n bestMatch = { score, key, indexDistance }\n matchIndex++\n\n # console.log \"findMatchingObject result = \" + JSON.stringify(bestMatch, null, 2)\n bestMatch", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 41, "line_end": 55} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:3:completion", "type": "completion", "prompt": "findMatchingObject = (item, index, fuzzyOriginals) ->\n # console.log \"findMatchingObject: \" + JSON.stringify({item, fuzzyOriginals}, null, 2)\n bestMatch = null\n\n matchIndex = 0\n for own key, candidate of fuzzyOriginals when key isnt '__next'\n indexDistance = Math.abs(matchIndex - index)", "response": "if extendedTypeOf(item) == extendedTypeOf(candidate)\n score = diffScore(item, candidate)\n if !bestMatch || score > bestMatch.score || (score == bestMatch.score && indexDistance < bestMatch.indexDistance)\n bestMatch = { score, key, indexDistance }\n matchIndex++\n\n # console.log \"findMatchingObject result = \" + JSON.stringify(bestMatch, null, 2)\n bestMatch", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 41, "line_end": 55} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "scalarize = (array, originals, fuzzyOriginals) ->\n fuzzyMatches = []\n if fuzzyOriginals\n # Find best fuzzy match for each object in the array\n keyScores = {}\n for item, index in array\n if isScalar item\n continue\n bestMatch = findMatchingObject(item, index, fuzzyOriginals)\n if !keyScores[bestMatch.key] || bestMatch.score > keyScores[bestMatch.key].score\n keyScores[bestMatch.key] = {score: bestMatch.score, index}\n for key, match of keyScores\n fuzzyMatches[match.index] = key\n\n for item, index in array\n if isScalar item\n item\n else\n key = fuzzyMatches[index] || \"__$!SCALAR\" + originals.__next++\n originals[key] = item\n key", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 58, "line_end": 78} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nscalarize = (array, originals, fuzzyOriginals) ->\n fuzzyMatches = []\n if fuzzyOriginals\n # Find best fuzzy match for each object in the array\n keyScores = {}\n for item, index in array\n if isScalar item\n continue\n bestMatch = findMatchingObject(item, index, fuzzyOriginals)\n if !keyScores[bestMatch.key] || bestMatch.score > keyScores[bestMatch.key].score\n keyScores[bestMatch.key] = {score: bestMatch.score, index}\n for key, match of keyScores\n fuzzyMatches[match.index] = key\n\n for item, index in array\n if isScalar item\n item\n else\n key = fuzzyMatches[index] || \"__$!SCALAR\" + originals.__next++\n originals[key] = item\n key\n```", "response": "var scalarize;\n\nscalarize = function(array, originals, fuzzyOriginals) {\n var bestMatch, fuzzyMatches, i, index, item, j, key, keyScores, len, len1, match, results;\n fuzzyMatches = [];\n if (fuzzyOriginals) {\n // Find best fuzzy match for each object in the array\n keyScores = {};\n for (index = i = 0, len = array.length; i < len; index = ++i) {\n item = array[index];\n if (isScalar(item)) {\n continue;\n }\n bestMatch = findMatchingObject(item, index, fuzzyOriginals);\n if (!keyScores[bestMatch.key] || bestMatch.score > keyScores[bestMatch.key].score) {\n keyScores[bestMatch.key] = {\n score: bestMatch.score,\n index\n };\n }\n }\n for (key in keyScores) {\n match = keyScores[key];\n fuzzyMatches[match.index] = key;\n }\n }\n results = [];\n for (index = j = 0, len1 = array.length; j < len1; index = ++j) {\n item = array[index];\n if (isScalar(item)) {\n results.push(item);\n } else {\n key = fuzzyMatches[index] || \"__$!SCALAR\" + originals.__next++;\n originals[key] = item;\n results.push(key);\n }\n }\n return results;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 58, "line_end": 78} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar scalarize;\n\nscalarize = function(array, originals, fuzzyOriginals) {\n var bestMatch, fuzzyMatches, i, index, item, j, key, keyScores, len, len1, match, results;\n fuzzyMatches = [];\n if (fuzzyOriginals) {\n // Find best fuzzy match for each object in the array\n keyScores = {};\n for (index = i = 0, len = array.length; i < len; index = ++i) {\n item = array[index];\n if (isScalar(item)) {\n continue;\n }\n bestMatch = findMatchingObject(item, index, fuzzyOriginals);\n if (!keyScores[bestMatch.key] || bestMatch.score > keyScores[bestMatch.key].score) {\n keyScores[bestMatch.key] = {\n score: bestMatch.score,\n index\n };\n }\n }\n for (key in keyScores) {\n match = keyScores[key];\n fuzzyMatches[match.index] = key;\n }\n }\n results = [];\n for (index = j = 0, len1 = array.length; j < len1; index = ++j) {\n item = array[index];\n if (isScalar(item)) {\n results.push(item);\n } else {\n key = fuzzyMatches[index] || \"__$!SCALAR\" + originals.__next++;\n originals[key] = item;\n results.push(key);\n }\n }\n return results;\n};\n```", "response": "scalarize = (array, originals, fuzzyOriginals) ->\n fuzzyMatches = []\n if fuzzyOriginals\n # Find best fuzzy match for each object in the array\n keyScores = {}\n for item, index in array\n if isScalar item\n continue\n bestMatch = findMatchingObject(item, index, fuzzyOriginals)\n if !keyScores[bestMatch.key] || bestMatch.score > keyScores[bestMatch.key].score\n keyScores[bestMatch.key] = {score: bestMatch.score, index}\n for key, match of keyScores\n fuzzyMatches[match.index] = key\n\n for item, index in array\n if isScalar item\n item\n else\n key = fuzzyMatches[index] || \"__$!SCALAR\" + originals.__next++\n originals[key] = item\n key", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 58, "line_end": 78} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:4:completion", "type": "completion", "prompt": "scalarize = (array, originals, fuzzyOriginals) ->\n fuzzyMatches = []\n if fuzzyOriginals\n # Find best fuzzy match for each object in the array\n keyScores = {}\n for item, index in array\n if isScalar item\n continue\n bestMatch = findMatchingObject(item, index, fuzzyOriginals)\n if !keyScores[bestMatch.key] || bestMatch.score > keyScores[bestMatch.key].score", "response": "keyScores[bestMatch.key] = {score: bestMatch.score, index}\n for key, match of keyScores\n fuzzyMatches[match.index] = key\n\n for item, index in array\n if isScalar item\n item\n else\n key = fuzzyMatches[index] || \"__$!SCALAR\" + originals.__next++\n originals[key] = item\n key", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 58, "line_end": 78} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "descalarize = (item, originals) ->\n if isScalarized(item, originals)\n originals[item]\n else\n item", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 83, "line_end": 87} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndescalarize = (item, originals) ->\n if isScalarized(item, originals)\n originals[item]\n else\n item\n```", "response": "var descalarize;\n\ndescalarize = function(item, originals) {\n if (isScalarized(item, originals)) {\n return originals[item];\n } else {\n return item;\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 83, "line_end": 87} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar descalarize;\n\ndescalarize = function(item, originals) {\n if (isScalarized(item, originals)) {\n return originals[item];\n } else {\n return item;\n }\n};\n```", "response": "descalarize = (item, originals) ->\n if isScalarized(item, originals)\n originals[item]\n else\n item", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 83, "line_end": 87} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "arrayDiff = (obj1, obj2, options = {}) ->\n originals1 = { __next: 1 }\n seq1 = scalarize(obj1, originals1)\n originals2 = { __next: originals1.__next }\n seq2 = scalarize(obj2, originals2, originals1)\n\n opcodes = new SequenceMatcher(null, seq1, seq2).getOpcodes()\n\n # console.log \"arrayDiff:\\nobj1 = #{JSON.stringify(obj1, null, 2)}\\nobj2 = #{JSON.stringify(obj2, null, 2)}\\nseq1 = #{JSON.stringify(seq1, null, 2)}\\nseq2 = #{JSON.stringify(seq2, null, 2)}\\nopcodes = #{JSON.stringify(opcodes, null, 2)}\"\n\n result = []\n score = 0\n\n allEqual = yes\n for [op, i1, i2, j1, j2] in opcodes\n if !(op is 'equal' or (options.keysOnly and op is 'replace'))\n allEqual = no\n\n switch op\n when 'equal'\n for i in [i1 ... i2]\n item = seq1[i]\n if isScalarized(item, originals1)\n unless isScalarized(item, originals2)\n throw new AssertionError(\"internal bug: isScalarized(item, originals1) != isScalarized(item, originals2) for item #{JSON.stringify(item)}\")\n item1 = descalarize(item, originals1)\n item2 = descalarize(item, originals2)\n change = diff(item1, item2, options)\n if change\n result.push ['~', change]\n allEqual = no\n else\n result.push [' ', item1]\n else\n result.push [' ', item]\n score += 10\n when 'delete'\n for i in [i1 ... i2]\n result.push ['-', descalarize(seq1[i], originals1)]\n score -= 5\n when 'insert'\n for j in [j1 ... j2]\n result.push ['+', descalarize(seq2[j], originals2)]\n score -= 5\n when 'replace'\n if !options.keysOnly\n for i in [i1 ... i2]\n result.push ['-', descalarize(seq1[i], originals1)]\n score -= 5\n for j in [j1 ... j2]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 90, "line_end": 139} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:7:completion", "type": "completion", "prompt": "arrayDiff = (obj1, obj2, options = {}) ->\n originals1 = { __next: 1 }\n seq1 = scalarize(obj1, originals1)\n originals2 = { __next: originals1.__next }\n seq2 = scalarize(obj2, originals2, originals1)\n\n opcodes = new SequenceMatcher(null, seq1, seq2).getOpcodes()\n\n # console.log \"arrayDiff:\\nobj1 = #{JSON.stringify(obj1, null, 2)}\\nobj2 = #{JSON.stringify(obj2, null, 2)}\\nseq1 = #{JSON.stringify(seq1, null, 2)}\\nseq2 = #{JSON.stringify(seq2, null, 2)}\\nopcodes = #{JSON.stringify(opcodes, null, 2)}\"\n\n result = []\n score = 0\n\n allEqual = yes\n for [op, i1, i2, j1, j2] in opcodes\n if !(op is 'equal' or (options.keysOnly and op is 'replace'))\n allEqual = no\n\n switch op\n when 'equal'\n for i in [i1 ... i2]\n item = seq1[i]\n if isScalarized(item, originals1)\n unless isScalarized(item, originals2)\n throw new AssertionError(\"internal bug: isScalarized(item, originals1) != isScalarized(item, originals2) for item #{JSON.stringify(item)}\")", "response": "item1 = descalarize(item, originals1)\n item2 = descalarize(item, originals2)\n change = diff(item1, item2, options)\n if change\n result.push ['~', change]\n allEqual = no\n else\n result.push [' ', item1]\n else\n result.push [' ', item]\n score += 10\n when 'delete'\n for i in [i1 ... i2]\n result.push ['-', descalarize(seq1[i], originals1)]\n score -= 5\n when 'insert'\n for j in [j1 ... j2]\n result.push ['+', descalarize(seq2[j], originals2)]\n score -= 5\n when 'replace'\n if !options.keysOnly\n for i in [i1 ... i2]\n result.push ['-', descalarize(seq1[i], originals1)]\n score -= 5\n for j in [j1 ... j2]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 90, "line_end": 139} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "result.push ['+', descalarize(seq2[j], originals2)]\n score -= 5\n else\n for i in [i1 ... i2]\n change = diff(descalarize(seq1[i], originals1), descalarize(seq2[i - i1 + j1], originals2), options)\n if change\n result.push ['~', change]\n allEqual = no\n else\n result.push [' ']\n\n if allEqual or (opcodes.length is 0)\n # result = undefined\n score = 100\n else\n score = Math.max(0, score)\n\n return [score, result]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 140, "line_end": 157} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:8:completion", "type": "completion", "prompt": "result.push ['+', descalarize(seq2[j], originals2)]\n score -= 5\n else\n for i in [i1 ... i2]\n change = diff(descalarize(seq1[i], originals1), descalarize(seq2[i - i1 + j1], originals2), options)\n if change\n result.push ['~', change]\n allEqual = no\n else", "response": "result.push [' ']\n\n if allEqual or (opcodes.length is 0)\n # result = undefined\n score = 100\n else\n score = Math.max(0, score)\n\n return [score, result]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 140, "line_end": 157} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:9:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "diffWithScore = (obj1, obj2, options = {}) ->\n type1 = extendedTypeOf obj1\n type2 = extendedTypeOf obj2\n\n if type1 == type2\n switch type1\n when 'object'\n return objectDiff(obj1, obj2, options)\n when 'array'\n return arrayDiff(obj1, obj2, options)\n\n if !options.keysOnly\n if obj1 != obj2\n [0, { __old: obj1, __new: obj2 }]\n else\n [100, obj1]\n else\n [100, undefined]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 160, "line_end": 177} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:9:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndiffWithScore = (obj1, obj2, options = {}) ->\n type1 = extendedTypeOf obj1\n type2 = extendedTypeOf obj2\n\n if type1 == type2\n switch type1\n when 'object'\n return objectDiff(obj1, obj2, options)\n when 'array'\n return arrayDiff(obj1, obj2, options)\n\n if !options.keysOnly\n if obj1 != obj2\n [0, { __old: obj1, __new: obj2 }]\n else\n [100, obj1]\n else\n [100, undefined]\n```", "response": "var diffWithScore;\n\ndiffWithScore = function(obj1, obj2, options = {}) {\n var type1, type2;\n type1 = extendedTypeOf(obj1);\n type2 = extendedTypeOf(obj2);\n if (type1 === type2) {\n switch (type1) {\n case 'object':\n return objectDiff(obj1, obj2, options);\n case 'array':\n return arrayDiff(obj1, obj2, options);\n }\n }\n if (!options.keysOnly) {\n if (obj1 !== obj2) {\n return [\n 0,\n {\n __old: obj1,\n __new: obj2\n }\n ];\n } else {\n return [100, obj1];\n }\n } else {\n return [100, void 0];\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 160, "line_end": 177} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:9:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar diffWithScore;\n\ndiffWithScore = function(obj1, obj2, options = {}) {\n var type1, type2;\n type1 = extendedTypeOf(obj1);\n type2 = extendedTypeOf(obj2);\n if (type1 === type2) {\n switch (type1) {\n case 'object':\n return objectDiff(obj1, obj2, options);\n case 'array':\n return arrayDiff(obj1, obj2, options);\n }\n }\n if (!options.keysOnly) {\n if (obj1 !== obj2) {\n return [\n 0,\n {\n __old: obj1,\n __new: obj2\n }\n ];\n } else {\n return [100, obj1];\n }\n } else {\n return [100, void 0];\n }\n};\n```", "response": "diffWithScore = (obj1, obj2, options = {}) ->\n type1 = extendedTypeOf obj1\n type2 = extendedTypeOf obj2\n\n if type1 == type2\n switch type1\n when 'object'\n return objectDiff(obj1, obj2, options)\n when 'array'\n return arrayDiff(obj1, obj2, options)\n\n if !options.keysOnly\n if obj1 != obj2\n [0, { __old: obj1, __new: obj2 }]\n else\n [100, obj1]\n else\n [100, undefined]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 160, "line_end": 177} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:9:completion", "type": "completion", "prompt": "diffWithScore = (obj1, obj2, options = {}) ->\n type1 = extendedTypeOf obj1\n type2 = extendedTypeOf obj2\n\n if type1 == type2\n switch type1\n when 'object'\n return objectDiff(obj1, obj2, options)\n when 'array'", "response": "return arrayDiff(obj1, obj2, options)\n\n if !options.keysOnly\n if obj1 != obj2\n [0, { __old: obj1, __new: obj2 }]\n else\n [100, obj1]\n else\n [100, undefined]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 160, "line_end": 177} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:10:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "diff = (obj1, obj2, options = {}) ->\n [score, change] = diffWithScore(obj1, obj2, options)\n return change", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 179, "line_end": 181} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:10:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndiff = (obj1, obj2, options = {}) ->\n [score, change] = diffWithScore(obj1, obj2, options)\n return change\n```", "response": "var diff;\n\ndiff = function(obj1, obj2, options = {}) {\n var change, score;\n [score, change] = diffWithScore(obj1, obj2, options);\n return change;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 179, "line_end": 181} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:10:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar diff;\n\ndiff = function(obj1, obj2, options = {}) {\n var change, score;\n [score, change] = diffWithScore(obj1, obj2, options);\n return change;\n};\n```", "response": "diff = (obj1, obj2, options = {}) ->\n [score, change] = diffWithScore(obj1, obj2, options)\n return change", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 179, "line_end": 181} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:11:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "diffScore = (obj1, obj2, options = {}) ->\n [score, change] = diffWithScore(obj1, obj2, options)\n return score", "source_lang": "", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 183, "line_end": 185} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:11:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndiffScore = (obj1, obj2, options = {}) ->\n [score, change] = diffWithScore(obj1, obj2, options)\n return score\n```", "response": "var diffScore;\n\ndiffScore = function(obj1, obj2, options = {}) {\n var change, score;\n [score, change] = diffWithScore(obj1, obj2, options);\n return score;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 183, "line_end": 185} {"id": "andreyvit/json-diff:old-coffee-lib/index.coffee:11:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar diffScore;\n\ndiffScore = function(obj1, obj2, options = {}) {\n var change, score;\n [score, change] = diffWithScore(obj1, obj2, options);\n return score;\n};\n```", "response": "diffScore = (obj1, obj2, options = {}) ->\n [score, change] = diffWithScore(obj1, obj2, options)\n return score", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "andreyvit/json-diff", "path": "old-coffee-lib/index.coffee", "license": "MIT", "commit": "76adeca7de9c86bb156dfecf6e3f43dc4237ab02", "stars": 1205, "source_url": "https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/index.coffee", "line_start": 183, "line_end": 185} {"id": "gandm/language-babel:lib/insert-nl-jsx.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports =\nclass InsertNlJsx\n constructor: (@editor) ->\n @adviseBefore(@editor, 'insertText', @insertText)\n\n # patched TextEditor::insertText\n # if a newLine is entered between a JSX tag open and close marked_
_
\n # then add another newLine and reposition cursor\n insertText: (text, options) =>\n return true unless ( text is \"\\n\" )\n return true if @editor.hasMultipleCursors() # for time being\n\n cursorBufferPosition = @editor.getCursorBufferPosition()\n return true unless cursorBufferPosition.column > 0\n return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()\n cursorBufferPosition.column--\n return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()\n indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)\n @editor.insertText(\"\\n\\n\")\n @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }\n @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }\n @editor.moveUp()\n @editor.moveToEndOfLine()\n false\n\n # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee\n adviseBefore: (object, methodName, advice) ->\n original = object[methodName]\n object[methodName] = (args...) ->\n unless advice.apply(this, args) == false\n original.apply(this, args)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gandm/language-babel", "path": "lib/insert-nl-jsx.coffee", "license": "MIT", "commit": "2a687553b7f81e5b904b3b0c778236076428634b", "stars": 474, "source_url": "https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/insert-nl-jsx.coffee", "line_start": 1, "line_end": 31} {"id": "gandm/language-babel:lib/insert-nl-jsx.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports =\nclass InsertNlJsx\n constructor: (@editor) ->\n @adviseBefore(@editor, 'insertText', @insertText)\n\n # patched TextEditor::insertText\n # if a newLine is entered between a JSX tag open and close marked_
_
\n # then add another newLine and reposition cursor\n insertText: (text, options) =>\n return true unless ( text is \"\\n\" )\n return true if @editor.hasMultipleCursors() # for time being\n\n cursorBufferPosition = @editor.getCursorBufferPosition()\n return true unless cursorBufferPosition.column > 0\n return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()\n cursorBufferPosition.column--\n return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()\n indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)\n @editor.insertText(\"\\n\\n\")\n @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }\n @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }\n @editor.moveUp()\n @editor.moveToEndOfLine()\n false\n\n # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee\n adviseBefore: (object, methodName, advice) ->\n original = object[methodName]\n object[methodName] = (args...) ->\n unless advice.apply(this, args) == false\n original.apply(this, args)\n```", "response": "var InsertNlJsx;\n\nmodule.exports = InsertNlJsx = class InsertNlJsx {\n constructor(editor) {\n // patched TextEditor::insertText\n // if a newLine is entered between a JSX tag open and close marked_
_
\n // then add another newLine and reposition cursor\n this.insertText = this.insertText.bind(this);\n this.editor = editor;\n this.adviseBefore(this.editor, 'insertText', this.insertText);\n }\n\n insertText(text, options) {\n var cursorBufferPosition, indentLength;\n if (!(text === \"\\n\")) {\n return true;\n }\n if (this.editor.hasMultipleCursors()) { // for time being\n return true;\n }\n cursorBufferPosition = this.editor.getCursorBufferPosition();\n if (!(cursorBufferPosition.column > 0)) {\n return true;\n }\n if ('JSXEndTagStart' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {\n return true;\n }\n cursorBufferPosition.column--;\n if ('JSXStartTagEnd' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {\n return true;\n }\n indentLength = this.editor.indentationForBufferRow(cursorBufferPosition.row);\n this.editor.insertText(\"\\n\\n\");\n this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 1, indentLength + 1, {\n preserveLeadingWhitespace: false\n });\n this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 2, indentLength, {\n preserveLeadingWhitespace: false\n });\n this.editor.moveUp();\n this.editor.moveToEndOfLine();\n return false;\n }\n\n // from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee\n adviseBefore(object, methodName, advice) {\n var original;\n original = object[methodName];\n return object[methodName] = function(...args) {\n if (advice.apply(this, args) !== false) {\n return original.apply(this, args);\n }\n };\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gandm/language-babel", "path": "lib/insert-nl-jsx.coffee", "license": "MIT", "commit": "2a687553b7f81e5b904b3b0c778236076428634b", "stars": 474, "source_url": "https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/insert-nl-jsx.coffee", "line_start": 1, "line_end": 31} {"id": "gandm/language-babel:lib/insert-nl-jsx.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar InsertNlJsx;\n\nmodule.exports = InsertNlJsx = class InsertNlJsx {\n constructor(editor) {\n // patched TextEditor::insertText\n // if a newLine is entered between a JSX tag open and close marked_
_
\n // then add another newLine and reposition cursor\n this.insertText = this.insertText.bind(this);\n this.editor = editor;\n this.adviseBefore(this.editor, 'insertText', this.insertText);\n }\n\n insertText(text, options) {\n var cursorBufferPosition, indentLength;\n if (!(text === \"\\n\")) {\n return true;\n }\n if (this.editor.hasMultipleCursors()) { // for time being\n return true;\n }\n cursorBufferPosition = this.editor.getCursorBufferPosition();\n if (!(cursorBufferPosition.column > 0)) {\n return true;\n }\n if ('JSXEndTagStart' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {\n return true;\n }\n cursorBufferPosition.column--;\n if ('JSXStartTagEnd' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {\n return true;\n }\n indentLength = this.editor.indentationForBufferRow(cursorBufferPosition.row);\n this.editor.insertText(\"\\n\\n\");\n this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 1, indentLength + 1, {\n preserveLeadingWhitespace: false\n });\n this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 2, indentLength, {\n preserveLeadingWhitespace: false\n });\n this.editor.moveUp();\n this.editor.moveToEndOfLine();\n return false;\n }\n\n // from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee\n adviseBefore(object, methodName, advice) {\n var original;\n original = object[methodName];\n return object[methodName] = function(...args) {\n if (advice.apply(this, args) !== false) {\n return original.apply(this, args);\n }\n };\n }\n\n};\n```", "response": "module.exports =\nclass InsertNlJsx\n constructor: (@editor) ->\n @adviseBefore(@editor, 'insertText', @insertText)\n\n # patched TextEditor::insertText\n # if a newLine is entered between a JSX tag open and close marked_
_
\n # then add another newLine and reposition cursor\n insertText: (text, options) =>\n return true unless ( text is \"\\n\" )\n return true if @editor.hasMultipleCursors() # for time being\n\n cursorBufferPosition = @editor.getCursorBufferPosition()\n return true unless cursorBufferPosition.column > 0\n return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()\n cursorBufferPosition.column--\n return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()\n indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)\n @editor.insertText(\"\\n\\n\")\n @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }\n @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }\n @editor.moveUp()\n @editor.moveToEndOfLine()\n false\n\n # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee\n adviseBefore: (object, methodName, advice) ->\n original = object[methodName]\n object[methodName] = (args...) ->\n unless advice.apply(this, args) == false\n original.apply(this, args)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gandm/language-babel", "path": "lib/insert-nl-jsx.coffee", "license": "MIT", "commit": "2a687553b7f81e5b904b3b0c778236076428634b", "stars": 474, "source_url": "https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/insert-nl-jsx.coffee", "line_start": 1, "line_end": 31} {"id": "gandm/language-babel:lib/insert-nl-jsx.coffee:1:completion", "type": "completion", "prompt": "module.exports =\nclass InsertNlJsx\n constructor: (@editor) ->\n @adviseBefore(@editor, 'insertText', @insertText)\n\n # patched TextEditor::insertText\n # if a newLine is entered between a JSX tag open and close marked_
_
\n # then add another newLine and reposition cursor\n insertText: (text, options) =>\n return true unless ( text is \"\\n\" )\n return true if @editor.hasMultipleCursors() # for time being\n\n cursorBufferPosition = @editor.getCursorBufferPosition()\n return true unless cursorBufferPosition.column > 0\n return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()", "response": "cursorBufferPosition.column--\n return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()\n indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)\n @editor.insertText(\"\\n\\n\")\n @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }\n @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }\n @editor.moveUp()\n @editor.moveToEndOfLine()\n false\n\n # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee\n adviseBefore: (object, methodName, advice) ->\n original = object[methodName]\n object[methodName] = (args...) ->\n unless advice.apply(this, args) == false\n original.apply(this, args)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gandm/language-babel", "path": "lib/insert-nl-jsx.coffee", "license": "MIT", "commit": "2a687553b7f81e5b904b3b0c778236076428634b", "stars": 474, "source_url": "https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/insert-nl-jsx.coffee", "line_start": 1, "line_end": 31} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"\n executables: [\n {\n name: \"Dfmt\"\n cmd: \"dfmt\"\n homepage: \"https://github.com/Hackerpilot/dfmt\"\n installation: \"https://github.com/dlang-community/dfmt#building\"\n }\n ]\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @exe(\"dfmt\").run([\n @tempFile(\"input\", text)\n ])", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 26} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"\n executables: [\n {\n name: \"Dfmt\"\n cmd: \"dfmt\"\n homepage: \"https://github.com/Hackerpilot/dfmt\"\n installation: \"https://github.com/dlang-community/dfmt#building\"\n }\n ]\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @exe(\"dfmt\").run([\n @tempFile(\"input\", text)\n ])\n```", "response": "/*\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n*/\n\"use strict\";\nvar Beautifier, Dfmt;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = Dfmt = (function() {\n class Dfmt extends Beautifier {\n beautify(text, language, options) {\n return this.exe(\"dfmt\").run([this.tempFile(\"input\", text)]);\n }\n\n };\n\n Dfmt.prototype.name = \"dfmt\";\n\n Dfmt.prototype.link = \"https://github.com/Hackerpilot/dfmt\";\n\n Dfmt.prototype.executables = [\n {\n name: \"Dfmt\",\n cmd: \"dfmt\",\n homepage: \"https://github.com/Hackerpilot/dfmt\",\n installation: \"https://github.com/dlang-community/dfmt#building\"\n }\n ];\n\n Dfmt.prototype.options = {\n D: false\n };\n\n return Dfmt;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 26} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n*/\n\"use strict\";\nvar Beautifier, Dfmt;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = Dfmt = (function() {\n class Dfmt extends Beautifier {\n beautify(text, language, options) {\n return this.exe(\"dfmt\").run([this.tempFile(\"input\", text)]);\n }\n\n };\n\n Dfmt.prototype.name = \"dfmt\";\n\n Dfmt.prototype.link = \"https://github.com/Hackerpilot/dfmt\";\n\n Dfmt.prototype.executables = [\n {\n name: \"Dfmt\",\n cmd: \"dfmt\",\n homepage: \"https://github.com/Hackerpilot/dfmt\",\n installation: \"https://github.com/dlang-community/dfmt#building\"\n }\n ];\n\n Dfmt.prototype.options = {\n D: false\n };\n\n return Dfmt;\n\n}).call(this);\n```", "response": "###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"\n executables: [\n {\n name: \"Dfmt\"\n cmd: \"dfmt\"\n homepage: \"https://github.com/Hackerpilot/dfmt\"\n installation: \"https://github.com/dlang-community/dfmt#building\"\n }\n ]\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @exe(\"dfmt\").run([\n @tempFile(\"input\", text)\n ])", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 26} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:completion", "type": "completion", "prompt": "###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"\n executables: [\n {\n name: \"Dfmt\"\n cmd: \"dfmt\"", "response": "homepage: \"https://github.com/Hackerpilot/dfmt\"\n installation: \"https://github.com/dlang-community/dfmt#building\"\n }\n ]\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @exe(\"dfmt\").run([\n @tempFile(\"input\", text)\n ])", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 26} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"\n isPreInstalled: false\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @run(\"dfmt\", [\n @tempFile(\"input\", text)\n ])", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 19} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"\n isPreInstalled: false\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @run(\"dfmt\", [\n @tempFile(\"input\", text)\n ])\n```", "response": "/*\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n*/\n\"use strict\";\nvar Beautifier, Dfmt;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = Dfmt = (function() {\n class Dfmt extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"dfmt\", [this.tempFile(\"input\", text)]);\n }\n\n };\n\n Dfmt.prototype.name = \"dfmt\";\n\n Dfmt.prototype.link = \"https://github.com/Hackerpilot/dfmt\";\n\n Dfmt.prototype.isPreInstalled = false;\n\n Dfmt.prototype.options = {\n D: false\n };\n\n return Dfmt;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 19} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n*/\n\"use strict\";\nvar Beautifier, Dfmt;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = Dfmt = (function() {\n class Dfmt extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"dfmt\", [this.tempFile(\"input\", text)]);\n }\n\n };\n\n Dfmt.prototype.name = \"dfmt\";\n\n Dfmt.prototype.link = \"https://github.com/Hackerpilot/dfmt\";\n\n Dfmt.prototype.isPreInstalled = false;\n\n Dfmt.prototype.options = {\n D: false\n };\n\n return Dfmt;\n\n}).call(this);\n```", "response": "###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"\n isPreInstalled: false\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @run(\"dfmt\", [\n @tempFile(\"input\", text)\n ])", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 19} {"id": "Glavin001/atom-beautify:src/beautifiers/dfmt.coffee:1:completion", "type": "completion", "prompt": "###\nRequires [dfmt](https://github.com/Hackerpilot/dfmt)\n###\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class Dfmt extends Beautifier\n name: \"dfmt\"\n link: \"https://github.com/Hackerpilot/dfmt\"", "response": "isPreInstalled: false\n\n options: {\n D: false\n }\n\n beautify: (text, language, options) ->\n @run(\"dfmt\", [\n @tempFile(\"input\", text)\n ])", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/dfmt.coffee", "license": "MIT", "commit": "ba2198675cbcc1ecd05f18e28e97133cdd2d5319", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/dfmt.coffee", "line_start": 1, "line_end": 19} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{Promise} = require \"rsvp\"\n\nPromise::done = (done) -> @then done\nPromise::fail = (fail) -> @then null, fail\n\nmodule.exports = -> new Promise()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "19199efee35815b32ed8a1c7f6156c80ddda36b9", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/19199efee35815b32ed8a1c7f6156c80ddda36b9/src/promises.coffee", "line_start": 1, "line_end": 6} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{Promise} = require \"rsvp\"\n\nPromise::done = (done) -> @then done\nPromise::fail = (fail) -> @then null, fail\n\nmodule.exports = -> new Promise()\n```", "response": "var Promise;\n\n({Promise} = require(\"rsvp\"));\n\nPromise.prototype.done = function(done) {\n return this.then(done);\n};\n\nPromise.prototype.fail = function(fail) {\n return this.then(null, fail);\n};\n\nmodule.exports = function() {\n return new Promise();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "19199efee35815b32ed8a1c7f6156c80ddda36b9", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/19199efee35815b32ed8a1c7f6156c80ddda36b9/src/promises.coffee", "line_start": 1, "line_end": 6} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Promise;\n\n({Promise} = require(\"rsvp\"));\n\nPromise.prototype.done = function(done) {\n return this.then(done);\n};\n\nPromise.prototype.fail = function(fail) {\n return this.then(null, fail);\n};\n\nmodule.exports = function() {\n return new Promise();\n};\n```", "response": "{Promise} = require \"rsvp\"\n\nPromise::done = (done) -> @then done\nPromise::fail = (fail) -> @then null, fail\n\nmodule.exports = -> new Promise()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "19199efee35815b32ed8a1c7f6156c80ddda36b9", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/19199efee35815b32ed8a1c7f6156c80ddda36b9/src/promises.coffee", "line_start": 1, "line_end": 6} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:completion", "type": "completion", "prompt": "{Promise} = require \"rsvp\"\n\nPromise::done = (done) -> @then done", "response": "Promise::fail = (fail) -> @then null, fail\n\nmodule.exports = -> new Promise()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "19199efee35815b32ed8a1c7f6156c80ddda36b9", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/19199efee35815b32ed8a1c7f6156c80ddda36b9/src/promises.coffee", "line_start": 1, "line_end": 6} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Promise = require \"fantasy-promises\"\n\nPromise::done = (done) -> @fork done, null\nPromise::fail = (fail) -> @fork null, fail\n\nmodule.exports = (fork) ->\n new Promise (resolve, reject) ->\n fork (resolve or ->), (reject or ->)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "d99b7672150ea03567a8a3fc57a6b31c619c43d4", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/d99b7672150ea03567a8a3fc57a6b31c619c43d4/src/promises.coffee", "line_start": 1, "line_end": 8} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nPromise = require \"fantasy-promises\"\n\nPromise::done = (done) -> @fork done, null\nPromise::fail = (fail) -> @fork null, fail\n\nmodule.exports = (fork) ->\n new Promise (resolve, reject) ->\n fork (resolve or ->), (reject or ->)\n```", "response": "var Promise;\n\nPromise = require(\"fantasy-promises\");\n\nPromise.prototype.done = function(done) {\n return this.fork(done, null);\n};\n\nPromise.prototype.fail = function(fail) {\n return this.fork(null, fail);\n};\n\nmodule.exports = function(fork) {\n return new Promise(function(resolve, reject) {\n return fork(resolve || function() {}, reject || function() {});\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "d99b7672150ea03567a8a3fc57a6b31c619c43d4", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/d99b7672150ea03567a8a3fc57a6b31c619c43d4/src/promises.coffee", "line_start": 1, "line_end": 8} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Promise;\n\nPromise = require(\"fantasy-promises\");\n\nPromise.prototype.done = function(done) {\n return this.fork(done, null);\n};\n\nPromise.prototype.fail = function(fail) {\n return this.fork(null, fail);\n};\n\nmodule.exports = function(fork) {\n return new Promise(function(resolve, reject) {\n return fork(resolve || function() {}, reject || function() {});\n });\n};\n```", "response": "Promise = require \"fantasy-promises\"\n\nPromise::done = (done) -> @fork done, null\nPromise::fail = (fail) -> @fork null, fail\n\nmodule.exports = (fork) ->\n new Promise (resolve, reject) ->\n fork (resolve or ->), (reject or ->)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "d99b7672150ea03567a8a3fc57a6b31c619c43d4", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/d99b7672150ea03567a8a3fc57a6b31c619c43d4/src/promises.coffee", "line_start": 1, "line_end": 8} {"id": "hipchat/hubot-hipchat:src/promises.coffee:1:completion", "type": "completion", "prompt": "Promise = require \"fantasy-promises\"\n\nPromise::done = (done) -> @fork done, null\nPromise::fail = (fail) -> @fork null, fail", "response": "module.exports = (fork) ->\n new Promise (resolve, reject) ->\n fork (resolve or ->), (reject or ->)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "hipchat/hubot-hipchat", "path": "src/promises.coffee", "license": "MIT", "commit": "d99b7672150ea03567a8a3fc57a6b31c619c43d4", "stars": 661, "source_url": "https://github.com/hipchat/hubot-hipchat/blob/d99b7672150ea03567a8a3fc57a6b31c619c43d4/src/promises.coffee", "line_start": 1, "line_end": 8} {"id": "oozcitak/xmlbuilder-js:test/guards/text.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'Text Guards:', ->\n test 'constructor', ->\n err(\n () -> xml('test').txt()\n Error\n \"Missing element text. parent: \"\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/text.coffee", "line_start": 1, "line_end": 7} {"id": "oozcitak/xmlbuilder-js:test/guards/text.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'Text Guards:', ->\n test 'constructor', ->\n err(\n () -> xml('test').txt()\n Error\n \"Missing element text. parent: \"\n )\n```", "response": "suite('Text Guards:', function() {\n return test('constructor', function() {\n return err(function() {\n return xml('test').txt();\n }, Error, \"Missing element text. parent: \");\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/text.coffee", "line_start": 1, "line_end": 7} {"id": "oozcitak/xmlbuilder-js:test/guards/text.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('Text Guards:', function() {\n return test('constructor', function() {\n return err(function() {\n return xml('test').txt();\n }, Error, \"Missing element text. parent: \");\n });\n});\n```", "response": "suite 'Text Guards:', ->\n test 'constructor', ->\n err(\n () -> xml('test').txt()\n Error\n \"Missing element text. parent: \"\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/text.coffee", "line_start": 1, "line_end": 7} {"id": "oozcitak/xmlbuilder-js:test/guards/text.coffee:1:completion", "type": "completion", "prompt": "suite 'Text Guards:', ->\n test 'constructor', ->\n err(", "response": "() -> xml('test').txt()\n Error\n \"Missing element text. parent: \"\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/guards/text.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/guards/text.coffee", "line_start": 1, "line_end": 7} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# The **Scope** class regulates lexical scoping within CoffeeScript. As you\n# generate code, you create a tree of scopes in the same shape as the nested\n# function bodies. Each scope knows about the variables declared within it,\n# and has a reference to its parent enclosing scope. In this way, we know which\n# variables are new and need to be declared with `var`, and which are shared\n# with the outside.\n\n# Set up exported variables for both **Node.js** and the browser.\nthis.exports: this unless process?\n\nexports.Scope: class Scope\n\n # The top-level **Scope** object.\n @root: null\n\n # Initialize a scope with its parent, for lookups up the chain,\n # as well as a reference to the **Expressions** node is belongs to, which is\n # where it should declare its variables, and a reference to the function that\n # it wraps.\n constructor: (parent, expressions, method) ->\n [@parent, @expressions, @method]: [parent, expressions, method]\n @variables: {}\n if @parent\n @temp_var: @parent.temp_var\n else\n Scope.root: this\n @temp_var: '_a'\n\n # Look up a variable name in lexical scope, and declare it if it does not\n # already exist.\n find: (name) ->\n return true if @check name\n @variables[name]: 'var'\n false\n\n # Test variables and return true the first time fn(v, k) returns true\n any: (fn) ->\n for v, k of @variables when fn(v, k)\n return true\n return false", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 1, "line_end": 40} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:1:completion", "type": "completion", "prompt": "# The **Scope** class regulates lexical scoping within CoffeeScript. As you\n# generate code, you create a tree of scopes in the same shape as the nested\n# function bodies. Each scope knows about the variables declared within it,\n# and has a reference to its parent enclosing scope. In this way, we know which\n# variables are new and need to be declared with `var`, and which are shared\n# with the outside.\n\n# Set up exported variables for both **Node.js** and the browser.\nthis.exports: this unless process?\n\nexports.Scope: class Scope\n\n # The top-level **Scope** object.\n @root: null\n\n # Initialize a scope with its parent, for lookups up the chain,\n # as well as a reference to the **Expressions** node is belongs to, which is\n # where it should declare its variables, and a reference to the function that\n # it wraps.\n constructor: (parent, expressions, method) ->", "response": "[@parent, @expressions, @method]: [parent, expressions, method]\n @variables: {}\n if @parent\n @temp_var: @parent.temp_var\n else\n Scope.root: this\n @temp_var: '_a'\n\n # Look up a variable name in lexical scope, and declare it if it does not\n # already exist.\n find: (name) ->\n return true if @check name\n @variables[name]: 'var'\n false\n\n # Test variables and return true the first time fn(v, k) returns true\n any: (fn) ->\n for v, k of @variables when fn(v, k)\n return true\n return false", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 1, "line_end": 40} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Reserve a variable name as originating from a function parameter for this\n # scope. No `var` required for internal references.\n parameter: (name) ->\n @variables[name]: 'param'\n\n # Just check to see if a variable has already been declared, without reserving.\n check: (name) ->\n return true if @variables[name]\n !!(@parent and @parent.check(name))\n\n # If we need to store an intermediate result, find an available name for a\n # compiler-generated variable. `_a`, `_b`, and so on...\n free_variable: ->\n while @check @temp_var\n ordinal: 1 + parseInt @temp_var.substr(1), 36\n @temp_var: '_' + ordinal.toString(36).replace(/\\d/g, 'a')\n @variables[@temp_var]: 'var'\n @temp_var\n\n # Ensure that an assignment is made at the top of this scope\n # (or at the top-level scope, if requested).\n assign: (name, value) ->\n @variables[name]: {value: value, assigned: true}\n\n # Does this scope reference any variables that need to be declared in the\n # given function body?\n has_declarations: (body) ->\n body is @expressions and @any (k, val) -> val is 'var'\n\n # Does this scope reference any assignments that need to be declared at the\n # top of the given function body?\n has_assignments: (body) ->\n body is @expressions and @any (k, val) -> val.assigned\n\n # Return the list of variables first declared in this scope.\n declared_variables: ->\n (key for key, val of @variables when val is 'var').sort()\n\n # Return the list of assignments that are supposed to be made at the top\n # of this scope.\n assigned_variables: ->\n \"$key = $val.value\" for key, val of @variables when val.assigned", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 42, "line_end": 83} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:2:completion", "type": "completion", "prompt": "# Reserve a variable name as originating from a function parameter for this\n # scope. No `var` required for internal references.\n parameter: (name) ->\n @variables[name]: 'param'\n\n # Just check to see if a variable has already been declared, without reserving.\n check: (name) ->\n return true if @variables[name]\n !!(@parent and @parent.check(name))\n\n # If we need to store an intermediate result, find an available name for a\n # compiler-generated variable. `_a`, `_b`, and so on...\n free_variable: ->\n while @check @temp_var\n ordinal: 1 + parseInt @temp_var.substr(1), 36\n @temp_var: '_' + ordinal.toString(36).replace(/\\d/g, 'a')\n @variables[@temp_var]: 'var'\n @temp_var\n\n # Ensure that an assignment is made at the top of this scope\n # (or at the top-level scope, if requested).", "response": "assign: (name, value) ->\n @variables[name]: {value: value, assigned: true}\n\n # Does this scope reference any variables that need to be declared in the\n # given function body?\n has_declarations: (body) ->\n body is @expressions and @any (k, val) -> val is 'var'\n\n # Does this scope reference any assignments that need to be declared at the\n # top of the given function body?\n has_assignments: (body) ->\n body is @expressions and @any (k, val) -> val.assigned\n\n # Return the list of variables first declared in this scope.\n declared_variables: ->\n (key for key, val of @variables when val is 'var').sort()\n\n # Return the list of assignments that are supposed to be made at the top\n # of this scope.\n assigned_variables: ->\n \"$key = $val.value\" for key, val of @variables when val.assigned", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 42, "line_end": 83} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Compile the JavaScript for all of the variable declarations in this scope.\n compiled_declarations: ->\n @declared_variables().join ', '\n\n # Compile the JavaScript for all of the variable assignments in this scope.\n compiled_assignments: ->\n @assigned_variables().join ', '", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 85, "line_end": 91} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Compile the JavaScript for all of the variable declarations in this scope.\n compiled_declarations: ->\n @declared_variables().join ', '\n\n # Compile the JavaScript for all of the variable assignments in this scope.\n compiled_assignments: ->\n @assigned_variables().join ', '\n```", "response": "// Compile the JavaScript for all of the variable declarations in this scope.\n({\n compiled_declarations: function() {\n return this.declared_variables().join(', ');\n },\n // Compile the JavaScript for all of the variable assignments in this scope.\n compiled_assignments: function() {\n return this.assigned_variables().join(', ');\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 85, "line_end": 91} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Compile the JavaScript for all of the variable declarations in this scope.\n({\n compiled_declarations: function() {\n return this.declared_variables().join(', ');\n },\n // Compile the JavaScript for all of the variable assignments in this scope.\n compiled_assignments: function() {\n return this.assigned_variables().join(', ');\n }\n});\n```", "response": "# Compile the JavaScript for all of the variable declarations in this scope.\n compiled_declarations: ->\n @declared_variables().join ', '\n\n # Compile the JavaScript for all of the variable assignments in this scope.\n compiled_assignments: ->\n @assigned_variables().join ', '", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 85, "line_end": 91} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/src/scope.coffee:3:completion", "type": "completion", "prompt": "# Compile the JavaScript for all of the variable declarations in this scope.\n compiled_declarations: ->\n @declared_variables().join ', '", "response": "# Compile the JavaScript for all of the variable assignments in this scope.\n compiled_assignments: ->\n @assigned_variables().join ', '", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/src/scope.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/scope.coffee", "line_start": 85, "line_end": 91} {"id": "jianliaoim/talk-os:talk-api2x/test/servers/outgoing.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "express = require 'express'\n\nmodule.exports = app = express()\n\napp.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/servers/outgoing.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/servers/outgoing.coffee", "line_start": 1, "line_end": 5} {"id": "jianliaoim/talk-os:talk-api2x/test/servers/outgoing.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexpress = require 'express'\n\nmodule.exports = app = express()\n\napp.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'\n```", "response": "var app, express;\n\nexpress = require('express');\n\nmodule.exports = app = express();\n\napp.post('/messages', function(req, res) {\n return res.send({\n content: 'ok',\n authorName: '小艾'\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/servers/outgoing.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/servers/outgoing.coffee", "line_start": 1, "line_end": 5} {"id": "jianliaoim/talk-os:talk-api2x/test/servers/outgoing.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar app, express;\n\nexpress = require('express');\n\nmodule.exports = app = express();\n\napp.post('/messages', function(req, res) {\n return res.send({\n content: 'ok',\n authorName: '小艾'\n });\n});\n```", "response": "express = require 'express'\n\nmodule.exports = app = express()\n\napp.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/servers/outgoing.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/servers/outgoing.coffee", "line_start": 1, "line_end": 5} {"id": "jianliaoim/talk-os:talk-api2x/test/servers/outgoing.coffee:1:completion", "type": "completion", "prompt": "express = require 'express'", "response": "module.exports = app = express()\n\napp.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/test/servers/outgoing.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/servers/outgoing.coffee", "line_start": 1, "line_end": 5} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n ### A template plugin subclass have to implement a `render` instance method and a `fromFile` class method. ###\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile filepath, (error, template) ->\n error.message = \"template #{ filepath.relative }: #{ error.message }\" if error?\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:completion", "type": "completion", "prompt": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n ### A template plugin subclass have to implement a `render` instance method and a `fromFile` class method. ###\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###", "response": "templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile filepath, (error, template) ->\n error.message = \"template #{ filepath.relative }: #{ error.message }\" if error?\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "(callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates\n\n### Exports ###\n\nmodule.exports = {TemplatePlugin, loadTemplates}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/templates.coffee", "line_start": 51, "line_end": 58} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:completion", "type": "completion", "prompt": "(callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates", "response": "### Exports ###\n\nmodule.exports = {TemplatePlugin, loadTemplates}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "be757f5f7d72ddce462f67913c9cd7c578162018", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/core/templates.coffee", "line_start": 51, "line_end": 58} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile filepath, (error, template) ->\n error.message = \"template #{ filepath.relative }: #{ error.message }\" if error?\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "1048355ff6b94af5aba884cc4ceae35ac671a2dc", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1048355ff6b94af5aba884cc4ceae35ac671a2dc/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:completion", "type": "completion", "prompt": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}", "response": "resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile filepath, (error, template) ->\n error.message = \"template #{ filepath.relative }: #{ error.message }\" if error?\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "1048355ff6b94af5aba884cc4ceae35ac671a2dc", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1048355ff6b94af5aba884cc4ceae35ac671a2dc/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates\n\n### Exports ###\n\nmodule.exports = {TemplatePlugin, loadTemplates}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "1048355ff6b94af5aba884cc4ceae35ac671a2dc", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1048355ff6b94af5aba884cc4ceae35ac671a2dc/src/core/templates.coffee", "line_start": 51, "line_end": 57} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:completion", "type": "completion", "prompt": "resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates", "response": "### Exports ###\n\nmodule.exports = {TemplatePlugin, loadTemplates}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "1048355ff6b94af5aba884cc4ceae35ac671a2dc", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/1048355ff6b94af5aba884cc4ceae35ac671a2dc/src/core/templates.coffee", "line_start": 51, "line_end": 57} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:completion", "type": "completion", "prompt": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}", "response": "resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "(filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates\n\n### Exports ###\n\nmodule.exports = {TemplatePlugin, loadTemplates}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d/src/core/templates.coffee", "line_start": 51, "line_end": 56} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:completion", "type": "completion", "prompt": "(filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates", "response": "### Exports ###\n\nmodule.exports = {TemplatePlugin, loadTemplates}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/88996e4f6762c9bd40f1fcbb5eba9ce2110f9d5d/src/core/templates.coffee", "line_start": 51, "line_end": 56} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (env, filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile env, filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "583030a392320c21f316edb74c8e91b5a5a8f275", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/583030a392320c21f316edb74c8e91b5a5a8f275/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:completion", "type": "completion", "prompt": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend, readdirRecursive} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (env, filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}", "response": "resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile env, filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "583030a392320c21f316edb74c8e91b5a5a8f275", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/583030a392320c21f316edb74c8e91b5a5a8f275/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (env, filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nreaddirRecursive = (directory, callback) ->\n ### Returns an array representing *directory*, including subdirectories. ###\n result = []\n walk = (dir, callback) ->\n async.waterfall [\n async.apply fs.readdir, path.join(directory, dir)\n (filenames, callback) ->\n async.forEach filenames, (filename, callback) ->\n relname = path.join dir, filename\n async.waterfall [\n async.apply fs.stat, path.join(directory, relname)\n (stat, callback) ->\n if stat.isDirectory()\n walk relname, callback\n else\n result.push relname\n callback()\n ], callback\n , callback\n ], callback\n walk '', (error) -> callback error, result\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (env, filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nreaddirRecursive = (directory, callback) ->\n ### Returns an array representing *directory*, including subdirectories. ###\n result = []\n walk = (dir, callback) ->\n async.waterfall [\n async.apply fs.readdir, path.join(directory, dir)\n (filenames, callback) ->\n async.forEach filenames, (filename, callback) ->\n relname = path.join dir, filename\n async.waterfall [\n async.apply fs.stat, path.join(directory, relname)\n (stat, callback) ->\n if stat.isDirectory()\n walk relname, callback\n else\n result.push relname\n callback()\n ], callback\n , callback\n ], callback\n walk '', (error) -> callback error, result\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->\n```", "response": "/* templates.coffee */\nvar TemplatePlugin, async, extend, fs, loadTemplates, minimatch, path, readdirRecursive;\n\nasync = require('async');\n\nfs = require('fs');\n\nminimatch = require('minimatch');\n\npath = require('path');\n\n({extend} = require('./utils'));\n\nTemplatePlugin = class TemplatePlugin {\n render(locals, callback) {\n /* Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. */\n throw new Error('Not implemented.');\n }\n\n};\n\nTemplatePlugin.fromFile = function(env, filepath, callback) {\n /* *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. */\n throw new Error('Not implemented.');\n};\n\nreaddirRecursive = function(directory, callback) {\n /* Returns an array representing *directory*, including subdirectories. */\n var result, walk;\n result = [];\n walk = function(dir, callback) {\n return async.waterfall([\n async.apply(fs.readdir,\n path.join(directory,\n dir)),\n function(filenames,\n callback) {\n return async.forEach(filenames,\n function(filename,\n callback) {\n var relname;\n relname = path.join(dir,\n filename);\n return async.waterfall([\n async.apply(fs.stat,\n path.join(directory,\n relname)),\n function(stat,\n callback) {\n if (stat.isDirectory()) {\n return walk(relname,\n callback);\n } else {\n result.push(relname);\n return callback();\n }\n }\n ],\n callback);\n },\n callback);\n }\n ], callback);\n };\n return walk('', function(error) {\n return callback(error, result);\n });\n};\n\nloadTemplates = function(env, callback) {\n /* Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } */\n var resolveFilenames, templates;\n templates = {};\n return resolveFilenames = function(filenames, callback) {\n return async.map(filenames, function(filename, callback) {});\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/* templates.coffee */\nvar TemplatePlugin, async, extend, fs, loadTemplates, minimatch, path, readdirRecursive;\n\nasync = require('async');\n\nfs = require('fs');\n\nminimatch = require('minimatch');\n\npath = require('path');\n\n({extend} = require('./utils'));\n\nTemplatePlugin = class TemplatePlugin {\n render(locals, callback) {\n /* Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. */\n throw new Error('Not implemented.');\n }\n\n};\n\nTemplatePlugin.fromFile = function(env, filepath, callback) {\n /* *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. */\n throw new Error('Not implemented.');\n};\n\nreaddirRecursive = function(directory, callback) {\n /* Returns an array representing *directory*, including subdirectories. */\n var result, walk;\n result = [];\n walk = function(dir, callback) {\n return async.waterfall([\n async.apply(fs.readdir,\n path.join(directory,\n dir)),\n function(filenames,\n callback) {\n return async.forEach(filenames,\n function(filename,\n callback) {\n var relname;\n relname = path.join(dir,\n filename);\n return async.waterfall([\n async.apply(fs.stat,\n path.join(directory,\n relname)),\n function(stat,\n callback) {\n if (stat.isDirectory()) {\n return walk(relname,\n callback);\n } else {\n result.push(relname);\n return callback();\n }\n }\n ],\n callback);\n },\n callback);\n }\n ], callback);\n };\n return walk('', function(error) {\n return callback(error, result);\n });\n};\n\nloadTemplates = function(env, callback) {\n /* Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } */\n var resolveFilenames, templates;\n templates = {};\n return resolveFilenames = function(filenames, callback) {\n return async.map(filenames, function(filename, callback) {});\n };\n};\n```", "response": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (env, filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nreaddirRecursive = (directory, callback) ->\n ### Returns an array representing *directory*, including subdirectories. ###\n result = []\n walk = (dir, callback) ->\n async.waterfall [\n async.apply fs.readdir, path.join(directory, dir)\n (filenames, callback) ->\n async.forEach filenames, (filename, callback) ->\n relname = path.join dir, filename\n async.waterfall [\n async.apply fs.stat, path.join(directory, relname)\n (stat, callback) ->\n if stat.isDirectory()\n walk relname, callback\n else\n result.push relname\n callback()\n ], callback\n , callback\n ], callback\n walk '', (error) -> callback error, result\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:1:completion", "type": "completion", "prompt": "### templates.coffee ###\n\nasync = require 'async'\nfs = require 'fs'\nminimatch = require 'minimatch'\npath = require 'path'\n\n{extend} = require './utils'\n\nclass TemplatePlugin\n\n render: (locals, callback) ->\n ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###\n throw new Error 'Not implemented.'\n\nTemplatePlugin.fromFile = (env, filepath, callback) ->\n ### *callback* with a instance of created from *filepath*. Where *filepath* is\n an object containing the full and relative (to templates directory) path to the file. ###\n throw new Error 'Not implemented.'\n\nreaddirRecursive = (directory, callback) ->\n ### Returns an array representing *directory*, including subdirectories. ###\n result = []\n walk = (dir, callback) ->\n async.waterfall [", "response": "async.apply fs.readdir, path.join(directory, dir)\n (filenames, callback) ->\n async.forEach filenames, (filename, callback) ->\n relname = path.join dir, filename\n async.waterfall [\n async.apply fs.stat, path.join(directory, relname)\n (stat, callback) ->\n if stat.isDirectory()\n walk relname, callback\n else\n result.push relname\n callback()\n ], callback\n , callback\n ], callback\n walk '', (error) -> callback error, result\n\nloadTemplates = (env, callback) ->\n ### Load and any templates associated with the environment *env*. Calls *callback* with\n a map of templates as {: } ###\n\n templates = {}\n\n resolveFilenames = (filenames, callback) ->\n async.map filenames, (filename, callback) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 1, "line_end": 50} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile env, filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates\n\nmodule.exports.loadTemplates = loadTemplates\nmodule.exports.TemplatePlugin = TemplatePlugin", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 51, "line_end": 77} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ncallback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile env, filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates\n\nmodule.exports.loadTemplates = loadTemplates\nmodule.exports.TemplatePlugin = TemplatePlugin\n```", "response": "var loadTemplate;\n\ncallback(null, {\n full: path.join(env.templatesPath, filename),\n relative: filename\n}, callback);\n\nloadTemplate = function(filepath, callback) {\n /* Create an template plugin instance from *filepath*. */\n var i, j, plugin, ref;\n plugin = null;\n for (i = j = ref = env.templatePlugins.length - 1; j >= 0; i = j += -1) {\n if (minimatch(filepath.relative, env.templatePlugins[i].pattern)) {\n plugin = env.templatePlugins[i];\n break;\n }\n }\n if (plugin != null) {\n return plugin.class.fromFile(env, filepath, function(error, template) {\n templates[filepath.relative] = template;\n return callback(error);\n });\n } else {\n return callback();\n }\n};\n\nasync.waterfall([\n function(callback) {\n return readdirRecursive(env.templatesPath,\n callback);\n },\n resolveFilenames,\n function(filenames,\n callback) {\n return async.forEach(filenames,\n loadTemplate,\n callback);\n }\n], function(error) {\n return callback(error, templates);\n});\n\nmodule.exports.loadTemplates = loadTemplates;\n\nmodule.exports.TemplatePlugin = TemplatePlugin;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 51, "line_end": 77} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar loadTemplate;\n\ncallback(null, {\n full: path.join(env.templatesPath, filename),\n relative: filename\n}, callback);\n\nloadTemplate = function(filepath, callback) {\n /* Create an template plugin instance from *filepath*. */\n var i, j, plugin, ref;\n plugin = null;\n for (i = j = ref = env.templatePlugins.length - 1; j >= 0; i = j += -1) {\n if (minimatch(filepath.relative, env.templatePlugins[i].pattern)) {\n plugin = env.templatePlugins[i];\n break;\n }\n }\n if (plugin != null) {\n return plugin.class.fromFile(env, filepath, function(error, template) {\n templates[filepath.relative] = template;\n return callback(error);\n });\n } else {\n return callback();\n }\n};\n\nasync.waterfall([\n function(callback) {\n return readdirRecursive(env.templatesPath,\n callback);\n },\n resolveFilenames,\n function(filenames,\n callback) {\n return async.forEach(filenames,\n loadTemplate,\n callback);\n }\n], function(error) {\n return callback(error, templates);\n});\n\nmodule.exports.loadTemplates = loadTemplates;\n\nmodule.exports.TemplatePlugin = TemplatePlugin;\n```", "response": "callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?\n plugin.class.fromFile env, filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates\n\nmodule.exports.loadTemplates = loadTemplates\nmodule.exports.TemplatePlugin = TemplatePlugin", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 51, "line_end": 77} {"id": "jnordberg/wintersmith:src/core/templates.coffee:2:completion", "type": "completion", "prompt": "callback null,\n full: path.join env.templatesPath, filename\n relative: filename\n , callback\n\n loadTemplate = (filepath, callback) ->\n ### Create an template plugin instance from *filepath*. ###\n plugin = null\n for i in [env.templatePlugins.length - 1..0] by -1\n if minimatch filepath.relative, env.templatePlugins[i].pattern\n plugin = env.templatePlugins[i]\n break\n if plugin?", "response": "plugin.class.fromFile env, filepath, (error, template) ->\n templates[filepath.relative] = template\n callback error\n else\n callback()\n\n async.waterfall [\n (callback) -> readdirRecursive env.templatesPath, callback\n resolveFilenames\n (filenames, callback) -> async.forEach filenames, loadTemplate, callback\n ], (error) -> callback error, templates\n\nmodule.exports.loadTemplates = loadTemplates\nmodule.exports.TemplatePlugin = TemplatePlugin", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jnordberg/wintersmith", "path": "src/core/templates.coffee", "license": "MIT", "commit": "f66d4ed08088938536fc35ef7349eacaf5ab11b8", "stars": 3484, "source_url": "https://github.com/jnordberg/wintersmith/blob/f66d4ed08088938536fc35ef7349eacaf5ab11b8/src/core/templates.coffee", "line_start": 51, "line_end": 77} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n try\n process.chdir location\n catch error\n awkward.log chalk.red 'No such directory!'\n return\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command", "source_lang": "", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "4deba7087cfbcf772ec18ce95cba2f5d340f2071", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/4deba7087cfbcf772ec18ce95cba2f5d340f2071/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n try\n process.chdir location\n catch error\n awkward.log chalk.red 'No such directory!'\n return\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command\n```", "response": "module.exports = function(command) {\n var error, location, ref;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;\n try {\n process.chdir(location);\n } catch (error1) {\n error = error1;\n awkward.log(chalk.red('No such directory!'));\n return;\n }\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n return (require('./core'))(command);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "4deba7087cfbcf772ec18ce95cba2f5d340f2071", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/4deba7087cfbcf772ec18ce95cba2f5d340f2071/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function(command) {\n var error, location, ref;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;\n try {\n process.chdir(location);\n } catch (error1) {\n error = error1;\n awkward.log(chalk.red('No such directory!'));\n return;\n }\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n return (require('./core'))(command);\n};\n```", "response": "module.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n try\n process.chdir location\n catch error\n awkward.log chalk.red 'No such directory!'\n return\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "4deba7087cfbcf772ec18ce95cba2f5d340f2071", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/4deba7087cfbcf772ec18ce95cba2f5d340f2071/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:completion", "type": "completion", "prompt": "module.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n try", "response": "process.chdir location\n catch error\n awkward.log chalk.red 'No such directory!'\n return\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "4deba7087cfbcf772ec18ce95cba2f5d340f2071", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/4deba7087cfbcf772ec18ce95cba2f5d340f2071/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command", "source_lang": "", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6baaa7480821632dc13b0307d577754af45128b1", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6baaa7480821632dc13b0307d577754af45128b1/terminal/handler.coffee", "line_start": 1, "line_end": 11} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command\n```", "response": "module.exports = function(command) {\n var location, ref;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;\n process.chdir(location);\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n return (require('./core'))(command);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6baaa7480821632dc13b0307d577754af45128b1", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6baaa7480821632dc13b0307d577754af45128b1/terminal/handler.coffee", "line_start": 1, "line_end": 11} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = function(command) {\n var location, ref;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;\n process.chdir(location);\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n return (require('./core'))(command);\n};\n```", "response": "module.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6baaa7480821632dc13b0307d577754af45128b1", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6baaa7480821632dc13b0307d577754af45128b1/terminal/handler.coffee", "line_start": 1, "line_end": 11} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:completion", "type": "completion", "prompt": "module.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'", "response": "location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n\n (require './core') command", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6baaa7480821632dc13b0307d577754af45128b1", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6baaa7480821632dc13b0307d577754af45128b1/terminal/handler.coffee", "line_start": 1, "line_end": 11} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "child_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8/terminal/handler.coffee", "line_start": 1, "line_end": 21} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nchild_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )\n```", "response": "var child_process, exec;\n\nchild_process = require('child_process');\n\nexec = child_process.exec;\n\nmodule.exports = function(command) {\n var cp, location, ref;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;\n process.chdir(location);\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n cp = exec(command, function(e, r, b) {\n if (e) {\n awkward.log(chalk.red(e));\n }\n });\n return cp.stdout.on('data', function(data) {\n awkward.log('');\n return awkward.log(data);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8/terminal/handler.coffee", "line_start": 1, "line_end": 21} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar child_process, exec;\n\nchild_process = require('child_process');\n\nexec = child_process.exec;\n\nmodule.exports = function(command) {\n var cp, location, ref;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;\n process.chdir(location);\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n cp = exec(command, function(e, r, b) {\n if (e) {\n awkward.log(chalk.red(e));\n }\n });\n return cp.stdout.on('data', function(data) {\n awkward.log('');\n return awkward.log(data);\n });\n};\n```", "response": "child_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8/terminal/handler.coffee", "line_start": 1, "line_end": 21} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:completion", "type": "completion", "prompt": "child_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = command.split(' ')[1] ? '/home/'+process.env.USER\n process.chdir location", "response": "awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/6b7d26ab7313b8b2b08293bb0655f4e837c2e6f8/terminal/handler.coffee", "line_start": 1, "line_end": 21} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "child_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = ((loc)->\n loc = loc.split(' ')[1]\n if loc\n loc\n else\n '/home/'+process.env.USER\n )(command)\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "5e618ddc7229bd82cc472632426678ef7e4e1ee3", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/5e618ddc7229bd82cc472632426678ef7e4e1ee3/terminal/handler.coffee", "line_start": 1, "line_end": 27} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nchild_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = ((loc)->\n loc = loc.split(' ')[1]\n if loc\n loc\n else\n '/home/'+process.env.USER\n )(command)\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )\n```", "response": "var child_process, exec;\n\nchild_process = require('child_process');\n\nexec = child_process.exec;\n\nmodule.exports = function(command) {\n var cp, location;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (function(loc) {\n loc = loc.split(' ')[1];\n if (loc) {\n return loc;\n } else {\n return '/home/' + process.env.USER;\n }\n })(command);\n process.chdir(location);\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n cp = exec(command, function(e, r, b) {\n if (e) {\n awkward.log(chalk.red(e));\n }\n });\n return cp.stdout.on('data', function(data) {\n awkward.log('');\n return awkward.log(data);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "5e618ddc7229bd82cc472632426678ef7e4e1ee3", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/5e618ddc7229bd82cc472632426678ef7e4e1ee3/terminal/handler.coffee", "line_start": 1, "line_end": 27} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar child_process, exec;\n\nchild_process = require('child_process');\n\nexec = child_process.exec;\n\nmodule.exports = function(command) {\n var cp, location;\n if (!command) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n if ((command.indexOf('cd ')) > -1 || command === 'cd') {\n location = (function(loc) {\n loc = loc.split(' ')[1];\n if (loc) {\n return loc;\n } else {\n return '/home/' + process.env.USER;\n }\n })(command);\n process.chdir(location);\n awkward.log(chalk.green(`Changed directory to ${location}`));\n return;\n }\n cp = exec(command, function(e, r, b) {\n if (e) {\n awkward.log(chalk.red(e));\n }\n });\n return cp.stdout.on('data', function(data) {\n awkward.log('');\n return awkward.log(data);\n });\n};\n```", "response": "child_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = ((loc)->\n loc = loc.split(' ')[1]\n if loc\n loc\n else\n '/home/'+process.env.USER\n )(command)\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "5e618ddc7229bd82cc472632426678ef7e4e1ee3", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/5e618ddc7229bd82cc472632426678ef7e4e1ee3/terminal/handler.coffee", "line_start": 1, "line_end": 27} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:completion", "type": "completion", "prompt": "child_process = require 'child_process'\n\nexec = child_process.exec\nmodule.exports = (command)->\n if !command\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n if (command.indexOf 'cd ') > -1 or command is 'cd'\n location = ((loc)->\n loc = loc.split(' ')[1]\n if loc\n loc\n else", "response": "'/home/'+process.env.USER\n )(command)\n process.chdir location\n awkward.log chalk.green \"Changed directory to #{location}\"\n return\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log ''\n awkward.log data\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "5e618ddc7229bd82cc472632426678ef7e4e1ee3", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/5e618ddc7229bd82cc472632426678ef7e4e1ee3/terminal/handler.coffee", "line_start": 1, "line_end": 27} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "child_process = require 'child_process'\nexec = child_process.exec\nmodule.exports = (words)->\n if !words\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n command = words.join ' '\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log data\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "9ca1f0dfa84484d82dc936c0c53da38029d0c290", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/9ca1f0dfa84484d82dc936c0c53da38029d0c290/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nchild_process = require 'child_process'\nexec = child_process.exec\nmodule.exports = (words)->\n if !words\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n command = words.join ' '\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log data\n )\n```", "response": "var child_process, exec;\n\nchild_process = require('child_process');\n\nexec = child_process.exec;\n\nmodule.exports = function(words) {\n var command, cp;\n if (!words) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n command = words.join(' ');\n cp = exec(command, function(e, r, b) {\n if (e) {\n awkward.log(chalk.red(e));\n }\n });\n return cp.stdout.on('data', function(data) {\n return awkward.log(data);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "9ca1f0dfa84484d82dc936c0c53da38029d0c290", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/9ca1f0dfa84484d82dc936c0c53da38029d0c290/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar child_process, exec;\n\nchild_process = require('child_process');\n\nexec = child_process.exec;\n\nmodule.exports = function(words) {\n var command, cp;\n if (!words) {\n awkward.log(chalk.green('Well that\\'s awkward!'));\n return;\n }\n command = words.join(' ');\n cp = exec(command, function(e, r, b) {\n if (e) {\n awkward.log(chalk.red(e));\n }\n });\n return cp.stdout.on('data', function(data) {\n return awkward.log(data);\n });\n};\n```", "response": "child_process = require 'child_process'\nexec = child_process.exec\nmodule.exports = (words)->\n if !words\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n command = words.join ' '\n cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log data\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "9ca1f0dfa84484d82dc936c0c53da38029d0c290", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/9ca1f0dfa84484d82dc936c0c53da38029d0c290/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "iostreamer-X/Awkward:terminal/handler.coffee:1:completion", "type": "completion", "prompt": "child_process = require 'child_process'\nexec = child_process.exec\nmodule.exports = (words)->\n if !words\n awkward.log chalk.green 'Well that\\'s awkward!'\n return\n command = words.join ' '", "response": "cp = exec(command, (e,r,b)->\n if e\n awkward.log chalk.red e\n return\n )\n cp.stdout.on('data', (data)->\n awkward.log data\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "iostreamer-X/Awkward", "path": "terminal/handler.coffee", "license": "MIT", "commit": "9ca1f0dfa84484d82dc936c0c53da38029d0c290", "stars": 458, "source_url": "https://github.com/iostreamer-X/Awkward/blob/9ca1f0dfa84484d82dc936c0c53da38029d0c290/terminal/handler.coffee", "line_start": 1, "line_end": 15} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/user-corner.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'user-corner'\n mixins: [mixinSubscribe]\n\n propTypes:\n _teamId: T.string.isRequired\n\n getInitialState: ->\n user: @getUser()\n showMenu: false\n showSettings: false\n\n componentDidMount: ->\n @_rootEl = @refs.root\n @subscribe recorder, =>\n @setState user: @getUser()\n\n getUser: ->\n query.user(recorder.getState())\n\n getBaseArea: ->\n if @_rootEl?\n @_rootEl.getBoundingClientRect()\n else\n {}\n\n # event handlers\n\n onAvatarClick: (event) ->\n event.stopPropagation()\n @setState showMenu: (not @state.showMenu)\n\n onPopoverClose: (event) ->\n @setState showMenu: false\n\n onSettingsClick: ->\n @setState showSettings: true\n\n onSettingsClose: ->\n @setState showSettings: false\n\n onLogoutClick: ->\n userActions.userSignout()\n\n renderMenu: ->\n LightPopover\n baseArea: if @state.showMenu then @getBaseArea() else {}\n onPopoverClose: @onPopoverClose\n showClose: false\n show: @state.showMenu", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/user-corner.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/user-corner.coffee", "line_start": 27, "line_end": 76} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/user-corner.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'user-corner'\n mixins: [mixinSubscribe]\n\n propTypes:\n _teamId: T.string.isRequired\n\n getInitialState: ->\n user: @getUser()\n showMenu: false\n showSettings: false\n\n componentDidMount: ->\n @_rootEl = @refs.root\n @subscribe recorder, =>\n @setState user: @getUser()\n\n getUser: ->\n query.user(recorder.getState())\n\n getBaseArea: ->\n if @_rootEl?\n @_rootEl.getBoundingClientRect()\n else\n {}\n\n # event handlers\n\n onAvatarClick: (event) ->\n event.stopPropagation()\n @setState showMenu: (not @state.showMenu)\n\n onPopoverClose: (event) ->\n @setState showMenu: false\n\n onSettingsClick: ->\n @setState showSettings: true\n\n onSettingsClose: ->\n @setState showSettings: false\n\n onLogoutClick: ->\n userActions.userSignout()\n\n renderMenu: ->\n LightPopover\n baseArea: if @state.showMenu then @getBaseArea() else {}\n onPopoverClose: @onPopoverClose\n showClose: false\n show: @state.showMenu\n```", "response": "module.exports = React.createClass({\n displayName: 'user-corner',\n mixins: [mixinSubscribe],\n propTypes: {\n _teamId: T.string.isRequired\n },\n getInitialState: function() {\n return {\n user: this.getUser(),\n showMenu: false,\n showSettings: false\n };\n },\n componentDidMount: function() {\n this._rootEl = this.refs.root;\n return this.subscribe(recorder, () => {\n return this.setState({\n user: this.getUser()\n });\n });\n },\n getUser: function() {\n return query.user(recorder.getState());\n },\n getBaseArea: function() {\n if (this._rootEl != null) {\n return this._rootEl.getBoundingClientRect();\n } else {\n return {};\n }\n },\n // event handlers\n onAvatarClick: function(event) {\n event.stopPropagation();\n return this.setState({\n showMenu: !this.state.showMenu\n });\n },\n onPopoverClose: function(event) {\n return this.setState({\n showMenu: false\n });\n },\n onSettingsClick: function() {\n return this.setState({\n showSettings: true\n });\n },\n onSettingsClose: function() {\n return this.setState({\n showSettings: false\n });\n },\n onLogoutClick: function() {\n return userActions.userSignout();\n },\n renderMenu: function() {\n return LightPopover({\n baseArea: this.state.showMenu ? this.getBaseArea() : {},\n onPopoverClose: this.onPopoverClose,\n showClose: false,\n show: this.state.showMenu\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/user-corner.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/user-corner.coffee", "line_start": 27, "line_end": 76} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/user-corner.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'user-corner',\n mixins: [mixinSubscribe],\n propTypes: {\n _teamId: T.string.isRequired\n },\n getInitialState: function() {\n return {\n user: this.getUser(),\n showMenu: false,\n showSettings: false\n };\n },\n componentDidMount: function() {\n this._rootEl = this.refs.root;\n return this.subscribe(recorder, () => {\n return this.setState({\n user: this.getUser()\n });\n });\n },\n getUser: function() {\n return query.user(recorder.getState());\n },\n getBaseArea: function() {\n if (this._rootEl != null) {\n return this._rootEl.getBoundingClientRect();\n } else {\n return {};\n }\n },\n // event handlers\n onAvatarClick: function(event) {\n event.stopPropagation();\n return this.setState({\n showMenu: !this.state.showMenu\n });\n },\n onPopoverClose: function(event) {\n return this.setState({\n showMenu: false\n });\n },\n onSettingsClick: function() {\n return this.setState({\n showSettings: true\n });\n },\n onSettingsClose: function() {\n return this.setState({\n showSettings: false\n });\n },\n onLogoutClick: function() {\n return userActions.userSignout();\n },\n renderMenu: function() {\n return LightPopover({\n baseArea: this.state.showMenu ? this.getBaseArea() : {},\n onPopoverClose: this.onPopoverClose,\n showClose: false,\n show: this.state.showMenu\n });\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'user-corner'\n mixins: [mixinSubscribe]\n\n propTypes:\n _teamId: T.string.isRequired\n\n getInitialState: ->\n user: @getUser()\n showMenu: false\n showSettings: false\n\n componentDidMount: ->\n @_rootEl = @refs.root\n @subscribe recorder, =>\n @setState user: @getUser()\n\n getUser: ->\n query.user(recorder.getState())\n\n getBaseArea: ->\n if @_rootEl?\n @_rootEl.getBoundingClientRect()\n else\n {}\n\n # event handlers\n\n onAvatarClick: (event) ->\n event.stopPropagation()\n @setState showMenu: (not @state.showMenu)\n\n onPopoverClose: (event) ->\n @setState showMenu: false\n\n onSettingsClick: ->\n @setState showSettings: true\n\n onSettingsClose: ->\n @setState showSettings: false\n\n onLogoutClick: ->\n userActions.userSignout()\n\n renderMenu: ->\n LightPopover\n baseArea: if @state.showMenu then @getBaseArea() else {}\n onPopoverClose: @onPopoverClose\n showClose: false\n show: @state.showMenu", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/user-corner.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/user-corner.coffee", "line_start": 27, "line_end": 76} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/user-corner.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'user-corner'\n mixins: [mixinSubscribe]\n\n propTypes:\n _teamId: T.string.isRequired\n\n getInitialState: ->\n user: @getUser()\n showMenu: false\n showSettings: false\n\n componentDidMount: ->\n @_rootEl = @refs.root\n @subscribe recorder, =>\n @setState user: @getUser()\n\n getUser: ->\n query.user(recorder.getState())\n\n getBaseArea: ->\n if @_rootEl?\n @_rootEl.getBoundingClientRect()\n else\n {}", "response": "# event handlers\n\n onAvatarClick: (event) ->\n event.stopPropagation()\n @setState showMenu: (not @state.showMenu)\n\n onPopoverClose: (event) ->\n @setState showMenu: false\n\n onSettingsClick: ->\n @setState showSettings: true\n\n onSettingsClose: ->\n @setState showSettings: false\n\n onLogoutClick: ->\n userActions.userSignout()\n\n renderMenu: ->\n LightPopover\n baseArea: if @state.showMenu then @getBaseArea() else {}\n onPopoverClose: @onPopoverClose\n showClose: false\n show: @state.showMenu", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/user-corner.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/user-corner.coffee", "line_start": 27, "line_end": 76} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/user-corner.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "name: 'user-corner'\n UserMenu\n onSettingsClick: @onSettingsClick\n onVersionClick: @onVersionClick\n onLogoutClick: @onLogoutClick\n onPopoverClose: @onPopoverClose\n\n renderSettings: ->\n LightModal\n title: lang.getText('user-preferences')\n onCloseClick: @onSettingsClose\n show: @state.showSettings\n SettingsProfile data: @state.user, onModalClose: @onSettingsClose\n\n render: ->\n\n avatarStyle =\n backgroundImage: \"url('#{@state.user.get('avatarUrl')}')\"\n\n div ref: 'root', className: 'user-corner',\n div\n className: 'img-circle avatar img-36'\n style: avatarStyle\n onClick: @onAvatarClick\n @renderMenu()\n @renderSettings()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/user-corner.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/user-corner.coffee", "line_start": 77, "line_end": 102} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/user-corner.coffee:2:completion", "type": "completion", "prompt": "name: 'user-corner'\n UserMenu\n onSettingsClick: @onSettingsClick\n onVersionClick: @onVersionClick\n onLogoutClick: @onLogoutClick\n onPopoverClose: @onPopoverClose\n\n renderSettings: ->\n LightModal\n title: lang.getText('user-preferences')\n onCloseClick: @onSettingsClose\n show: @state.showSettings\n SettingsProfile data: @state.user, onModalClose: @onSettingsClose", "response": "render: ->\n\n avatarStyle =\n backgroundImage: \"url('#{@state.user.get('avatarUrl')}')\"\n\n div ref: 'root', className: 'user-corner',\n div\n className: 'img-circle avatar img-36'\n style: avatarStyle\n onClick: @onAvatarClick\n @renderMenu()\n @renderSettings()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/user-corner.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/user-corner.coffee", "line_start": 77, "line_end": 102} {"id": "jianliaoim/talk-os:talk-web/client/network/storage.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Store = require 'store2'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nnewVersion = 'jianliaoStoreV3'\n\npurifyStore = (store) ->\n drafts = store.get('drafts')\n .update 'draft', (draft) ->\n if draft\n draft.filter (v) -> v\n else\n draft\n\n drafts: drafts.toJS()\n settings: store.get('settings').toJS()\n\nwindow.addEventListener 'beforeunload', ->\n store = recorder.getState()\n data = purifyStore(store)\n\n if store.getIn(['settings', 'isLoggedIn'])\n Store.set newVersion, data\n else\n Store.remove newVersion\n\nexports.get = ->\n data = Store.get(newVersion) or {}\n Immutable.fromJS(data)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/network/storage.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/network/storage.coffee", "line_start": 1, "line_end": 29} {"id": "jianliaoim/talk-os:talk-web/client/network/storage.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nStore = require 'store2'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nnewVersion = 'jianliaoStoreV3'\n\npurifyStore = (store) ->\n drafts = store.get('drafts')\n .update 'draft', (draft) ->\n if draft\n draft.filter (v) -> v\n else\n draft\n\n drafts: drafts.toJS()\n settings: store.get('settings').toJS()\n\nwindow.addEventListener 'beforeunload', ->\n store = recorder.getState()\n data = purifyStore(store)\n\n if store.getIn(['settings', 'isLoggedIn'])\n Store.set newVersion, data\n else\n Store.remove newVersion\n\nexports.get = ->\n data = Store.get(newVersion) or {}\n Immutable.fromJS(data)\n```", "response": "var Immutable, Store, newVersion, purifyStore, recorder;\n\nStore = require('store2');\n\nrecorder = require('actions-recorder');\n\nImmutable = require('immutable');\n\nnewVersion = 'jianliaoStoreV3';\n\npurifyStore = function(store) {\n var drafts;\n drafts = store.get('drafts').update('draft', function(draft) {\n if (draft) {\n return draft.filter(function(v) {\n return v;\n });\n } else {\n return draft;\n }\n });\n return {\n drafts: drafts.toJS(),\n settings: store.get('settings').toJS()\n };\n};\n\nwindow.addEventListener('beforeunload', function() {\n var data, store;\n store = recorder.getState();\n data = purifyStore(store);\n if (store.getIn(['settings', 'isLoggedIn'])) {\n return Store.set(newVersion, data);\n } else {\n return Store.remove(newVersion);\n }\n});\n\nexports.get = function() {\n var data;\n data = Store.get(newVersion) || {};\n return Immutable.fromJS(data);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/network/storage.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/network/storage.coffee", "line_start": 1, "line_end": 29} {"id": "jianliaoim/talk-os:talk-web/client/network/storage.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Immutable, Store, newVersion, purifyStore, recorder;\n\nStore = require('store2');\n\nrecorder = require('actions-recorder');\n\nImmutable = require('immutable');\n\nnewVersion = 'jianliaoStoreV3';\n\npurifyStore = function(store) {\n var drafts;\n drafts = store.get('drafts').update('draft', function(draft) {\n if (draft) {\n return draft.filter(function(v) {\n return v;\n });\n } else {\n return draft;\n }\n });\n return {\n drafts: drafts.toJS(),\n settings: store.get('settings').toJS()\n };\n};\n\nwindow.addEventListener('beforeunload', function() {\n var data, store;\n store = recorder.getState();\n data = purifyStore(store);\n if (store.getIn(['settings', 'isLoggedIn'])) {\n return Store.set(newVersion, data);\n } else {\n return Store.remove(newVersion);\n }\n});\n\nexports.get = function() {\n var data;\n data = Store.get(newVersion) || {};\n return Immutable.fromJS(data);\n};\n```", "response": "Store = require 'store2'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nnewVersion = 'jianliaoStoreV3'\n\npurifyStore = (store) ->\n drafts = store.get('drafts')\n .update 'draft', (draft) ->\n if draft\n draft.filter (v) -> v\n else\n draft\n\n drafts: drafts.toJS()\n settings: store.get('settings').toJS()\n\nwindow.addEventListener 'beforeunload', ->\n store = recorder.getState()\n data = purifyStore(store)\n\n if store.getIn(['settings', 'isLoggedIn'])\n Store.set newVersion, data\n else\n Store.remove newVersion\n\nexports.get = ->\n data = Store.get(newVersion) or {}\n Immutable.fromJS(data)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/network/storage.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/network/storage.coffee", "line_start": 1, "line_end": 29} {"id": "jianliaoim/talk-os:talk-web/client/network/storage.coffee:1:completion", "type": "completion", "prompt": "Store = require 'store2'\nrecorder = require 'actions-recorder'\nImmutable = require 'immutable'\n\nnewVersion = 'jianliaoStoreV3'\n\npurifyStore = (store) ->\n drafts = store.get('drafts')\n .update 'draft', (draft) ->\n if draft\n draft.filter (v) -> v\n else\n draft", "response": "drafts: drafts.toJS()\n settings: store.get('settings').toJS()\n\nwindow.addEventListener 'beforeunload', ->\n store = recorder.getState()\n data = purifyStore(store)\n\n if store.getIn(['settings', 'isLoggedIn'])\n Store.set newVersion, data\n else\n Store.remove newVersion\n\nexports.get = ->\n data = Store.get(newVersion) or {}\n Immutable.fromJS(data)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/network/storage.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/network/storage.coffee", "line_start": 1, "line_end": 29} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_arguments.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "area: (x, y, x1, y1) ->\n (x - x1) * (x - y1)\n\nx: y: 10\nx1: y1: 20\n\nok area(x, y, x1, y1) is 100\n\nok(area(x, y,\n x1, y1) is 100)\n\nok(area(\n x\n y\n x1\n y1\n) is 100)\n\n\nsum_of_args: ->\n sum: 0\n sum: + val for val in arguments\n sum\n\nok sum_of_args(1, 2, 3, 4, 5) is 15", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/test/test_arguments.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_arguments.coffee", "line_start": 1, "line_end": 25} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_arguments.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\narea: (x, y, x1, y1) ->\n (x - x1) * (x - y1)\n\nx: y: 10\nx1: y1: 20\n\nok area(x, y, x1, y1) is 100\n\nok(area(x, y,\n x1, y1) is 100)\n\nok(area(\n x\n y\n x1\n y1\n) is 100)\n\n\nsum_of_args: ->\n sum: 0\n sum: + val for val in arguments\n sum\n\nok sum_of_args(1, 2, 3, 4, 5) is 15\n```", "response": "({\n area: function(x, y, x1, y1) {\n return (x - x1) * (x - y1);\n },\n x: {\n y: 10\n },\n x1: {\n y1: 20\n }\n});\n\nok(area(x, y, x1, y1) === 100);\n\nok(area(x, y, x1, y1) === 100);\n\nok(area(x, y, x1, y1) === 100);\n\n({\n sum_of_args: function() {\n var val;\n ({\n sum: 0,\n sum: (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = arguments.length; i < len; i++) {\n val = arguments[i];\n results.push(+val);\n }\n return results;\n }).apply(this, arguments)\n });\n return sum;\n }\n});\n\nok(sum_of_args(1, 2, 3, 4, 5) === 15);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/test/test_arguments.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_arguments.coffee", "line_start": 1, "line_end": 25} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_arguments.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n area: function(x, y, x1, y1) {\n return (x - x1) * (x - y1);\n },\n x: {\n y: 10\n },\n x1: {\n y1: 20\n }\n});\n\nok(area(x, y, x1, y1) === 100);\n\nok(area(x, y, x1, y1) === 100);\n\nok(area(x, y, x1, y1) === 100);\n\n({\n sum_of_args: function() {\n var val;\n ({\n sum: 0,\n sum: (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = arguments.length; i < len; i++) {\n val = arguments[i];\n results.push(+val);\n }\n return results;\n }).apply(this, arguments)\n });\n return sum;\n }\n});\n\nok(sum_of_args(1, 2, 3, 4, 5) === 15);\n```", "response": "area: (x, y, x1, y1) ->\n (x - x1) * (x - y1)\n\nx: y: 10\nx1: y1: 20\n\nok area(x, y, x1, y1) is 100\n\nok(area(x, y,\n x1, y1) is 100)\n\nok(area(\n x\n y\n x1\n y1\n) is 100)\n\n\nsum_of_args: ->\n sum: 0\n sum: + val for val in arguments\n sum\n\nok sum_of_args(1, 2, 3, 4, 5) is 15", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/test/test_arguments.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_arguments.coffee", "line_start": 1, "line_end": 25} {"id": "twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_arguments.coffee:1:completion", "type": "completion", "prompt": "area: (x, y, x1, y1) ->\n (x - x1) * (x - y1)\n\nx: y: 10\nx1: y1: 20\n\nok area(x, y, x1, y1) is 100\n\nok(area(x, y,\n x1, y1) is 100)\n\nok(area(", "response": "x\n y\n x1\n y1\n) is 100)\n\n\nsum_of_args: ->\n sum: 0\n sum: + val for val in arguments\n sum\n\nok sum_of_args(1, 2, 3, 4, 5) is 15", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "lib/coffee/lib/coffee-script/test/test_arguments.coffee", "license": "MIT", "commit": "971837f7d7a5e96cf5a5fdb52e52748060ed2c68", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_arguments.coffee", "line_start": 1, "line_end": 25} {"id": "jianliaoim/talk-os:talk-api2x/migrations/1417421264445-add-talkai.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "exports.up = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n teams = db.teams.find()\n teams.forEach (team) ->\n db.members.update\n user: robot._id\n team: team._id\n ,\n user: robot._id\n team: team._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n\n room = db.rooms.findOne team: team._id, isGeneral: true\n if room?._id\n db.members.update\n user: robot._id\n room: room._id\n ,\n user: robot._id\n room: room._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n next()\n\nexports.down = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n db.members.remove user: robot._id\n next()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/migrations/1417421264445-add-talkai.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417421264445-add-talkai.coffee", "line_start": 1, "line_end": 37} {"id": "jianliaoim/talk-os:talk-api2x/migrations/1417421264445-add-talkai.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nexports.up = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n teams = db.teams.find()\n teams.forEach (team) ->\n db.members.update\n user: robot._id\n team: team._id\n ,\n user: robot._id\n team: team._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n\n room = db.rooms.findOne team: team._id, isGeneral: true\n if room?._id\n db.members.update\n user: robot._id\n room: room._id\n ,\n user: robot._id\n room: room._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n next()\n\nexports.down = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n db.members.remove user: robot._id\n next()\n```", "response": "exports.up = function(next) {\n mongo(function() {\n var robot, teams;\n robot = db.users.findOne({\n name: 'talkai',\n isRobot: true\n });\n teams = db.teams.find();\n return teams.forEach(function(team) {\n var room;\n db.members.update({\n user: robot._id,\n team: team._id\n }, {\n user: robot._id,\n team: team._id,\n isQuit: false,\n role: 'member',\n createdAt: ISODate(),\n updatedAt: ISODate()\n }, {\n upsert: true\n });\n room = db.rooms.findOne({\n team: team._id,\n isGeneral: true\n });\n if (room != null ? room._id : void 0) {\n return db.members.update({\n user: robot._id,\n room: room._id\n }, {\n user: robot._id,\n room: room._id,\n isQuit: false,\n role: 'member',\n createdAt: ISODate(),\n updatedAt: ISODate()\n }, {\n upsert: true\n });\n }\n });\n });\n return next();\n};\n\nexports.down = function(next) {\n mongo(function() {\n var robot;\n robot = db.users.findOne({\n name: 'talkai',\n isRobot: true\n });\n return db.members.remove({\n user: robot._id\n });\n });\n return next();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/migrations/1417421264445-add-talkai.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417421264445-add-talkai.coffee", "line_start": 1, "line_end": 37} {"id": "jianliaoim/talk-os:talk-api2x/migrations/1417421264445-add-talkai.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nexports.up = function(next) {\n mongo(function() {\n var robot, teams;\n robot = db.users.findOne({\n name: 'talkai',\n isRobot: true\n });\n teams = db.teams.find();\n return teams.forEach(function(team) {\n var room;\n db.members.update({\n user: robot._id,\n team: team._id\n }, {\n user: robot._id,\n team: team._id,\n isQuit: false,\n role: 'member',\n createdAt: ISODate(),\n updatedAt: ISODate()\n }, {\n upsert: true\n });\n room = db.rooms.findOne({\n team: team._id,\n isGeneral: true\n });\n if (room != null ? room._id : void 0) {\n return db.members.update({\n user: robot._id,\n room: room._id\n }, {\n user: robot._id,\n room: room._id,\n isQuit: false,\n role: 'member',\n createdAt: ISODate(),\n updatedAt: ISODate()\n }, {\n upsert: true\n });\n }\n });\n });\n return next();\n};\n\nexports.down = function(next) {\n mongo(function() {\n var robot;\n robot = db.users.findOne({\n name: 'talkai',\n isRobot: true\n });\n return db.members.remove({\n user: robot._id\n });\n });\n return next();\n};\n```", "response": "exports.up = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n teams = db.teams.find()\n teams.forEach (team) ->\n db.members.update\n user: robot._id\n team: team._id\n ,\n user: robot._id\n team: team._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n\n room = db.rooms.findOne team: team._id, isGeneral: true\n if room?._id\n db.members.update\n user: robot._id\n room: room._id\n ,\n user: robot._id\n room: room._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n next()\n\nexports.down = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n db.members.remove user: robot._id\n next()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/migrations/1417421264445-add-talkai.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417421264445-add-talkai.coffee", "line_start": 1, "line_end": 37} {"id": "jianliaoim/talk-os:talk-api2x/migrations/1417421264445-add-talkai.coffee:1:completion", "type": "completion", "prompt": "exports.up = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n teams = db.teams.find()\n teams.forEach (team) ->\n db.members.update\n user: robot._id\n team: team._id\n ,\n user: robot._id\n team: team._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n\n room = db.rooms.findOne team: team._id, isGeneral: true", "response": "if room?._id\n db.members.update\n user: robot._id\n room: room._id\n ,\n user: robot._id\n room: room._id\n isQuit: false\n role: 'member'\n createdAt: ISODate()\n updatedAt: ISODate()\n , upsert: true\n next()\n\nexports.down = (next) ->\n mongo ->\n robot = db.users.findOne name: 'talkai', isRobot: true\n db.members.remove user: robot._id\n next()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/migrations/1417421264445-add-talkai.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417421264445-add-talkai.coffee", "line_start": 1, "line_end": 37} {"id": "Nedomas/databound:spec/crud/find_by.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "describe '#findBy', ->\n it 'should single record when it exists', ->\n records =[\n { id: 1, name: 'Nikki' }\n ]\n\n stubResponse success: true, records: records, ->\n User.findBy(name: 'Nikki').then (user) ->\n expect(user).to.eql(id: 1, name: 'Nikki')\n\n it 'should undefined when it doesnt exist', ->\n stubResponse success: true, records: [], ->\n User.findBy(name: 'John').then (user) ->\n expect(user).to.eql(undefined)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Nedomas/databound", "path": "spec/crud/find_by.coffee", "license": "MIT", "commit": "a02f231f1c3964eb8584adf55d7709b656e7e4a4", "stars": 452, "source_url": "https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find_by.coffee", "line_start": 1, "line_end": 14} {"id": "Nedomas/databound:spec/crud/find_by.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndescribe '#findBy', ->\n it 'should single record when it exists', ->\n records =[\n { id: 1, name: 'Nikki' }\n ]\n\n stubResponse success: true, records: records, ->\n User.findBy(name: 'Nikki').then (user) ->\n expect(user).to.eql(id: 1, name: 'Nikki')\n\n it 'should undefined when it doesnt exist', ->\n stubResponse success: true, records: [], ->\n User.findBy(name: 'John').then (user) ->\n expect(user).to.eql(undefined)\n```", "response": "describe('#findBy', function() {\n it('should single record when it exists', function() {\n var records;\n records = [\n {\n id: 1,\n name: 'Nikki'\n }\n ];\n return stubResponse({\n success: true,\n records: records\n }, function() {\n return User.findBy({\n name: 'Nikki'\n }).then(function(user) {\n return expect(user).to.eql({\n id: 1,\n name: 'Nikki'\n });\n });\n });\n });\n return it('should undefined when it doesnt exist', function() {\n return stubResponse({\n success: true,\n records: []\n }, function() {\n return User.findBy({\n name: 'John'\n }).then(function(user) {\n return expect(user).to.eql(void 0);\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Nedomas/databound", "path": "spec/crud/find_by.coffee", "license": "MIT", "commit": "a02f231f1c3964eb8584adf55d7709b656e7e4a4", "stars": 452, "source_url": "https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find_by.coffee", "line_start": 1, "line_end": 14} {"id": "Nedomas/databound:spec/crud/find_by.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndescribe('#findBy', function() {\n it('should single record when it exists', function() {\n var records;\n records = [\n {\n id: 1,\n name: 'Nikki'\n }\n ];\n return stubResponse({\n success: true,\n records: records\n }, function() {\n return User.findBy({\n name: 'Nikki'\n }).then(function(user) {\n return expect(user).to.eql({\n id: 1,\n name: 'Nikki'\n });\n });\n });\n });\n return it('should undefined when it doesnt exist', function() {\n return stubResponse({\n success: true,\n records: []\n }, function() {\n return User.findBy({\n name: 'John'\n }).then(function(user) {\n return expect(user).to.eql(void 0);\n });\n });\n });\n});\n```", "response": "describe '#findBy', ->\n it 'should single record when it exists', ->\n records =[\n { id: 1, name: 'Nikki' }\n ]\n\n stubResponse success: true, records: records, ->\n User.findBy(name: 'Nikki').then (user) ->\n expect(user).to.eql(id: 1, name: 'Nikki')\n\n it 'should undefined when it doesnt exist', ->\n stubResponse success: true, records: [], ->\n User.findBy(name: 'John').then (user) ->\n expect(user).to.eql(undefined)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Nedomas/databound", "path": "spec/crud/find_by.coffee", "license": "MIT", "commit": "a02f231f1c3964eb8584adf55d7709b656e7e4a4", "stars": 452, "source_url": "https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find_by.coffee", "line_start": 1, "line_end": 14} {"id": "Nedomas/databound:spec/crud/find_by.coffee:1:completion", "type": "completion", "prompt": "describe '#findBy', ->\n it 'should single record when it exists', ->\n records =[\n { id: 1, name: 'Nikki' }\n ]\n\n stubResponse success: true, records: records, ->", "response": "User.findBy(name: 'Nikki').then (user) ->\n expect(user).to.eql(id: 1, name: 'Nikki')\n\n it 'should undefined when it doesnt exist', ->\n stubResponse success: true, records: [], ->\n User.findBy(name: 'John').then (user) ->\n expect(user).to.eql(undefined)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Nedomas/databound", "path": "spec/crud/find_by.coffee", "license": "MIT", "commit": "a02f231f1c3964eb8584adf55d7709b656e7e4a4", "stars": 452, "source_url": "https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find_by.coffee", "line_start": 1, "line_end": 14} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n # console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n # console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n # console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n # logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)\n if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n # console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n # console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n # console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n # console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n # console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n # console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n # logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)\n if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n # console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n # console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n # console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []\n```", "response": "var Journal;\n\nmodule.exports = Journal = class Journal {\n constructor(filename) {\n this.start = this.start.bind(this);\n this.shutdown = this.shutdown.bind(this);\n this.initialize_log = this.initialize_log.bind(this);\n this.replay_log = this.replay_log.bind(this);\n this.filename = filename;\n this.filename = this.filename || 'journal.log';\n this.readstream = null;\n this.writefd = null;\n }\n\n start(execute_operation) {\n return QFS.exists(this.filename).then((retval) => {\n if (retval) {\n // console.log 'LOG EXISTS'\n return Q.fcall(() => {\n return this.replay_log(execute_operation).then(() => {\n // console.log 'DONE REPLAYING'\n // This is dangerous\n return this.initialize_log(\"a\");\n });\n });\n } else {\n // console.log 'LOG DOES NOT EXIST'\n return Q.fcall(() => {\n return this.initialize_log().then(() => {\n return null;\n });\n });\n }\n });\n }\n\n shutdown() {\n var promise;\n // logger.info 'SHUTTING DOWN JOURNAL'\n promise = Q.when(null);\n if (this.writefd !== null) {\n promise = Q.nfcall(fs.fsync, this.writefd).then(() => {\n return Q.nfcall(fs.close, this.writefd).then(() => {\n return this.writefd = null;\n });\n });\n }\n return promise;\n }\n\n initialize_log(flags) {\n if (!flags) {\n flags = \"w\";\n }\n // console.log 'INITIALIZING LOG'\n return Q.nfcall(fs.open, this.filename, flags).then((writefd) => {\n // console.log 'GOT FD', writefd\n return this.writefd = writefd;\n });\n }\n\n replay_log(execute_operation) {\n var deferred, parts;\n // XXX: This code is basically guaranteed to have chunking problems right now.\n // Fix and then test rigorously!!!\n this.readstream = fs.createReadStream(this.filename, {\n flags: \"r\"\n });\n // console.log 'GOT READSTREAM'\n deferred = Q.defer();\n return parts = [];\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Journal;\n\nmodule.exports = Journal = class Journal {\n constructor(filename) {\n this.start = this.start.bind(this);\n this.shutdown = this.shutdown.bind(this);\n this.initialize_log = this.initialize_log.bind(this);\n this.replay_log = this.replay_log.bind(this);\n this.filename = filename;\n this.filename = this.filename || 'journal.log';\n this.readstream = null;\n this.writefd = null;\n }\n\n start(execute_operation) {\n return QFS.exists(this.filename).then((retval) => {\n if (retval) {\n // console.log 'LOG EXISTS'\n return Q.fcall(() => {\n return this.replay_log(execute_operation).then(() => {\n // console.log 'DONE REPLAYING'\n // This is dangerous\n return this.initialize_log(\"a\");\n });\n });\n } else {\n // console.log 'LOG DOES NOT EXIST'\n return Q.fcall(() => {\n return this.initialize_log().then(() => {\n return null;\n });\n });\n }\n });\n }\n\n shutdown() {\n var promise;\n // logger.info 'SHUTTING DOWN JOURNAL'\n promise = Q.when(null);\n if (this.writefd !== null) {\n promise = Q.nfcall(fs.fsync, this.writefd).then(() => {\n return Q.nfcall(fs.close, this.writefd).then(() => {\n return this.writefd = null;\n });\n });\n }\n return promise;\n }\n\n initialize_log(flags) {\n if (!flags) {\n flags = \"w\";\n }\n // console.log 'INITIALIZING LOG'\n return Q.nfcall(fs.open, this.filename, flags).then((writefd) => {\n // console.log 'GOT FD', writefd\n return this.writefd = writefd;\n });\n }\n\n replay_log(execute_operation) {\n var deferred, parts;\n // XXX: This code is basically guaranteed to have chunking problems right now.\n // Fix and then test rigorously!!!\n this.readstream = fs.createReadStream(this.filename, {\n flags: \"r\"\n });\n // console.log 'GOT READSTREAM'\n deferred = Q.defer();\n return parts = [];\n }\n\n};\n```", "response": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n # console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n # console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n # console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n # logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)\n if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n # console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n # console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n # console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n # console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n # console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n # console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n # logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)", "response": "if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n # console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n # console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n # console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# console.log 'REGISTERING HANDLERS'\n @readstream.on 'end', =>\n # console.log 'done reading'\n\n @readstream.on 'error', (error) =>\n # logger.error('Error on readstream', error)\n\n @readstream.on 'close', (close) =>\n # logger.info 'closed readstream'\n deferred.resolve()\n\n @readstream.on 'readable', =>\n # console.log 'READABLE EVENT'\n data = @readstream.read()\n # console.log 'READ', data, data.isEncoding\n\n lenbin = data.slice(0,4)\n if lenbin.length != 4\n throw Error(\"Didn't read 4 bytes for length prefix\")\n\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in lenbin.toString('binary').split('')), 0 )[0]\n\n # console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n # console.log 'LENS', data.length, chunk.length, rest.length\n # console.log 'CHUNK', chunk.toString()\n\n # console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n # console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n # console.log 'registered handlers'\n\n return deferred.promise\n\n record: (message) =>\n # console.log 'RECORDING', message", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 61, "line_end": 110} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:completion", "type": "completion", "prompt": "# console.log 'REGISTERING HANDLERS'\n @readstream.on 'end', =>\n # console.log 'done reading'\n\n @readstream.on 'error', (error) =>\n # logger.error('Error on readstream', error)\n\n @readstream.on 'close', (close) =>\n # logger.info 'closed readstream'\n deferred.resolve()\n\n @readstream.on 'readable', =>\n # console.log 'READABLE EVENT'\n data = @readstream.read()\n # console.log 'READ', data, data.isEncoding\n\n lenbin = data.slice(0,4)\n if lenbin.length != 4\n throw Error(\"Didn't read 4 bytes for length prefix\")\n\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in lenbin.toString('binary').split('')), 0 )[0]\n\n # console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)", "response": "if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n # console.log 'LENS', data.length, chunk.length, rest.length\n # console.log 'CHUNK', chunk.toString()\n\n # console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n # console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n # console.log 'registered handlers'\n\n return deferred.promise\n\n record: (message) =>\n # console.log 'RECORDING', message", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 61, "line_end": 110} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if @writefd == null\n # console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n # console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n # console.log 'FLUSHED'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif @writefd == null\n # console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n # console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n # console.log 'FLUSHED'\n```", "response": "var buf, l, part, writeq;\n\nif (this.writefd === null) {\n // console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null);\n}\n\n// message = JSON.stringify(operation)\nl = message.length;\n\npart = jspack.Pack('I', [l]);\n\nbuf = Buffer.concat([Buffer(part), Buffer(message)]);\n\nwriteq = Q.nfcall(fs.write, this.writefd, buf, 0, buf.length, null);\n\n// console.log 'DONE WRITING', writeq, buf\nreturn writeq;\n\n({\n flush: () => {\n return Q.nfcall(fs.fsync, this.writefd).then(() => {});\n }\n});\n\n// console.log 'FLUSHED'", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar buf, l, part, writeq;\n\nif (this.writefd === null) {\n // console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null);\n}\n\n// message = JSON.stringify(operation)\nl = message.length;\n\npart = jspack.Pack('I', [l]);\n\nbuf = Buffer.concat([Buffer(part), Buffer(message)]);\n\nwriteq = Q.nfcall(fs.write, this.writefd, buf, 0, buf.length, null);\n\n// console.log 'DONE WRITING', writeq, buf\nreturn writeq;\n\n({\n flush: () => {\n return Q.nfcall(fs.fsync, this.writefd).then(() => {});\n }\n});\n\n// console.log 'FLUSHED'\n```", "response": "if @writefd == null\n # console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n # console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n # console.log 'FLUSHED'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:completion", "type": "completion", "prompt": "if @writefd == null\n # console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])", "response": "buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n # console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n # console.log 'FLUSHED'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "ccba3845df6afdfde2bc4da0f3abb62494473ddc", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)\n if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)\n if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []\n```", "response": "var Journal;\n\nmodule.exports = Journal = class Journal {\n constructor(filename) {\n this.start = this.start.bind(this);\n this.shutdown = this.shutdown.bind(this);\n this.initialize_log = this.initialize_log.bind(this);\n this.replay_log = this.replay_log.bind(this);\n this.filename = filename;\n this.filename = this.filename || 'journal.log';\n this.readstream = null;\n this.writefd = null;\n }\n\n start(execute_operation) {\n return QFS.exists(this.filename).then((retval) => {\n if (retval) {\n console.log('LOG EXISTS');\n return Q.fcall(() => {\n return this.replay_log(execute_operation).then(() => {\n console.log('DONE REPLAYING');\n // This is dangerous\n return this.initialize_log(\"a\");\n });\n });\n } else {\n console.log('LOG DOES NOT EXIST');\n return Q.fcall(() => {\n return this.initialize_log().then(() => {\n return null;\n });\n });\n }\n });\n }\n\n shutdown() {\n var promise;\n logger.info('SHUTTING DOWN JOURNAL');\n promise = Q.when(null);\n if (this.writefd !== null) {\n promise = Q.nfcall(fs.fsync, this.writefd).then(() => {\n return Q.nfcall(fs.close, this.writefd).then(() => {\n return this.writefd = null;\n });\n });\n }\n return promise;\n }\n\n initialize_log(flags) {\n if (!flags) {\n flags = \"w\";\n }\n console.log('INITIALIZING LOG');\n return Q.nfcall(fs.open, this.filename, flags).then((writefd) => {\n console.log('GOT FD', writefd);\n return this.writefd = writefd;\n });\n }\n\n replay_log(execute_operation) {\n var deferred, parts;\n // XXX: This code is basically guaranteed to have chunking problems right now.\n // Fix and then test rigorously!!!\n this.readstream = fs.createReadStream(this.filename, {\n flags: \"r\"\n });\n console.log('GOT READSTREAM');\n deferred = Q.defer();\n return parts = [];\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Journal;\n\nmodule.exports = Journal = class Journal {\n constructor(filename) {\n this.start = this.start.bind(this);\n this.shutdown = this.shutdown.bind(this);\n this.initialize_log = this.initialize_log.bind(this);\n this.replay_log = this.replay_log.bind(this);\n this.filename = filename;\n this.filename = this.filename || 'journal.log';\n this.readstream = null;\n this.writefd = null;\n }\n\n start(execute_operation) {\n return QFS.exists(this.filename).then((retval) => {\n if (retval) {\n console.log('LOG EXISTS');\n return Q.fcall(() => {\n return this.replay_log(execute_operation).then(() => {\n console.log('DONE REPLAYING');\n // This is dangerous\n return this.initialize_log(\"a\");\n });\n });\n } else {\n console.log('LOG DOES NOT EXIST');\n return Q.fcall(() => {\n return this.initialize_log().then(() => {\n return null;\n });\n });\n }\n });\n }\n\n shutdown() {\n var promise;\n logger.info('SHUTTING DOWN JOURNAL');\n promise = Q.when(null);\n if (this.writefd !== null) {\n promise = Q.nfcall(fs.fsync, this.writefd).then(() => {\n return Q.nfcall(fs.close, this.writefd).then(() => {\n return this.writefd = null;\n });\n });\n }\n return promise;\n }\n\n initialize_log(flags) {\n if (!flags) {\n flags = \"w\";\n }\n console.log('INITIALIZING LOG');\n return Q.nfcall(fs.open, this.filename, flags).then((writefd) => {\n console.log('GOT FD', writefd);\n return this.writefd = writefd;\n });\n }\n\n replay_log(execute_operation) {\n var deferred, parts;\n // XXX: This code is basically guaranteed to have chunking problems right now.\n // Fix and then test rigorously!!!\n this.readstream = fs.createReadStream(this.filename, {\n flags: \"r\"\n });\n console.log('GOT READSTREAM');\n deferred = Q.defer();\n return parts = [];\n }\n\n};\n```", "response": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)\n if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @readstream = null\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n shutdown: =>\n logger.info 'SHUTTING DOWN JOURNAL'\n\n promise = Q.when(null)", "response": "if @writefd != null\n promise = Q.nfcall(fs.fsync, @writefd).then =>\n Q.nfcall(fs.close, @writefd).then =>\n @writefd = null\n return promise\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n parts = []", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 11, "line_end": 60} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "console.log 'REGISTERING HANDLERS'\n @readstream.on 'end', =>\n console.log 'done reading'\n\n @readstream.on 'error', (error) =>\n logger.error('Error on readstream', error)\n\n @readstream.on 'close', (close) =>\n logger.info 'closed readstream'\n deferred.resolve()\n\n @readstream.on 'readable', =>\n console.log 'READABLE EVENT'\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n\n lenbin = data.slice(0,4)\n if lenbin.length != 4\n throw Error(\"Didn't read 4 bytes for length prefix\")\n\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in lenbin.toString('binary').split('')), 0 )[0]\n\n console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n console.log 'registered handlers'\n\n return deferred.promise\n\n record: (message) =>\n console.log 'RECORDING', message", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 61, "line_end": 110} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:completion", "type": "completion", "prompt": "console.log 'REGISTERING HANDLERS'\n @readstream.on 'end', =>\n console.log 'done reading'\n\n @readstream.on 'error', (error) =>\n logger.error('Error on readstream', error)\n\n @readstream.on 'close', (close) =>\n logger.info 'closed readstream'\n deferred.resolve()\n\n @readstream.on 'readable', =>\n console.log 'READABLE EVENT'\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n\n lenbin = data.slice(0,4)\n if lenbin.length != 4\n throw Error(\"Didn't read 4 bytes for length prefix\")\n\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in lenbin.toString('binary').split('')), 0 )[0]\n\n console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)", "response": "if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n console.log 'registered handlers'\n\n return deferred.promise\n\n record: (message) =>\n console.log 'RECORDING', message", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 61, "line_end": 110} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'\n```", "response": "var buf, l, part, writeq;\n\nif (this.writefd === null) {\n console.log('NO WRITEFD AVAILABLE');\n return Q.when(null);\n}\n\n// message = JSON.stringify(operation)\nl = message.length;\n\npart = jspack.Pack('I', [l]);\n\nbuf = Buffer.concat([Buffer(part), Buffer(message)]);\n\nwriteq = Q.nfcall(fs.write, this.writefd, buf, 0, buf.length, null);\n\nconsole.log('DONE WRITING', writeq, buf);\n\nreturn writeq;\n\n({\n flush: () => {\n return Q.nfcall(fs.fsync, this.writefd).then(() => {\n return console.log('FLUSHED');\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar buf, l, part, writeq;\n\nif (this.writefd === null) {\n console.log('NO WRITEFD AVAILABLE');\n return Q.when(null);\n}\n\n// message = JSON.stringify(operation)\nl = message.length;\n\npart = jspack.Pack('I', [l]);\n\nbuf = Buffer.concat([Buffer(part), Buffer(message)]);\n\nwriteq = Q.nfcall(fs.write, this.writefd, buf, 0, buf.length, null);\n\nconsole.log('DONE WRITING', writeq, buf);\n\nreturn writeq;\n\n({\n flush: () => {\n return Q.nfcall(fs.fsync, this.writefd).then(() => {\n return console.log('FLUSHED');\n });\n }\n});\n```", "response": "if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:completion", "type": "completion", "prompt": "if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])", "response": "buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/lib/journal.coffee", "line_start": 111, "line_end": 129} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "console.log 'REGISTERING HANDLERS'\n @readstream.on 'end', =>\n console.log 'done reading'\n @readstream.close()\n\n @readstream.on 'error', (error) =>\n logger.error('Error on readstream', error)\n\n @readstream.on 'close', (close) =>\n logger.info 'closed readstream'\n deferred.resolve()\n\n @readstream.on 'readable', =>\n console.log 'READABLE EVENT'\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n\n lenbin = data.slice(0,4)\n if lenbin.length != 4\n throw Error(\"Didn't read 4 bytes for length prefix\")\n\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in lenbin.toString('binary').split('')), 0 )[0]\n\n console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n console.log 'registered handlers'\n\n return deferred.promise\n\n record: (message) =>", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "60128172e99e262c89bca29af515ad6d1080332f", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/60128172e99e262c89bca29af515ad6d1080332f/lib/journal.coffee", "line_start": 61, "line_end": 110} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:completion", "type": "completion", "prompt": "console.log 'REGISTERING HANDLERS'\n @readstream.on 'end', =>\n console.log 'done reading'\n @readstream.close()\n\n @readstream.on 'error', (error) =>\n logger.error('Error on readstream', error)\n\n @readstream.on 'close', (close) =>\n logger.info 'closed readstream'\n deferred.resolve()\n\n @readstream.on 'readable', =>\n console.log 'READABLE EVENT'\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n\n lenbin = data.slice(0,4)\n if lenbin.length != 4\n throw Error(\"Didn't read 4 bytes for length prefix\")\n\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in lenbin.toString('binary').split('')), 0 )[0]\n\n console.log 'lenprefix', lenprefix", "response": "chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n console.log 'registered handlers'\n\n return deferred.promise\n\n record: (message) =>", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "60128172e99e262c89bca29af515ad6d1080332f", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/60128172e99e262c89bca29af515ad6d1080332f/lib/journal.coffee", "line_start": 61, "line_end": 110} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "console.log 'RECORDING', message\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "60128172e99e262c89bca29af515ad6d1080332f", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/60128172e99e262c89bca29af515ad6d1080332f/lib/journal.coffee", "line_start": 111, "line_end": 130} {"id": "buttercoin/buttercoin:lib/journal.coffee:3:completion", "type": "completion", "prompt": "console.log 'RECORDING', message\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])", "response": "buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "60128172e99e262c89bca29af515ad6d1080332f", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/60128172e99e262c89bca29af515ad6d1080332f/lib/journal.coffee", "line_start": 111, "line_end": 130} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n Q.fcall =>\n parts = []\n @readstream.on 'end', =>\n console.log 'done reading'\n @readstream.close()\n deferred.resolve()\n\n @readstream.on 'readable', =>\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in data.slice(0,4).toString('binary').split('')), 0 )[0]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/lib/journal.coffee", "line_start": 10, "line_end": 59} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n Q.fcall =>\n parts = []\n @readstream.on 'end', =>\n console.log 'done reading'\n @readstream.close()\n deferred.resolve()\n\n @readstream.on 'readable', =>\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in data.slice(0,4).toString('binary').split('')), 0 )[0]\n```", "response": "var Journal;\n\nmodule.exports = Journal = class Journal {\n constructor(filename) {\n this.start = this.start.bind(this);\n this.initialize_log = this.initialize_log.bind(this);\n this.replay_log = this.replay_log.bind(this);\n this.filename = filename;\n this.filename = this.filename || 'journal.log';\n this.writefd = null;\n }\n\n start(execute_operation) {\n return QFS.exists(this.filename).then((retval) => {\n if (retval) {\n console.log('LOG EXISTS');\n return Q.fcall(() => {\n return this.replay_log(execute_operation).then(() => {\n console.log('DONE REPLAYING');\n // This is dangerous\n return this.initialize_log(\"a\");\n });\n });\n } else {\n console.log('LOG DOES NOT EXIST');\n return Q.fcall(() => {\n return this.initialize_log().then(() => {\n return null;\n });\n });\n }\n });\n }\n\n initialize_log(flags) {\n if (!flags) {\n flags = \"w\";\n }\n console.log('INITIALIZING LOG');\n return Q.nfcall(fs.open, this.filename, flags).then((writefd) => {\n console.log('GOT FD', writefd);\n return this.writefd = writefd;\n });\n }\n\n replay_log(execute_operation) {\n var deferred;\n // XXX: This code is basically guaranteed to have chunking problems right now.\n // Fix and then test rigorously!!!\n this.readstream = fs.createReadStream(this.filename, {\n flags: \"r\"\n });\n console.log('GOT READSTREAM');\n deferred = Q.defer();\n return Q.fcall(() => {\n var parts;\n parts = [];\n this.readstream.on('end', () => {\n console.log('done reading');\n this.readstream.close();\n return deferred.resolve();\n });\n return this.readstream.on('readable', () => {\n var c, data, lenprefix;\n data = this.readstream.read();\n console.log('READ', data, data.isEncoding);\n return lenprefix = jspack.Unpack('I', (function() {\n var i, len, ref, results;\n ref = data.slice(0, 4).toString('binary').split('');\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n c = ref[i];\n results.push(c.charCodeAt(0));\n }\n return results;\n })(), 0)[0];\n });\n });\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/lib/journal.coffee", "line_start": 10, "line_end": 59} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Journal;\n\nmodule.exports = Journal = class Journal {\n constructor(filename) {\n this.start = this.start.bind(this);\n this.initialize_log = this.initialize_log.bind(this);\n this.replay_log = this.replay_log.bind(this);\n this.filename = filename;\n this.filename = this.filename || 'journal.log';\n this.writefd = null;\n }\n\n start(execute_operation) {\n return QFS.exists(this.filename).then((retval) => {\n if (retval) {\n console.log('LOG EXISTS');\n return Q.fcall(() => {\n return this.replay_log(execute_operation).then(() => {\n console.log('DONE REPLAYING');\n // This is dangerous\n return this.initialize_log(\"a\");\n });\n });\n } else {\n console.log('LOG DOES NOT EXIST');\n return Q.fcall(() => {\n return this.initialize_log().then(() => {\n return null;\n });\n });\n }\n });\n }\n\n initialize_log(flags) {\n if (!flags) {\n flags = \"w\";\n }\n console.log('INITIALIZING LOG');\n return Q.nfcall(fs.open, this.filename, flags).then((writefd) => {\n console.log('GOT FD', writefd);\n return this.writefd = writefd;\n });\n }\n\n replay_log(execute_operation) {\n var deferred;\n // XXX: This code is basically guaranteed to have chunking problems right now.\n // Fix and then test rigorously!!!\n this.readstream = fs.createReadStream(this.filename, {\n flags: \"r\"\n });\n console.log('GOT READSTREAM');\n deferred = Q.defer();\n return Q.fcall(() => {\n var parts;\n parts = [];\n this.readstream.on('end', () => {\n console.log('done reading');\n this.readstream.close();\n return deferred.resolve();\n });\n return this.readstream.on('readable', () => {\n var c, data, lenprefix;\n data = this.readstream.read();\n console.log('READ', data, data.isEncoding);\n return lenprefix = jspack.Unpack('I', (function() {\n var i, len, ref, results;\n ref = data.slice(0, 4).toString('binary').split('');\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n c = ref[i];\n results.push(c.charCodeAt(0));\n }\n return results;\n })(), 0)[0];\n });\n });\n }\n\n};\n```", "response": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'\n Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n Q.fcall =>\n parts = []\n @readstream.on 'end', =>\n console.log 'done reading'\n @readstream.close()\n deferred.resolve()\n\n @readstream.on 'readable', =>\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in data.slice(0,4).toString('binary').split('')), 0 )[0]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/lib/journal.coffee", "line_start": 10, "line_end": 59} {"id": "buttercoin/buttercoin:lib/journal.coffee:1:completion", "type": "completion", "prompt": "module.exports = class Journal\n constructor: (@filename) ->\n @filename = @filename or 'journal.log'\n @writefd = null\n\n start: (execute_operation) =>\n return QFS.exists(@filename).then (retval) =>\n if retval\n console.log 'LOG EXISTS'\n Q.fcall =>\n @replay_log(execute_operation).then =>\n console.log 'DONE REPLAYING'\n # This is dangerous\n @initialize_log(\"a\")\n else\n console.log 'LOG DOES NOT EXIST'\n Q.fcall =>\n @initialize_log().then =>\n return null\n\n initialize_log: (flags) =>\n if not flags\n flags = \"w\"\n console.log 'INITIALIZING LOG'", "response": "Q.nfcall(fs.open, @filename, flags).then (writefd) =>\n console.log 'GOT FD', writefd\n @writefd = writefd\n\n replay_log: (execute_operation) =>\n # XXX: This code is basically guaranteed to have chunking problems right now.\n # Fix and then test rigorously!!!\n\n @readstream = fs.createReadStream(@filename, {flags: \"r\"})\n\n console.log 'GOT READSTREAM'\n\n deferred = Q.defer()\n\n Q.fcall =>\n parts = []\n @readstream.on 'end', =>\n console.log 'done reading'\n @readstream.close()\n deferred.resolve()\n\n @readstream.on 'readable', =>\n data = @readstream.read()\n console.log 'READ', data, data.isEncoding\n lenprefix = jspack.Unpack('I', (c.charCodeAt(0) for c in data.slice(0,4).toString('binary').split('')), 0 )[0]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/lib/journal.coffee", "line_start": 10, "line_end": 59} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n\n .fail =>\n console.log 'ERROR'\n .done()\n\n return deferred.promise\n\n record: (message) =>\n console.log 'RECORDING', message\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/lib/journal.coffee", "line_start": 60, "line_end": 109} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:completion", "type": "completion", "prompt": "console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n\n .fail =>\n console.log 'ERROR'", "response": ".done()\n\n return deferred.promise\n\n record: (message) =>\n console.log 'RECORDING', message\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/lib/journal.coffee", "line_start": 60, "line_end": 109} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n\n .fail =>\n console.log 'ERROR'\n .done()\n\n return deferred.promise\n\n record: (operation) =>\n console.log 'RECORDING', operation\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(operation) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "77bdcec5d890976d4f02b71666d7265840e0c172", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/77bdcec5d890976d4f02b71666d7265840e0c172/lib/journal.coffee", "line_start": 60, "line_end": 109} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:completion", "type": "completion", "prompt": "console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n\n .fail =>\n console.log 'ERROR'", "response": ".done()\n\n return deferred.promise\n\n record: (operation) =>\n console.log 'RECORDING', operation\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(operation) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "77bdcec5d890976d4f02b71666d7265840e0c172", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/77bdcec5d890976d4f02b71666d7265840e0c172/lib/journal.coffee", "line_start": 60, "line_end": 109} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n\n .fail =>\n console.log 'ERROR'\n .done()\n\n return deferred.promise\n\n record: (message) =>\n console.log 'RECORDING', operation\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "0c1f6a97acb7395914c82814f5a2fb9d8ffd5271", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/0c1f6a97acb7395914c82814f5a2fb9d8ffd5271/lib/journal.coffee", "line_start": 60, "line_end": 109} {"id": "buttercoin/buttercoin:lib/journal.coffee:2:completion", "type": "completion", "prompt": "console.log 'lenprefix', lenprefix\n\n chunk = data.slice(4, 4 + lenprefix)\n\n if data.length > 4 + lenprefix\n rest = data.slice(4 + lenprefix)\n else\n rest = ''\n\n console.log 'LENS', data.length, chunk.length, rest.length\n console.log 'CHUNK', chunk.toString()\n\n console.log 'rest', rest\n\n\n if chunk.length == lenprefix\n operation = JSON.parse(chunk.toString())\n console.log 'operation', operation\n execute_operation(operation)\n @readstream.unshift(rest)\n else\n @readstream.unshift(data)\n\n .fail =>\n console.log 'ERROR'", "response": ".done()\n\n return deferred.promise\n\n record: (message) =>\n console.log 'RECORDING', operation\n if @writefd == null\n console.log 'NO WRITEFD AVAILABLE'\n return Q.when(null)\n\n # message = JSON.stringify(operation)\n\n l = message.length\n\n part = jspack.Pack('I', [l])\n\n buf = Buffer.concat [ Buffer(part), Buffer(message) ]\n\n writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)\n console.log 'DONE WRITING', writeq, buf\n return writeq\n\n flush: =>\n Q.nfcall(fs.fsync, @writefd).then =>\n console.log 'FLUSHED'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/journal.coffee", "license": "MIT", "commit": "0c1f6a97acb7395914c82814f5a2fb9d8ffd5271", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/0c1f6a97acb7395914c82814f5a2fb9d8ffd5271/lib/journal.coffee", "line_start": 60, "line_end": 109} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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\ncyclotronServices.factory 'exportService', ($http, configService) ->\n\n {\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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\ncyclotronServices.factory 'exportService', ($http, configService) ->\n\n {\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\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 */\ncyclotronServices.factory('exportService', function($http, configService) {\n return {\n // List of all tags\n exportAsync: function(dashboardName, format, params, callback) {\n var paramStrings, uri;\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format;\n if ((params != null) && _.keys(params).length > 0) {\n paramStrings = _.map(_.pairs(params), function(pair) {\n return pair[0] + '=' + pair[1];\n });\n uri += '?' + paramStrings.join('&');\n }\n return $http.post(uri).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\n });\n },\n getStatus: function(statusUrl, callback) {\n return $http.get(statusUrl).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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 */\ncyclotronServices.factory('exportService', function($http, configService) {\n return {\n // List of all tags\n exportAsync: function(dashboardName, format, params, callback) {\n var paramStrings, uri;\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format;\n if ((params != null) && _.keys(params).length > 0) {\n paramStrings = _.map(_.pairs(params), function(pair) {\n return pair[0] + '=' + pair[1];\n });\n uri += '?' + paramStrings.join('&');\n }\n return $http.post(uri).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\n });\n },\n getStatus: function(statusUrl, callback) {\n return $http.get(statusUrl).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\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\ncyclotronServices.factory 'exportService', ($http, configService) ->\n\n {\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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\ncyclotronServices.factory 'exportService', ($http, configService) ->", "response": "{\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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\ncyclotronServices.factory 'exportService', ($http, configService) ->\n\n {\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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\ncyclotronServices.factory 'exportService', ($http, configService) ->\n\n {\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\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 */\ncyclotronServices.factory('exportService', function($http, configService) {\n return {\n // List of all tags\n exportAsync: function(dashboardName, format, params, callback) {\n var paramStrings, uri;\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format;\n if ((params != null) && _.keys(params).length > 0) {\n paramStrings = _.map(_.pairs(params), function(pair) {\n return pair[0] + '=' + pair[1];\n });\n uri += '?' + paramStrings.join('&');\n }\n return $http.post(uri).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\n });\n },\n getStatus: function(statusUrl, callback) {\n return $http.get(statusUrl).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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 */\ncyclotronServices.factory('exportService', function($http, configService) {\n return {\n // List of all tags\n exportAsync: function(dashboardName, format, params, callback) {\n var paramStrings, uri;\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format;\n if ((params != null) && _.keys(params).length > 0) {\n paramStrings = _.map(_.pairs(params), function(pair) {\n return pair[0] + '=' + pair[1];\n });\n uri += '?' + paramStrings.join('&');\n }\n return $http.post(uri).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\n });\n },\n getStatus: function(statusUrl, callback) {\n return $http.get(statusUrl).success(function(result) {\n if (_.isFunction(callback)) {\n return callback(result);\n }\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\ncyclotronServices.factory 'exportService', ($http, configService) ->\n\n {\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/services/services.exportService.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\ncyclotronServices.factory 'exportService', ($http, configService) ->", "response": "{\n # List of all tags\n exportAsync: (dashboardName, format, params, callback) ->\n uri = configService.restServiceUrl + '/export/' + dashboardName + '/' + format\n if params? && _.keys(params).length > 0\n paramStrings = _.map _.pairs(params), (pair) ->\n pair[0] + '=' + pair[1]\n uri += '?' + paramStrings.join('&')\n\n $http.post(uri).success (result) ->\n if _.isFunction(callback) then callback(result)\n\n getStatus: (statusUrl, callback) ->\n $http.get(statusUrl).success (result) ->\n if _.isFunction(callback) then callback(result)\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/services/services.exportService.coffee", "line_start": 1, "line_end": 34} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "React = require 'react'\nrecorder = require 'actions-recorder'\nuploadUtil = require '../util/upload'\n\nif typeof window isnt 'undefined'\n FileAPI = require 'fileapi'\n\nquery = require '../query'\n\nlang = require '../locales/lang'\nconfig = require '../config'\nhandlers = require '../handlers'\n\nuserActions = require '../actions/user'\n\ndiv = React.createFactory 'div'\ni = React.createFactory 'i'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'profile-avatar'\n\n propTypes:\n avatarUrl: T.string.isRequired\n\n getInitialState: ->\n avatarUrl: @props.avatarUrl\n\n onUploaderCreate: ({file}) ->\n image = FileAPI.Image file\n image.preview 200, 200\n image.get (err, imageEL) =>\n if err\n console.error err\n else\n @setState avatarUrl: imageEL.toDataURL()\n\n onUploaderComplete: ({fileData}) ->\n _userId = query.userId(recorder.getState())\n userActions.userUpdate _userId, avatarUrl: fileData.thumbnailUrl\n @setState avatarUrl: fileData.thumbnailUrl\n\n onFileClick: (event) ->\n uploadUtil.handleClick\n accept: \".jpg,.jpeg,.bmp,.png\"\n onCreate: @onUploaderCreate\n onSuccess: @onUploaderComplete\n onError: handlers.fileError", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nReact = require 'react'\nrecorder = require 'actions-recorder'\nuploadUtil = require '../util/upload'\n\nif typeof window isnt 'undefined'\n FileAPI = require 'fileapi'\n\nquery = require '../query'\n\nlang = require '../locales/lang'\nconfig = require '../config'\nhandlers = require '../handlers'\n\nuserActions = require '../actions/user'\n\ndiv = React.createFactory 'div'\ni = React.createFactory 'i'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'profile-avatar'\n\n propTypes:\n avatarUrl: T.string.isRequired\n\n getInitialState: ->\n avatarUrl: @props.avatarUrl\n\n onUploaderCreate: ({file}) ->\n image = FileAPI.Image file\n image.preview 200, 200\n image.get (err, imageEL) =>\n if err\n console.error err\n else\n @setState avatarUrl: imageEL.toDataURL()\n\n onUploaderComplete: ({fileData}) ->\n _userId = query.userId(recorder.getState())\n userActions.userUpdate _userId, avatarUrl: fileData.thumbnailUrl\n @setState avatarUrl: fileData.thumbnailUrl\n\n onFileClick: (event) ->\n uploadUtil.handleClick\n accept: \".jpg,.jpeg,.bmp,.png\"\n onCreate: @onUploaderCreate\n onSuccess: @onUploaderComplete\n onError: handlers.fileError\n```", "response": "var FileAPI, React, T, config, div, handlers, i, lang, query, recorder, uploadUtil, userActions;\n\nReact = require('react');\n\nrecorder = require('actions-recorder');\n\nuploadUtil = require('../util/upload');\n\nif (typeof window !== 'undefined') {\n FileAPI = require('fileapi');\n}\n\nquery = require('../query');\n\nlang = require('../locales/lang');\n\nconfig = require('../config');\n\nhandlers = require('../handlers');\n\nuserActions = require('../actions/user');\n\ndiv = React.createFactory('div');\n\ni = React.createFactory('i');\n\nT = React.PropTypes;\n\nmodule.exports = React.createClass({\n displayName: 'profile-avatar',\n propTypes: {\n avatarUrl: T.string.isRequired\n },\n getInitialState: function() {\n return {\n avatarUrl: this.props.avatarUrl\n };\n },\n onUploaderCreate: function({file}) {\n var image;\n image = FileAPI.Image(file);\n image.preview(200, 200);\n return image.get((err, imageEL) => {\n if (err) {\n return console.error(err);\n } else {\n return this.setState({\n avatarUrl: imageEL.toDataURL()\n });\n }\n });\n },\n onUploaderComplete: function({fileData}) {\n var _userId;\n _userId = query.userId(recorder.getState());\n userActions.userUpdate(_userId, {\n avatarUrl: fileData.thumbnailUrl\n });\n return this.setState({\n avatarUrl: fileData.thumbnailUrl\n });\n },\n onFileClick: function(event) {\n return uploadUtil.handleClick({\n accept: \".jpg,.jpeg,.bmp,.png\",\n onCreate: this.onUploaderCreate,\n onSuccess: this.onUploaderComplete,\n onError: handlers.fileError\n });\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar FileAPI, React, T, config, div, handlers, i, lang, query, recorder, uploadUtil, userActions;\n\nReact = require('react');\n\nrecorder = require('actions-recorder');\n\nuploadUtil = require('../util/upload');\n\nif (typeof window !== 'undefined') {\n FileAPI = require('fileapi');\n}\n\nquery = require('../query');\n\nlang = require('../locales/lang');\n\nconfig = require('../config');\n\nhandlers = require('../handlers');\n\nuserActions = require('../actions/user');\n\ndiv = React.createFactory('div');\n\ni = React.createFactory('i');\n\nT = React.PropTypes;\n\nmodule.exports = React.createClass({\n displayName: 'profile-avatar',\n propTypes: {\n avatarUrl: T.string.isRequired\n },\n getInitialState: function() {\n return {\n avatarUrl: this.props.avatarUrl\n };\n },\n onUploaderCreate: function({file}) {\n var image;\n image = FileAPI.Image(file);\n image.preview(200, 200);\n return image.get((err, imageEL) => {\n if (err) {\n return console.error(err);\n } else {\n return this.setState({\n avatarUrl: imageEL.toDataURL()\n });\n }\n });\n },\n onUploaderComplete: function({fileData}) {\n var _userId;\n _userId = query.userId(recorder.getState());\n userActions.userUpdate(_userId, {\n avatarUrl: fileData.thumbnailUrl\n });\n return this.setState({\n avatarUrl: fileData.thumbnailUrl\n });\n },\n onFileClick: function(event) {\n return uploadUtil.handleClick({\n accept: \".jpg,.jpeg,.bmp,.png\",\n onCreate: this.onUploaderCreate,\n onSuccess: this.onUploaderComplete,\n onError: handlers.fileError\n });\n }\n});\n```", "response": "React = require 'react'\nrecorder = require 'actions-recorder'\nuploadUtil = require '../util/upload'\n\nif typeof window isnt 'undefined'\n FileAPI = require 'fileapi'\n\nquery = require '../query'\n\nlang = require '../locales/lang'\nconfig = require '../config'\nhandlers = require '../handlers'\n\nuserActions = require '../actions/user'\n\ndiv = React.createFactory 'div'\ni = React.createFactory 'i'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'profile-avatar'\n\n propTypes:\n avatarUrl: T.string.isRequired\n\n getInitialState: ->\n avatarUrl: @props.avatarUrl\n\n onUploaderCreate: ({file}) ->\n image = FileAPI.Image file\n image.preview 200, 200\n image.get (err, imageEL) =>\n if err\n console.error err\n else\n @setState avatarUrl: imageEL.toDataURL()\n\n onUploaderComplete: ({fileData}) ->\n _userId = query.userId(recorder.getState())\n userActions.userUpdate _userId, avatarUrl: fileData.thumbnailUrl\n @setState avatarUrl: fileData.thumbnailUrl\n\n onFileClick: (event) ->\n uploadUtil.handleClick\n accept: \".jpg,.jpeg,.bmp,.png\"\n onCreate: @onUploaderCreate\n onSuccess: @onUploaderComplete\n onError: handlers.fileError", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:1:completion", "type": "completion", "prompt": "React = require 'react'\nrecorder = require 'actions-recorder'\nuploadUtil = require '../util/upload'\n\nif typeof window isnt 'undefined'\n FileAPI = require 'fileapi'\n\nquery = require '../query'\n\nlang = require '../locales/lang'\nconfig = require '../config'\nhandlers = require '../handlers'\n\nuserActions = require '../actions/user'\n\ndiv = React.createFactory 'div'\ni = React.createFactory 'i'\n\nT = React.PropTypes\n\nmodule.exports = React.createClass\n displayName: 'profile-avatar'\n\n propTypes:", "response": "avatarUrl: T.string.isRequired\n\n getInitialState: ->\n avatarUrl: @props.avatarUrl\n\n onUploaderCreate: ({file}) ->\n image = FileAPI.Image file\n image.preview 200, 200\n image.get (err, imageEL) =>\n if err\n console.error err\n else\n @setState avatarUrl: imageEL.toDataURL()\n\n onUploaderComplete: ({fileData}) ->\n _userId = query.userId(recorder.getState())\n userActions.userUpdate _userId, avatarUrl: fileData.thumbnailUrl\n @setState avatarUrl: fileData.thumbnailUrl\n\n onFileClick: (event) ->\n uploadUtil.handleClick\n accept: \".jpg,.jpeg,.bmp,.png\"\n onCreate: @onUploaderCreate\n onSuccess: @onUploaderComplete\n onError: handlers.fileError", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "render: ->\n avatarStyle =\n if @props.avatarUrl?.length\n backgroundImage: \"url(#{ @state.avatarUrl })\"\n else undefined\n\n div className: 'profile-avatar',\n div className: 'trigger', ref: 'trigger', style: avatarStyle, onClick: @onFileClick,\n i className: 'ti ti-camera'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 51, "line_end": 59} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrender: ->\n avatarStyle =\n if @props.avatarUrl?.length\n backgroundImage: \"url(#{ @state.avatarUrl })\"\n else undefined\n\n div className: 'profile-avatar',\n div className: 'trigger', ref: 'trigger', style: avatarStyle, onClick: @onFileClick,\n i className: 'ti ti-camera'\n```", "response": "({\n render: function() {\n var avatarStyle, ref;\n avatarStyle = ((ref = this.props.avatarUrl) != null ? ref.length : void 0) ? {\n backgroundImage: `url(${this.state.avatarUrl})`\n } : void 0;\n return div({\n className: 'profile-avatar'\n }, div({\n className: 'trigger',\n ref: 'trigger',\n style: avatarStyle,\n onClick: this.onFileClick\n }, i({\n className: 'ti ti-camera'\n })));\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 51, "line_end": 59} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n render: function() {\n var avatarStyle, ref;\n avatarStyle = ((ref = this.props.avatarUrl) != null ? ref.length : void 0) ? {\n backgroundImage: `url(${this.state.avatarUrl})`\n } : void 0;\n return div({\n className: 'profile-avatar'\n }, div({\n className: 'trigger',\n ref: 'trigger',\n style: avatarStyle,\n onClick: this.onFileClick\n }, i({\n className: 'ti ti-camera'\n })));\n }\n});\n```", "response": "render: ->\n avatarStyle =\n if @props.avatarUrl?.length\n backgroundImage: \"url(#{ @state.avatarUrl })\"\n else undefined\n\n div className: 'profile-avatar',\n div className: 'trigger', ref: 'trigger', style: avatarStyle, onClick: @onFileClick,\n i className: 'ti ti-camera'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 51, "line_end": 59} {"id": "jianliaoim/talk-os:talk-web/client/app/profile-avatar.coffee:2:completion", "type": "completion", "prompt": "render: ->\n avatarStyle =\n if @props.avatarUrl?.length\n backgroundImage: \"url(#{ @state.avatarUrl })\"", "response": "else undefined\n\n div className: 'profile-avatar',\n div className: 'trigger', ref: 'trigger', style: avatarStyle, onClick: @onFileClick,\n i className: 'ti ti-camera'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/profile-avatar.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/profile-avatar.coffee", "line_start": 51, "line_end": 59} {"id": "twilson63/express-coffee:spec/app_spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "require '../lib/app'\nrequest = require('request')\n\nroot_uri = 'http://localhost:8000'\n\ndescribe 'APP Routes', ->\n it 'GET /', ->\n request uri: \"#{root_uri}/\", (req, resp) ->\n expect(resp.statusCode).toEqual(200)\n asyncSpecDone()\n asyncSpecWait()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "spec/app_spec.coffee", "license": "MIT", "commit": "227cd292ce20f50b16acd9d03bb2290c01c8001a", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/227cd292ce20f50b16acd9d03bb2290c01c8001a/spec/app_spec.coffee", "line_start": 1, "line_end": 11} {"id": "twilson63/express-coffee:spec/app_spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrequire '../lib/app'\nrequest = require('request')\n\nroot_uri = 'http://localhost:8000'\n\ndescribe 'APP Routes', ->\n it 'GET /', ->\n request uri: \"#{root_uri}/\", (req, resp) ->\n expect(resp.statusCode).toEqual(200)\n asyncSpecDone()\n asyncSpecWait()\n```", "response": "var request, root_uri;\n\nrequire('../lib/app');\n\nrequest = require('request');\n\nroot_uri = 'http://localhost:8000';\n\ndescribe('APP Routes', function() {\n return it('GET /', function() {\n request({\n uri: `${root_uri}/`\n }, function(req, resp) {\n expect(resp.statusCode).toEqual(200);\n return asyncSpecDone();\n });\n return asyncSpecWait();\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "twilson63/express-coffee", "path": "spec/app_spec.coffee", "license": "MIT", "commit": "227cd292ce20f50b16acd9d03bb2290c01c8001a", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/227cd292ce20f50b16acd9d03bb2290c01c8001a/spec/app_spec.coffee", "line_start": 1, "line_end": 11} {"id": "twilson63/express-coffee:spec/app_spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar request, root_uri;\n\nrequire('../lib/app');\n\nrequest = require('request');\n\nroot_uri = 'http://localhost:8000';\n\ndescribe('APP Routes', function() {\n return it('GET /', function() {\n request({\n uri: `${root_uri}/`\n }, function(req, resp) {\n expect(resp.statusCode).toEqual(200);\n return asyncSpecDone();\n });\n return asyncSpecWait();\n });\n});\n```", "response": "require '../lib/app'\nrequest = require('request')\n\nroot_uri = 'http://localhost:8000'\n\ndescribe 'APP Routes', ->\n it 'GET /', ->\n request uri: \"#{root_uri}/\", (req, resp) ->\n expect(resp.statusCode).toEqual(200)\n asyncSpecDone()\n asyncSpecWait()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "spec/app_spec.coffee", "license": "MIT", "commit": "227cd292ce20f50b16acd9d03bb2290c01c8001a", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/227cd292ce20f50b16acd9d03bb2290c01c8001a/spec/app_spec.coffee", "line_start": 1, "line_end": 11} {"id": "twilson63/express-coffee:spec/app_spec.coffee:1:completion", "type": "completion", "prompt": "require '../lib/app'\nrequest = require('request')\n\nroot_uri = 'http://localhost:8000'", "response": "describe 'APP Routes', ->\n it 'GET /', ->\n request uri: \"#{root_uri}/\", (req, resp) ->\n expect(resp.statusCode).toEqual(200)\n asyncSpecDone()\n asyncSpecWait()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "spec/app_spec.coffee", "license": "MIT", "commit": "227cd292ce20f50b16acd9d03bb2290c01c8001a", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/227cd292ce20f50b16acd9d03bb2290c01c8001a/spec/app_spec.coffee", "line_start": 1, "line_end": 11} {"id": "oozcitak/xmlbuilder-js:src/XMLTypeInfo.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Derivation = require './Derivation'\n\n# Represents a type referenced from element or attribute nodes.\nmodule.exports = class XMLTypeInfo\n\n\n # Initializes a new instance of `XMLTypeInfo`\n #\n constructor: (@typeName, @typeNamespace) ->\n\n\n # DOM level 3 functions to be implemented later\n isDerivedFrom: (typeNamespaceArg, typeNameArg, derivationMethod) ->\n throw new Error \"This DOM method is not implemented.\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLTypeInfo.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLTypeInfo.coffee", "line_start": 1, "line_end": 14} {"id": "oozcitak/xmlbuilder-js:src/XMLTypeInfo.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nDerivation = require './Derivation'\n\n# Represents a type referenced from element or attribute nodes.\nmodule.exports = class XMLTypeInfo\n\n\n # Initializes a new instance of `XMLTypeInfo`\n #\n constructor: (@typeName, @typeNamespace) ->\n\n\n # DOM level 3 functions to be implemented later\n isDerivedFrom: (typeNamespaceArg, typeNameArg, derivationMethod) ->\n throw new Error \"This DOM method is not implemented.\"\n```", "response": "var Derivation, XMLTypeInfo;\n\nDerivation = require('./Derivation');\n\n// Represents a type referenced from element or attribute nodes.\nmodule.exports = XMLTypeInfo = class XMLTypeInfo {\n // Initializes a new instance of `XMLTypeInfo`\n\n constructor(typeName, typeNamespace) {\n this.typeName = typeName;\n this.typeNamespace = typeNamespace;\n }\n\n // DOM level 3 functions to be implemented later\n isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod) {\n throw new Error(\"This DOM method is not implemented.\");\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLTypeInfo.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLTypeInfo.coffee", "line_start": 1, "line_end": 14} {"id": "oozcitak/xmlbuilder-js:src/XMLTypeInfo.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Derivation, XMLTypeInfo;\n\nDerivation = require('./Derivation');\n\n// Represents a type referenced from element or attribute nodes.\nmodule.exports = XMLTypeInfo = class XMLTypeInfo {\n // Initializes a new instance of `XMLTypeInfo`\n\n constructor(typeName, typeNamespace) {\n this.typeName = typeName;\n this.typeNamespace = typeNamespace;\n }\n\n // DOM level 3 functions to be implemented later\n isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod) {\n throw new Error(\"This DOM method is not implemented.\");\n }\n\n};\n```", "response": "Derivation = require './Derivation'\n\n# Represents a type referenced from element or attribute nodes.\nmodule.exports = class XMLTypeInfo\n\n\n # Initializes a new instance of `XMLTypeInfo`\n #\n constructor: (@typeName, @typeNamespace) ->\n\n\n # DOM level 3 functions to be implemented later\n isDerivedFrom: (typeNamespaceArg, typeNameArg, derivationMethod) ->\n throw new Error \"This DOM method is not implemented.\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLTypeInfo.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLTypeInfo.coffee", "line_start": 1, "line_end": 14} {"id": "oozcitak/xmlbuilder-js:src/XMLTypeInfo.coffee:1:completion", "type": "completion", "prompt": "Derivation = require './Derivation'\n\n# Represents a type referenced from element or attribute nodes.\nmodule.exports = class XMLTypeInfo\n\n\n # Initializes a new instance of `XMLTypeInfo`", "response": "#\n constructor: (@typeName, @typeNamespace) ->\n\n\n # DOM level 3 functions to be implemented later\n isDerivedFrom: (typeNamespaceArg, typeNameArg, derivationMethod) ->\n throw new Error \"This DOM method is not implemented.\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "src/XMLTypeInfo.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLTypeInfo.coffee", "line_start": 1, "line_end": 14} {"id": "linemanjs/lineman:lib/cli/setup-env.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\n\nmodule.exports = ->\n process.env[\"LINEMAN_MAIN\"] = findTheRightLineman()\n process.env[\"LINEMAN_ENV\"] ||= \"development\"\n\nfindTheRightLineman = ->\n return \"lineman\" if fs.existsSync(\"#{process.cwd()}/node_modules/lineman\")\n \"#{__dirname}/../../lineman.js\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/cli/setup-env.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/cli/setup-env.coffee", "line_start": 1, "line_end": 9} {"id": "linemanjs/lineman:lib/cli/setup-env.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\n\nmodule.exports = ->\n process.env[\"LINEMAN_MAIN\"] = findTheRightLineman()\n process.env[\"LINEMAN_ENV\"] ||= \"development\"\n\nfindTheRightLineman = ->\n return \"lineman\" if fs.existsSync(\"#{process.cwd()}/node_modules/lineman\")\n \"#{__dirname}/../../lineman.js\"\n```", "response": "var findTheRightLineman, fs;\n\nfs = require('fs');\n\nmodule.exports = function() {\n var base;\n process.env[\"LINEMAN_MAIN\"] = findTheRightLineman();\n return (base = process.env)[\"LINEMAN_ENV\"] || (base[\"LINEMAN_ENV\"] = \"development\");\n};\n\nfindTheRightLineman = function() {\n if (fs.existsSync(`${process.cwd()}/node_modules/lineman`)) {\n return \"lineman\";\n }\n return `${__dirname}/../../lineman.js`;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "lib/cli/setup-env.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/cli/setup-env.coffee", "line_start": 1, "line_end": 9} {"id": "linemanjs/lineman:lib/cli/setup-env.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findTheRightLineman, fs;\n\nfs = require('fs');\n\nmodule.exports = function() {\n var base;\n process.env[\"LINEMAN_MAIN\"] = findTheRightLineman();\n return (base = process.env)[\"LINEMAN_ENV\"] || (base[\"LINEMAN_ENV\"] = \"development\");\n};\n\nfindTheRightLineman = function() {\n if (fs.existsSync(`${process.cwd()}/node_modules/lineman`)) {\n return \"lineman\";\n }\n return `${__dirname}/../../lineman.js`;\n};\n```", "response": "fs = require('fs')\n\nmodule.exports = ->\n process.env[\"LINEMAN_MAIN\"] = findTheRightLineman()\n process.env[\"LINEMAN_ENV\"] ||= \"development\"\n\nfindTheRightLineman = ->\n return \"lineman\" if fs.existsSync(\"#{process.cwd()}/node_modules/lineman\")\n \"#{__dirname}/../../lineman.js\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/cli/setup-env.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/cli/setup-env.coffee", "line_start": 1, "line_end": 9} {"id": "linemanjs/lineman:lib/cli/setup-env.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\n\nmodule.exports = ->\n process.env[\"LINEMAN_MAIN\"] = findTheRightLineman()", "response": "process.env[\"LINEMAN_ENV\"] ||= \"development\"\n\nfindTheRightLineman = ->\n return \"lineman\" if fs.existsSync(\"#{process.cwd()}/node_modules/lineman\")\n \"#{__dirname}/../../lineman.js\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "lib/cli/setup-env.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/lib/cli/setup-env.coffee", "line_start": 1, "line_end": 9} {"id": "jianliaoim/talk-os:talk-web/client/app/topic-name.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'topic-name'\n mixins: [mixinSubscribe, PureRenderMixin]\n\n propTypes:\n topic: T.instanceOf(Immutable.Map)\n onClick: T.func\n colorizePlace: T.string\n active: T.bool\n hover: T.bool\n showPurpose: T.bool\n showUnread: T.bool\n showGuest: T.bool\n showMute: T.bool\n showIcon: T.bool\n showQuit: T.bool\n\n getDefaultProps: ->\n onClick: ->\n colorizePlace: 'background'\n active: false\n hover: false\n showPurpose: false\n showUnread: false\n showGuest: false\n showMute: false\n showIcon: true\n showQuit: false\n\n getInitialState: ->\n isMute: @getMute()\n\n componentDidMount: ->\n @subscribe recorder, => @setState isMute: @getMute()\n\n getMute: ->\n prefs = query.topicPrefsBy(recorder.getState(), @props.topic.get('_teamId'), @props.topic.get('_id'))\n isMute = prefs?.get('isMute') or false\n\n onClick: (event) ->\n # event.stopPropagation()\n @props.onClick @props.topic.get('_id')\n\n renderIcon: ->\n return unless @props.showIcon\n\n isGeneral = @props.topic.get('isGeneral')\n isPrivate = @props.topic.get('isPrivate')\n\n iconClass =", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/topic-name.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-name.coffee", "line_start": 23, "line_end": 72} {"id": "jianliaoim/talk-os:talk-web/client/app/topic-name.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'topic-name'\n mixins: [mixinSubscribe, PureRenderMixin]\n\n propTypes:\n topic: T.instanceOf(Immutable.Map)\n onClick: T.func\n colorizePlace: T.string\n active: T.bool\n hover: T.bool\n showPurpose: T.bool\n showUnread: T.bool\n showGuest: T.bool\n showMute: T.bool\n showIcon: T.bool\n showQuit: T.bool\n\n getDefaultProps: ->\n onClick: ->\n colorizePlace: 'background'\n active: false\n hover: false\n showPurpose: false\n showUnread: false\n showGuest: false", "response": "showMute: false\n showIcon: true\n showQuit: false\n\n getInitialState: ->\n isMute: @getMute()\n\n componentDidMount: ->\n @subscribe recorder, => @setState isMute: @getMute()\n\n getMute: ->\n prefs = query.topicPrefsBy(recorder.getState(), @props.topic.get('_teamId'), @props.topic.get('_id'))\n isMute = prefs?.get('isMute') or false\n\n onClick: (event) ->\n # event.stopPropagation()\n @props.onClick @props.topic.get('_id')\n\n renderIcon: ->\n return unless @props.showIcon\n\n isGeneral = @props.topic.get('isGeneral')\n isPrivate = @props.topic.get('isPrivate')\n\n iconClass =", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/topic-name.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-name.coffee", "line_start": 23, "line_end": 72} {"id": "jianliaoim/talk-os:talk-web/client/app/topic-name.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if not isGeneral and isPrivate\n 'ti is-leading ti-lock-solid'\n else\n 'ti is-leading ti-sharp'\n style =\n if @props.colorizePlace is 'background'\n backgroundColor: colors.blue\n else # font\n color: colors.blue\n span className: iconClass, style: style\n\n renderTopic: ->\n TopicCorrection\n topic: @props.topic\n\n renderStates: ->\n if @props.showPurpose and @props.topic.get('purpose')?\n div className: 'states',\n span className: 'short purpose', @props.topic.get('purpose')\n\n renderUnread: ->\n unread = @props.topic.get('unread')\n if @props.showMute and @state.isMute\n div className: 'mutetip',\n span className: cx 'ti', 'ti-mute', 'unread': unread\n else if @props.showUnread and unread and not @state.isMute\n span className: 'icon-unread', unread\n\n renderQuit: ->\n if @props.showQuit and not detect.inChannel(@props.topic)\n span className: 'muted flex-static hint', lang.getText('no-in-topic')\n\n renderSelect: ->\n if @props.active\n Icon name: 'tick', size: 18, className: 'flex-static'\n\n render: ->\n className = cx 'banner', 'topic-name', 'item', 'line',\n 'hover': @props.hover\n\n div onClick: @onClick, className: className,\n @renderIcon()\n @renderTopic()\n @renderStates()\n @renderUnread()\n @renderQuit()\n @renderSelect()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/topic-name.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-name.coffee", "line_start": 73, "line_end": 119} {"id": "jianliaoim/talk-os:talk-web/client/app/topic-name.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif not isGeneral and isPrivate\n 'ti is-leading ti-lock-solid'\n else\n 'ti is-leading ti-sharp'\n style =\n if @props.colorizePlace is 'background'\n backgroundColor: colors.blue\n else # font\n color: colors.blue\n span className: iconClass, style: style\n\n renderTopic: ->\n TopicCorrection\n topic: @props.topic\n\n renderStates: ->\n if @props.showPurpose and @props.topic.get('purpose')?\n div className: 'states',\n span className: 'short purpose', @props.topic.get('purpose')\n\n renderUnread: ->\n unread = @props.topic.get('unread')\n if @props.showMute and @state.isMute\n div className: 'mutetip',\n span className: cx 'ti', 'ti-mute', 'unread': unread\n else if @props.showUnread and unread and not @state.isMute\n span className: 'icon-unread', unread\n\n renderQuit: ->\n if @props.showQuit and not detect.inChannel(@props.topic)\n span className: 'muted flex-static hint', lang.getText('no-in-topic')\n\n renderSelect: ->\n if @props.active\n Icon name: 'tick', size: 18, className: 'flex-static'\n\n render: ->\n className = cx 'banner', 'topic-name', 'item', 'line',\n 'hover': @props.hover\n\n div onClick: @onClick, className: className,\n @renderIcon()\n @renderTopic()\n @renderStates()\n @renderUnread()\n @renderQuit()\n @renderSelect()\n```", "response": "var style;\n\nif (!isGeneral && isPrivate) {\n 'ti is-leading ti-lock-solid';\n} else {\n 'ti is-leading ti-sharp';\n}\n\nstyle = this.props.colorizePlace === 'background' ? {\n backgroundColor: colors.blue // font\n} : {\n color: colors.blue\n};\n\nspan({\n className: iconClass,\n style: style\n});\n\n({\n renderTopic: function() {\n return TopicCorrection({\n topic: this.props.topic\n });\n },\n renderStates: function() {\n if (this.props.showPurpose && (this.props.topic.get('purpose') != null)) {\n return div({\n className: 'states'\n }, span({\n className: 'short purpose'\n }, this.props.topic.get('purpose')));\n }\n },\n renderUnread: function() {\n var unread;\n unread = this.props.topic.get('unread');\n if (this.props.showMute && this.state.isMute) {\n return div({\n className: 'mutetip'\n }, span({\n className: cx('ti', 'ti-mute', {\n 'unread': unread\n })\n }));\n } else if (this.props.showUnread && unread && !this.state.isMute) {\n return span({\n className: 'icon-unread'\n }, unread);\n }\n },\n renderQuit: function() {\n if (this.props.showQuit && !detect.inChannel(this.props.topic)) {\n return span({\n className: 'muted flex-static hint'\n }, lang.getText('no-in-topic'));\n }\n },\n renderSelect: function() {\n if (this.props.active) {\n return Icon({\n name: 'tick',\n size: 18,\n className: 'flex-static'\n });\n }\n },\n render: function() {\n var className;\n className = cx('banner', 'topic-name', 'item', 'line', {\n 'hover': this.props.hover\n });\n return div({\n onClick: this.onClick,\n className: className\n }, this.renderIcon(), this.renderTopic(), this.renderStates(), this.renderUnread(), this.renderQuit(), this.renderSelect());\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/topic-name.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-name.coffee", "line_start": 73, "line_end": 119} {"id": "jianliaoim/talk-os:talk-web/client/app/topic-name.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar style;\n\nif (!isGeneral && isPrivate) {\n 'ti is-leading ti-lock-solid';\n} else {\n 'ti is-leading ti-sharp';\n}\n\nstyle = this.props.colorizePlace === 'background' ? {\n backgroundColor: colors.blue // font\n} : {\n color: colors.blue\n};\n\nspan({\n className: iconClass,\n style: style\n});\n\n({\n renderTopic: function() {\n return TopicCorrection({\n topic: this.props.topic\n });\n },\n renderStates: function() {\n if (this.props.showPurpose && (this.props.topic.get('purpose') != null)) {\n return div({\n className: 'states'\n }, span({\n className: 'short purpose'\n }, this.props.topic.get('purpose')));\n }\n },\n renderUnread: function() {\n var unread;\n unread = this.props.topic.get('unread');\n if (this.props.showMute && this.state.isMute) {\n return div({\n className: 'mutetip'\n }, span({\n className: cx('ti', 'ti-mute', {\n 'unread': unread\n })\n }));\n } else if (this.props.showUnread && unread && !this.state.isMute) {\n return span({\n className: 'icon-unread'\n }, unread);\n }\n },\n renderQuit: function() {\n if (this.props.showQuit && !detect.inChannel(this.props.topic)) {\n return span({\n className: 'muted flex-static hint'\n }, lang.getText('no-in-topic'));\n }\n },\n renderSelect: function() {\n if (this.props.active) {\n return Icon({\n name: 'tick',\n size: 18,\n className: 'flex-static'\n });\n }\n },\n render: function() {\n var className;\n className = cx('banner', 'topic-name', 'item', 'line', {\n 'hover': this.props.hover\n });\n return div({\n onClick: this.onClick,\n className: className\n }, this.renderIcon(), this.renderTopic(), this.renderStates(), this.renderUnread(), this.renderQuit(), this.renderSelect());\n }\n});\n```", "response": "if not isGeneral and isPrivate\n 'ti is-leading ti-lock-solid'\n else\n 'ti is-leading ti-sharp'\n style =\n if @props.colorizePlace is 'background'\n backgroundColor: colors.blue\n else # font\n color: colors.blue\n span className: iconClass, style: style\n\n renderTopic: ->\n TopicCorrection\n topic: @props.topic\n\n renderStates: ->\n if @props.showPurpose and @props.topic.get('purpose')?\n div className: 'states',\n span className: 'short purpose', @props.topic.get('purpose')\n\n renderUnread: ->\n unread = @props.topic.get('unread')\n if @props.showMute and @state.isMute\n div className: 'mutetip',\n span className: cx 'ti', 'ti-mute', 'unread': unread\n else if @props.showUnread and unread and not @state.isMute\n span className: 'icon-unread', unread\n\n renderQuit: ->\n if @props.showQuit and not detect.inChannel(@props.topic)\n span className: 'muted flex-static hint', lang.getText('no-in-topic')\n\n renderSelect: ->\n if @props.active\n Icon name: 'tick', size: 18, className: 'flex-static'\n\n render: ->\n className = cx 'banner', 'topic-name', 'item', 'line',\n 'hover': @props.hover\n\n div onClick: @onClick, className: className,\n @renderIcon()\n @renderTopic()\n @renderStates()\n @renderUnread()\n @renderQuit()\n @renderSelect()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/topic-name.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-name.coffee", "line_start": 73, "line_end": 119} {"id": "jianliaoim/talk-os:talk-web/client/app/topic-name.coffee:2:completion", "type": "completion", "prompt": "if not isGeneral and isPrivate\n 'ti is-leading ti-lock-solid'\n else\n 'ti is-leading ti-sharp'\n style =\n if @props.colorizePlace is 'background'\n backgroundColor: colors.blue\n else # font\n color: colors.blue\n span className: iconClass, style: style\n\n renderTopic: ->\n TopicCorrection\n topic: @props.topic\n\n renderStates: ->\n if @props.showPurpose and @props.topic.get('purpose')?\n div className: 'states',\n span className: 'short purpose', @props.topic.get('purpose')\n\n renderUnread: ->\n unread = @props.topic.get('unread')\n if @props.showMute and @state.isMute", "response": "div className: 'mutetip',\n span className: cx 'ti', 'ti-mute', 'unread': unread\n else if @props.showUnread and unread and not @state.isMute\n span className: 'icon-unread', unread\n\n renderQuit: ->\n if @props.showQuit and not detect.inChannel(@props.topic)\n span className: 'muted flex-static hint', lang.getText('no-in-topic')\n\n renderSelect: ->\n if @props.active\n Icon name: 'tick', size: 18, className: 'flex-static'\n\n render: ->\n className = cx 'banner', 'topic-name', 'item', 'line',\n 'hover': @props.hover\n\n div onClick: @onClick, className: className,\n @renderIcon()\n @renderTopic()\n @renderStates()\n @renderUnread()\n @renderQuit()\n @renderSelect()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/topic-name.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-name.coffee", "line_start": 73, "line_end": 119} {"id": "gss/engine:src/engine/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 @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.data.properties['::window[height]'] = ->\n return height\n @engine.data.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/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/engine/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 @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.data.properties['::window[height]'] = ->\n return height\n @engine.data.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/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/engine/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.data.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.document.Stylesheet.export()\n return values\n\nmodule.exports = Exporter", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/utilities/Exporter.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/engine/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.data.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.document.Stylesheet.export()\n return values\n\nmodule.exports = Exporter", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "be430ea249f8030e11c8e03a8e170dcc8b8cf5fb", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/utilities/Exporter.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/engine/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 @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/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a/src/engine/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/engine/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 @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/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a/src/engine/utilities/Exporter.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/engine/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.document.Stylesheet.export()\n return values\n\nmodule.exports = Exporter", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a/src/engine/utilities/Exporter.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/engine/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.document.Stylesheet.export()\n return values\n\nmodule.exports = Exporter", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/engine/utilities/Exporter.coffee", "license": "MIT", "commit": "9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/9475f0b5c90b41ffcefe4cbe4b3ff5a42860423a/src/engine/utilities/Exporter.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/commands/Unit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'\n 'padding-left': 'containing-width'\n 'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]\n\n rem: (value, engine, operation, continuation, scope) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "400ff13b657e4fa06d6819db318c341c4f17c3e5", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/400ff13b657e4fa06d6819db318c341c4f17c3e5/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nVariable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'\n 'padding-left': 'containing-width'\n 'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]\n\n rem: (value, engine, operation, continuation, scope) ->\n```", "response": "var Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {\n // Dynamic lengths\n getProperty(operation) {\n var parent;\n parent = operation;\n while (parent = parent.parent) {\n if (parent.command.type === 'Assignment') {\n return parent[1];\n }\n }\n }\n\n };\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n Unit.prototype.Dependencies = {\n 'margin-top': 'containing-width',\n 'margin-top': 'containing-width',\n 'margin-right': 'containing-width',\n 'margin-left': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-right': 'containing-width',\n 'padding-left': 'containing-width',\n 'left': 'containing-width',\n 'right': 'containing-width',\n 'width': 'containing-width',\n 'min-width': 'containing-width',\n 'max-width': 'containing-width',\n 'text-width': 'containing-width',\n 'top': 'containing-height',\n 'bottom': 'containing-height',\n 'height': 'containing-height',\n 'font-size': 'containing-font-size',\n 'vertical-align': 'line-height',\n 'background-position-x': 'width',\n 'background-position-y': 'height'\n };\n\n Unit.define({\n '%': function(value, engine, operation, continuation, scope) {\n var path, property;\n property = this.Dependencies[this.getProperty(operation)] || 'containing-width';\n path = engine.getPath(scope, property);\n return ['*', ['px', value], ['get', path]];\n },\n em: function(value, engine, operation, continuation, scope) {\n var path;\n path = engine.getPath(scope, 'computed-font-size');\n return ['*', ['px', value], ['get', path]];\n },\n rem: function(value, engine, operation, continuation, scope) {}\n });\n\n return Unit;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "400ff13b657e4fa06d6819db318c341c4f17c3e5", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/400ff13b657e4fa06d6819db318c341c4f17c3e5/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {\n // Dynamic lengths\n getProperty(operation) {\n var parent;\n parent = operation;\n while (parent = parent.parent) {\n if (parent.command.type === 'Assignment') {\n return parent[1];\n }\n }\n }\n\n };\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n Unit.prototype.Dependencies = {\n 'margin-top': 'containing-width',\n 'margin-top': 'containing-width',\n 'margin-right': 'containing-width',\n 'margin-left': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-right': 'containing-width',\n 'padding-left': 'containing-width',\n 'left': 'containing-width',\n 'right': 'containing-width',\n 'width': 'containing-width',\n 'min-width': 'containing-width',\n 'max-width': 'containing-width',\n 'text-width': 'containing-width',\n 'top': 'containing-height',\n 'bottom': 'containing-height',\n 'height': 'containing-height',\n 'font-size': 'containing-font-size',\n 'vertical-align': 'line-height',\n 'background-position-x': 'width',\n 'background-position-y': 'height'\n };\n\n Unit.define({\n '%': function(value, engine, operation, continuation, scope) {\n var path, property;\n property = this.Dependencies[this.getProperty(operation)] || 'containing-width';\n path = engine.getPath(scope, property);\n return ['*', ['px', value], ['get', path]];\n },\n em: function(value, engine, operation, continuation, scope) {\n var path;\n path = engine.getPath(scope, 'computed-font-size');\n return ['*', ['px', value], ['get', path]];\n },\n rem: function(value, engine, operation, continuation, scope) {}\n });\n\n return Unit;\n\n}).call(this);\n```", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'\n 'padding-left': 'containing-width'\n 'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]\n\n rem: (value, engine, operation, continuation, scope) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "400ff13b657e4fa06d6819db318c341c4f17c3e5", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/400ff13b657e4fa06d6819db318c341c4f17c3e5/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:completion", "type": "completion", "prompt": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'\n 'padding-left': 'containing-width'", "response": "'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]\n\n rem: (value, engine, operation, continuation, scope) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "400ff13b657e4fa06d6819db318c341c4f17c3e5", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/400ff13b657e4fa06d6819db318c341c4f17c3e5/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "path = @engine.getPath(engine.scope._gss_id, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "400ff13b657e4fa06d6819db318c341c4f17c3e5", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/400ff13b657e4fa06d6819db318c341c4f17c3e5/src/commands/Unit.coffee", "line_start": 51, "line_end": 69} {"id": "gss/engine:src/commands/Unit.coffee:2:completion", "type": "completion", "prompt": "path = @engine.getPath(engine.scope._gss_id, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]", "response": "vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "400ff13b657e4fa06d6819db318c341c4f17c3e5", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/400ff13b657e4fa06d6819db318c341c4f17c3e5/src/commands/Unit.coffee", "line_start": 51, "line_end": 69} {"id": "gss/engine:src/commands/Unit.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "10bca5fdbfe6d8db65f0c354bc31b9fd817e263f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/10bca5fdbfe6d8db65f0c354bc31b9fd817e263f/src/commands/Unit.coffee", "line_start": 51, "line_end": 68} {"id": "gss/engine:src/commands/Unit.coffee:2:completion", "type": "completion", "prompt": "return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->", "response": "return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "10bca5fdbfe6d8db65f0c354bc31b9fd817e263f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/10bca5fdbfe6d8db65f0c354bc31b9fd817e263f/src/commands/Unit.coffee", "line_start": 51, "line_end": 68} {"id": "gss/engine:src/commands/Unit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'\n 'padding-left': 'containing-width'\n 'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n debugger\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nVariable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'\n 'padding-left': 'containing-width'\n 'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n debugger\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]\n```", "response": "var Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {\n // Dynamic lengths\n getProperty(operation) {\n var parent;\n parent = operation;\n while (parent = parent.parent) {\n if (parent.command.type === 'Assignment') {\n return parent[1];\n }\n }\n }\n\n };\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n Unit.prototype.Dependencies = {\n 'margin-top': 'containing-width',\n 'margin-top': 'containing-width',\n 'margin-right': 'containing-width',\n 'margin-left': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-right': 'containing-width',\n 'padding-left': 'containing-width',\n 'left': 'containing-width',\n 'right': 'containing-width',\n 'width': 'containing-width',\n 'min-width': 'containing-width',\n 'max-width': 'containing-width',\n 'text-width': 'containing-width',\n 'top': 'containing-height',\n 'bottom': 'containing-height',\n 'height': 'containing-height',\n 'font-size': 'containing-font-size',\n 'vertical-align': 'line-height',\n 'background-position-x': 'width',\n 'background-position-y': 'height'\n };\n\n Unit.define({\n '%': function(value, engine, operation, continuation, scope) {\n debugger;\n var path, property;\n property = this.Dependencies[this.getProperty(operation)] || 'containing-width';\n path = engine.getPath(scope, property);\n return ['*', ['px', value], ['get', path]];\n },\n em: function(value, engine, operation, continuation, scope) {\n var path;\n path = engine.getPath(scope, 'computed-font-size');\n return ['*', ['px', value], ['get', path]];\n }\n });\n\n return Unit;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {\n // Dynamic lengths\n getProperty(operation) {\n var parent;\n parent = operation;\n while (parent = parent.parent) {\n if (parent.command.type === 'Assignment') {\n return parent[1];\n }\n }\n }\n\n };\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n Unit.prototype.Dependencies = {\n 'margin-top': 'containing-width',\n 'margin-top': 'containing-width',\n 'margin-right': 'containing-width',\n 'margin-left': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-top': 'containing-width',\n 'padding-right': 'containing-width',\n 'padding-left': 'containing-width',\n 'left': 'containing-width',\n 'right': 'containing-width',\n 'width': 'containing-width',\n 'min-width': 'containing-width',\n 'max-width': 'containing-width',\n 'text-width': 'containing-width',\n 'top': 'containing-height',\n 'bottom': 'containing-height',\n 'height': 'containing-height',\n 'font-size': 'containing-font-size',\n 'vertical-align': 'line-height',\n 'background-position-x': 'width',\n 'background-position-y': 'height'\n };\n\n Unit.define({\n '%': function(value, engine, operation, continuation, scope) {\n debugger;\n var path, property;\n property = this.Dependencies[this.getProperty(operation)] || 'containing-width';\n path = engine.getPath(scope, property);\n return ['*', ['px', value], ['get', path]];\n },\n em: function(value, engine, operation, continuation, scope) {\n var path;\n path = engine.getPath(scope, 'computed-font-size');\n return ['*', ['px', value], ['get', path]];\n }\n });\n\n return Unit;\n\n}).call(this);\n```", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'\n 'padding-left': 'containing-width'\n 'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n debugger\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:completion", "type": "completion", "prompt": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n getProperty: (operation) ->\n parent = operation\n while parent = parent.parent\n if parent.command.type == 'Assignment'\n return parent[1]\n\n Dependencies:\n 'margin-top': 'containing-width'\n 'margin-top': 'containing-width'\n 'margin-right': 'containing-width'\n 'margin-left': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-top': 'containing-width'\n 'padding-right': 'containing-width'", "response": "'padding-left': 'containing-width'\n 'left': 'containing-width'\n 'right': 'containing-width'\n 'width': 'containing-width'\n 'min-width': 'containing-width'\n 'max-width': 'containing-width'\n 'text-width': 'containing-width'\n 'top': 'containing-height'\n 'bottom': 'containing-height'\n 'height': 'containing-height'\n 'font-size': 'containing-font-size'\n 'vertical-align': 'line-height'\n 'background-position-x': 'width'\n 'background-position-y': 'height'\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n debugger\n property = @Dependencies[@getProperty(operation)] || 'containing-width'\n path = engine.getPath(scope, property)\n return ['*', ['px', value] , ['get', path]]\n\n em: (value, engine, operation, continuation, scope) ->\n path = engine.getPath(scope, 'computed-font-size')\n return ['*', ['px', value] , ['get', path]]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 51, "line_end": 69} {"id": "gss/engine:src/commands/Unit.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit\n```", "response": "({\n rem: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', this.engine.getPath(engine.scope._gss_id, 'font-size')]];\n },\n vw: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[width]']];\n },\n vh: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[height]']];\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['min', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n }\n});\n\nmodule.exports = Unit;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 51, "line_end": 69} {"id": "gss/engine:src/commands/Unit.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n rem: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', this.engine.getPath(engine.scope._gss_id, 'font-size')]];\n },\n vw: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[width]']];\n },\n vh: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[height]']];\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['min', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n }\n});\n\nmodule.exports = Unit;\n```", "response": "rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 51, "line_end": 69} {"id": "gss/engine:src/commands/Unit.coffee:2:completion", "type": "completion", "prompt": "rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]", "response": "vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "dd16ea9387358f279a6c6c2a602f44874e2d0e6f", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/dd16ea9387358f279a6c6c2a602f44874e2d0e6f/src/commands/Unit.coffee", "line_start": 51, "line_end": 69} {"id": "gss/engine:src/commands/Unit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "e0d31eda3ebf8554204221731fbcfaa35d711a39", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/commands/Unit.coffee", "line_start": 1, "line_end": 36} {"id": "gss/engine:src/commands/Unit.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nVariable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit\n```", "response": "var Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {};\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n // Dynamic lengths\n Unit.define({\n '%': function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', 'font-size']];\n },\n em: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', 'font-size']];\n },\n rem: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', this.engine.getPath(engine.scope._gss_id, 'font-size')]];\n },\n vw: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[width]']];\n },\n vh: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[height]']];\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['min', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n }\n });\n\n return Unit;\n\n}).call(this);\n\nmodule.exports = Unit;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "e0d31eda3ebf8554204221731fbcfaa35d711a39", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/commands/Unit.coffee", "line_start": 1, "line_end": 36} {"id": "gss/engine:src/commands/Unit.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {};\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n // Dynamic lengths\n Unit.define({\n '%': function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', 'font-size']];\n },\n em: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', 'font-size']];\n },\n rem: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', this.engine.getPath(engine.scope._gss_id, 'font-size')]];\n },\n vw: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[width]']];\n },\n vh: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[height]']];\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['min', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n }\n });\n\n return Unit;\n\n}).call(this);\n\nmodule.exports = Unit;\n```", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "e0d31eda3ebf8554204221731fbcfaa35d711a39", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/commands/Unit.coffee", "line_start": 1, "line_end": 36} {"id": "gss/engine:src/commands/Unit.coffee:1:completion", "type": "completion", "prompt": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n '%': (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->", "response": "return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "e0d31eda3ebf8554204221731fbcfaa35d711a39", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/commands/Unit.coffee", "line_start": 1, "line_end": 36} {"id": "gss/engine:src/commands/Unit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/commands/Unit.coffee", "line_start": 1, "line_end": 30} {"id": "gss/engine:src/commands/Unit.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nVariable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit\n```", "response": "var Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {};\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n // Dynamic lengths\n Unit.define({\n em: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', 'font-size']];\n },\n rem: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', this.engine.getPath(engine.scope._gss_id, 'font-size')]];\n },\n vw: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[width]']];\n },\n vh: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[height]']];\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['min', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n }\n });\n\n return Unit;\n\n}).call(this);\n\nmodule.exports = Unit;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/commands/Unit.coffee", "line_start": 1, "line_end": 30} {"id": "gss/engine:src/commands/Unit.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Unit, Variable;\n\nVariable = require('./Variable');\n\nUnit = (function() {\n class Unit extends Variable {};\n\n Unit.prototype.signature = [\n {\n value: ['Variable',\n 'Number']\n }\n ];\n\n // Dynamic lengths\n Unit.define({\n em: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', 'font-size']];\n },\n rem: function(value, engine, operation, continuation, scope) {\n return ['*', ['px', value], ['get', this.engine.getPath(engine.scope._gss_id, 'font-size')]];\n },\n vw: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[width]']];\n },\n vh: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['get', '::window[height]']];\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['min', ['get', '::window[height]'], ['get', '::window[width]']]];\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return ['*', ['/', ['px', value], 100], ['max', ['get', '::window[height]'], ['get', '::window[width]']]];\n }\n });\n\n return Unit;\n\n}).call(this);\n\nmodule.exports = Unit;\n```", "response": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/commands/Unit.coffee", "line_start": 1, "line_end": 30} {"id": "gss/engine:src/commands/Unit.coffee:1:completion", "type": "completion", "prompt": "Variable = require('./Variable')\n\nclass Unit extends Variable\n\n signature: [\n value: ['Variable', 'Number']\n ]\n\n # Dynamic lengths\n\n @define\n em: (value, engine, operation, continuation, scope) ->\n return ['*', ['px', value] , ['get', 'font-size']]\n\n rem: (value, engine, operation, continuation, scope) ->", "response": "return ['*', ['px', value] , ['get', @engine.getPath(engine.scope._gss_id, 'font-size')]]\n\n vw: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[width]']]\n\n vh: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['get', '::window[height]']]\n\n vmin: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['min', ['get', '::window[height]'], ['get', '::window[width]']]]\n\n vmax: (value, engine, operation, continuation, scope) ->\n return ['*', ['/', ['px', value], 100] , ['max', ['get', '::window[height]'], ['get', '::window[width]']]]\n\nmodule.exports = Unit", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/commands/Unit.coffee", "line_start": 1, "line_end": 30} {"id": "gss/engine:src/commands/Unit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Command = require('../Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCommand = require('../Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)\n```", "response": "var Command, Unit;\n\nCommand = require('../Command');\n\nUnit = (function() {\n class Unit extends Command {};\n\n Unit.prototype.type = 'Unit';\n\n Unit.prototype.signature = [\n {\n value: ['Variable']\n }\n ];\n\n return Unit;\n\n}).call(this);\n\nUnit.define({\n // Static lengths\n px: function(value) {\n return value;\n },\n pt: function(value) {\n return value;\n },\n cm: function(value) {\n return this['*'](value, 37.8);\n },\n mm: function(value) {\n return this['*'](value, 3.78);\n },\n in: function(value) {\n return this['*'](value, 96);\n },\n // Rotations\n deg: function(value) {\n return this['*'](value, Math.PI / 180);\n },\n grad: function(value) {\n return this.deg(this['/'](value, 360 / 400));\n },\n turn: function(value) {\n return this.deg(this['*'](value, 360));\n },\n rad: function(value) {\n return value;\n }\n});\n\nUnit.define({\n // Dynamic lengths\n em: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get(scope, 'font-size', continuation), value);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Command, Unit;\n\nCommand = require('../Command');\n\nUnit = (function() {\n class Unit extends Command {};\n\n Unit.prototype.type = 'Unit';\n\n Unit.prototype.signature = [\n {\n value: ['Variable']\n }\n ];\n\n return Unit;\n\n}).call(this);\n\nUnit.define({\n // Static lengths\n px: function(value) {\n return value;\n },\n pt: function(value) {\n return value;\n },\n cm: function(value) {\n return this['*'](value, 37.8);\n },\n mm: function(value) {\n return this['*'](value, 3.78);\n },\n in: function(value) {\n return this['*'](value, 96);\n },\n // Rotations\n deg: function(value) {\n return this['*'](value, Math.PI / 180);\n },\n grad: function(value) {\n return this.deg(this['/'](value, 360 / 400));\n },\n turn: function(value) {\n return this.deg(this['*'](value, 360));\n },\n rad: function(value) {\n return value;\n }\n});\n\nUnit.define({\n // Dynamic lengths\n em: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get(scope, 'font-size', continuation), value);\n }\n});\n```", "response": "Command = require('../Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:completion", "type": "completion", "prompt": "Command = require('../Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)", "response": "in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "rem: (value, engine, operation, continuation, scope) ->\n return @['*'](@get('::window', 'font-size', continuation), value)\n\n vw: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'width', continuation), 100), value)\n\n vh: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'height', continuation), 100), value)\n\n vmin: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'min', continuation), 100), value)\n\n vmax: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'max', continuation), 100), value)\n\nmodule.exports = Unit", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/commands/Unit.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nrem: (value, engine, operation, continuation, scope) ->\n return @['*'](@get('::window', 'font-size', continuation), value)\n\n vw: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'width', continuation), 100), value)\n\n vh: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'height', continuation), 100), value)\n\n vmin: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'min', continuation), 100), value)\n\n vmax: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'max', continuation), 100), value)\n\nmodule.exports = Unit\n```", "response": "({\n rem: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get('::window', 'font-size', continuation), value);\n },\n vw: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'width', continuation), 100), value);\n },\n vh: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'height', continuation), 100), value);\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'min', continuation), 100), value);\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'max', continuation), 100), value);\n }\n});\n\nmodule.exports = Unit;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/commands/Unit.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n rem: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get('::window', 'font-size', continuation), value);\n },\n vw: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'width', continuation), 100), value);\n },\n vh: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'height', continuation), 100), value);\n },\n vmin: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'min', continuation), 100), value);\n },\n vmax: function(value, engine, operation, continuation, scope) {\n return this['*'](this['/'](this.get('::window', 'max', continuation), 100), value);\n }\n});\n\nmodule.exports = Unit;\n```", "response": "rem: (value, engine, operation, continuation, scope) ->\n return @['*'](@get('::window', 'font-size', continuation), value)\n\n vw: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'width', continuation), 100), value)\n\n vh: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'height', continuation), 100), value)\n\n vmin: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'min', continuation), 100), value)\n\n vmax: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'max', continuation), 100), value)\n\nmodule.exports = Unit", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/commands/Unit.coffee:2:completion", "type": "completion", "prompt": "rem: (value, engine, operation, continuation, scope) ->\n return @['*'](@get('::window', 'font-size', continuation), value)\n\n vw: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'width', continuation), 100), value)\n\n vh: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'height', continuation), 100), value)", "response": "vmin: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'min', continuation), 100), value)\n\n vmax: (value, engine, operation, continuation, scope) ->\n return @['*'](@['/'](@get('::window', 'max', continuation), 100), value)\n\nmodule.exports = Unit", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "31938f86e04f67ada173275db8f0e673655a12e9", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/31938f86e04f67ada173275db8f0e673655a12e9/src/commands/Unit.coffee", "line_start": 51, "line_end": 66} {"id": "gss/engine:src/commands/Unit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Command = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCommand = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)\n```", "response": "var Command, Unit;\n\nCommand = require('../concepts/Command');\n\nUnit = (function() {\n class Unit extends Command {};\n\n Unit.prototype.type = 'Unit';\n\n Unit.prototype.signature = [\n {\n value: ['Variable']\n }\n ];\n\n return Unit;\n\n}).call(this);\n\nUnit.define({\n // Static lengths\n px: function(value) {\n return value;\n },\n pt: function(value) {\n return value;\n },\n cm: function(value) {\n return this['*'](value, 37.8);\n },\n mm: function(value) {\n return this['*'](value, 3.78);\n },\n in: function(value) {\n return this['*'](value, 96);\n },\n // Rotations\n deg: function(value) {\n return this['*'](value, Math.PI / 180);\n },\n grad: function(value) {\n return this.deg(this['/'](value, 360 / 400));\n },\n turn: function(value) {\n return this.deg(this['*'](value, 360));\n },\n rad: function(value) {\n return value;\n }\n});\n\nUnit.define({\n // Dynamic lengths\n em: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get(scope, 'font-size', continuation), value);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Command, Unit;\n\nCommand = require('../concepts/Command');\n\nUnit = (function() {\n class Unit extends Command {};\n\n Unit.prototype.type = 'Unit';\n\n Unit.prototype.signature = [\n {\n value: ['Variable']\n }\n ];\n\n return Unit;\n\n}).call(this);\n\nUnit.define({\n // Static lengths\n px: function(value) {\n return value;\n },\n pt: function(value) {\n return value;\n },\n cm: function(value) {\n return this['*'](value, 37.8);\n },\n mm: function(value) {\n return this['*'](value, 3.78);\n },\n in: function(value) {\n return this['*'](value, 96);\n },\n // Rotations\n deg: function(value) {\n return this['*'](value, Math.PI / 180);\n },\n grad: function(value) {\n return this.deg(this['/'](value, 360 / 400));\n },\n turn: function(value) {\n return this.deg(this['*'](value, 360));\n },\n rad: function(value) {\n return value;\n }\n});\n\nUnit.define({\n // Dynamic lengths\n em: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get(scope, 'font-size', continuation), value);\n }\n});\n```", "response": "Command = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:completion", "type": "completion", "prompt": "Command = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Variable']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)", "response": "in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "527308fd09ab6b18a30ad7b6194f0fd00f872647", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/527308fd09ab6b18a30ad7b6194f0fd00f872647/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Command = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Value']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "52c9369320bcc6e770a56d6de90833bebaed3156", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCommand = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Value']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)\n```", "response": "var Command, Unit;\n\nCommand = require('../concepts/Command');\n\nUnit = (function() {\n class Unit extends Command {};\n\n Unit.prototype.type = 'Unit';\n\n Unit.prototype.signature = [\n {\n value: ['Value']\n }\n ];\n\n return Unit;\n\n}).call(this);\n\nUnit.define({\n // Static lengths\n px: function(value) {\n return value;\n },\n pt: function(value) {\n return value;\n },\n cm: function(value) {\n return this['*'](value, 37.8);\n },\n mm: function(value) {\n return this['*'](value, 3.78);\n },\n in: function(value) {\n return this['*'](value, 96);\n },\n // Rotations\n deg: function(value) {\n return this['*'](value, Math.PI / 180);\n },\n grad: function(value) {\n return this.deg(this['/'](value, 360 / 400));\n },\n turn: function(value) {\n return this.deg(this['*'](value, 360));\n },\n rad: function(value) {\n return value;\n }\n});\n\nUnit.define({\n // Dynamic lengths\n em: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get(scope, 'font-size', continuation), value);\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "52c9369320bcc6e770a56d6de90833bebaed3156", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Command, Unit;\n\nCommand = require('../concepts/Command');\n\nUnit = (function() {\n class Unit extends Command {};\n\n Unit.prototype.type = 'Unit';\n\n Unit.prototype.signature = [\n {\n value: ['Value']\n }\n ];\n\n return Unit;\n\n}).call(this);\n\nUnit.define({\n // Static lengths\n px: function(value) {\n return value;\n },\n pt: function(value) {\n return value;\n },\n cm: function(value) {\n return this['*'](value, 37.8);\n },\n mm: function(value) {\n return this['*'](value, 3.78);\n },\n in: function(value) {\n return this['*'](value, 96);\n },\n // Rotations\n deg: function(value) {\n return this['*'](value, Math.PI / 180);\n },\n grad: function(value) {\n return this.deg(this['/'](value, 360 / 400));\n },\n turn: function(value) {\n return this.deg(this['*'](value, 360));\n },\n rad: function(value) {\n return value;\n }\n});\n\nUnit.define({\n // Dynamic lengths\n em: function(value, engine, operation, continuation, scope) {\n return this['*'](this.get(scope, 'font-size', continuation), value);\n }\n});\n```", "response": "Command = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Value']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)\n\n in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "52c9369320bcc6e770a56d6de90833bebaed3156", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "gss/engine:src/commands/Unit.coffee:1:completion", "type": "completion", "prompt": "Command = require('../concepts/Command')\n\nclass Unit extends Command\n type: 'Unit'\n\n signature: [\n value: ['Value']\n ]\n\nUnit.define\n\n # Static lengths\n\n px: (value) ->\n return value\n\n pt: (value) ->\n return value\n\n cm: (value) ->\n return @['*'](value, 37.8)\n\n mm: (value) ->\n return @['*'](value, 3.78)", "response": "in: (value) ->\n return @['*'](value, 96)\n\n\n # Rotations\n\n deg: (value) ->\n return @['*'](value, (Math.PI / 180))\n\n grad: (value) ->\n return @deg(@['/'](value, 360 / 400))\n\n turn: (value) ->\n return @deg(@['*'](value, 360))\n\n rad: (value) ->\n return value\n\nUnit.define\n\n # Dynamic lengths\n\n em: (value, engine, operation, continuation, scope) ->\n return @['*'](@get(scope, 'font-size', continuation), value)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "gss/engine", "path": "src/commands/Unit.coffee", "license": "MIT", "commit": "52c9369320bcc6e770a56d6de90833bebaed3156", "stars": 2854, "source_url": "https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/commands/Unit.coffee", "line_start": 1, "line_end": 50} {"id": "Atraci/Atraci:coffee/_notifier.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# global Settings\nclass Notifier\n @show: (options) ->\n title = options.title || ''\n body = options.body || ''\n icon = options.icon || ''\n\n if Settings.get('enable-notification') is \"true\"\n notify = new Notification(title, {\n body: body,\n icon: icon\n })\n\n notify.onclick = ->\n notify.close()\n gui.Window.get().focus()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Atraci/Atraci", "path": "coffee/_notifier.coffee", "license": "MIT", "commit": "d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_notifier.coffee", "line_start": 1, "line_end": 16} {"id": "Atraci/Atraci:coffee/_notifier.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# global Settings\nclass Notifier\n @show: (options) ->\n title = options.title || ''\n body = options.body || ''\n icon = options.icon || ''\n\n if Settings.get('enable-notification') is \"true\"\n notify = new Notification(title, {\n body: body,\n icon: icon\n })\n\n notify.onclick = ->\n notify.close()\n gui.Window.get().focus()\n```", "response": "// global Settings\nvar Notifier;\n\nNotifier = class Notifier {\n static show(options) {\n var body, icon, notify, title;\n title = options.title || '';\n body = options.body || '';\n icon = options.icon || '';\n if (Settings.get('enable-notification') === \"true\") {\n notify = new Notification(title, {\n body: body,\n icon: icon\n });\n return notify.onclick = function() {\n notify.close();\n return gui.Window.get().focus();\n };\n }\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Atraci/Atraci", "path": "coffee/_notifier.coffee", "license": "MIT", "commit": "d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_notifier.coffee", "line_start": 1, "line_end": 16} {"id": "Atraci/Atraci:coffee/_notifier.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// global Settings\nvar Notifier;\n\nNotifier = class Notifier {\n static show(options) {\n var body, icon, notify, title;\n title = options.title || '';\n body = options.body || '';\n icon = options.icon || '';\n if (Settings.get('enable-notification') === \"true\") {\n notify = new Notification(title, {\n body: body,\n icon: icon\n });\n return notify.onclick = function() {\n notify.close();\n return gui.Window.get().focus();\n };\n }\n }\n\n};\n```", "response": "# global Settings\nclass Notifier\n @show: (options) ->\n title = options.title || ''\n body = options.body || ''\n icon = options.icon || ''\n\n if Settings.get('enable-notification') is \"true\"\n notify = new Notification(title, {\n body: body,\n icon: icon\n })\n\n notify.onclick = ->\n notify.close()\n gui.Window.get().focus()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Atraci/Atraci", "path": "coffee/_notifier.coffee", "license": "MIT", "commit": "d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_notifier.coffee", "line_start": 1, "line_end": 16} {"id": "Atraci/Atraci:coffee/_notifier.coffee:1:completion", "type": "completion", "prompt": "# global Settings\nclass Notifier\n @show: (options) ->\n title = options.title || ''\n body = options.body || ''\n icon = options.icon || ''\n\n if Settings.get('enable-notification') is \"true\"", "response": "notify = new Notification(title, {\n body: body,\n icon: icon\n })\n\n notify.onclick = ->\n notify.close()\n gui.Window.get().focus()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Atraci/Atraci", "path": "coffee/_notifier.coffee", "license": "MIT", "commit": "d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca", "stars": 800, "source_url": "https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_notifier.coffee", "line_start": 1, "line_end": 16} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'members-row'\n mixins: [ mixinModal, mixinSubscribe, mixinUser, PureRenderMixin ]\n\n propsTypes:\n _teamId: T.string.isRequired\n _memberIds: T.instanceOf(Immutable.List).isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onChange: T.func.isRequired\n isEditable: T.bool\n maxNum: T.number\n\n getDefaultProps: ->\n isEditable: false\n\n beyondMaxNum: ->\n @props.maxNum? and @props.maxNum < @props._memberIds.size\n\n onClickPlus: ->\n @onOpenModal()\n\n onRemoveMember: (_id) ->\n if @props.isEditable\n _memberIds = @props._memberIds.filterNot (_memberId) ->\n _memberId is _id\n @props.onChange(_memberIds)\n\n handleSubmitMember: (memberIds) ->\n @props.onChange memberIds\n\n renderRosterManagement: ->\n SlimModal\n name: 'roster-management'\n title: lang.getText('invite-members')\n show: @state.showModal\n onClose: @onCloseModal\n RosterManagement\n _teamId: @props._teamId\n onClose: @onCloseModal\n isRemovable: true\n onSubmit: @handleSubmitMember\n selectedContacts: @props._memberIds\n\n renderMember: (member) ->\n classAvatar = cx 'cell', 'avatar-small', 'round'\n styleAvatar =\n if member.has('avatarUrl') and member.get('avatarUrl').length > 0\n backgroundImage: \"url(#{ member.get('avatarUrl') })\"\n else\n {}", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 23, "line_end": 72} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'members-row'\n mixins: [ mixinModal, mixinSubscribe, mixinUser, PureRenderMixin ]\n\n propsTypes:\n _teamId: T.string.isRequired\n _memberIds: T.instanceOf(Immutable.List).isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onChange: T.func.isRequired\n isEditable: T.bool\n maxNum: T.number\n\n getDefaultProps: ->\n isEditable: false\n\n beyondMaxNum: ->\n @props.maxNum? and @props.maxNum < @props._memberIds.size\n\n onClickPlus: ->\n @onOpenModal()\n\n onRemoveMember: (_id) ->\n if @props.isEditable\n _memberIds = @props._memberIds.filterNot (_memberId) ->\n _memberId is _id\n @props.onChange(_memberIds)\n\n handleSubmitMember: (memberIds) ->\n @props.onChange memberIds\n\n renderRosterManagement: ->\n SlimModal\n name: 'roster-management'\n title: lang.getText('invite-members')\n show: @state.showModal\n onClose: @onCloseModal\n RosterManagement\n _teamId: @props._teamId\n onClose: @onCloseModal\n isRemovable: true\n onSubmit: @handleSubmitMember\n selectedContacts: @props._memberIds\n\n renderMember: (member) ->\n classAvatar = cx 'cell', 'avatar-small', 'round'\n styleAvatar =\n if member.has('avatarUrl') and member.get('avatarUrl').length > 0\n backgroundImage: \"url(#{ member.get('avatarUrl') })\"\n else\n {}\n```", "response": "module.exports = React.createClass({\n displayName: 'members-row',\n mixins: [mixinModal, mixinSubscribe, mixinUser, PureRenderMixin],\n propsTypes: {\n _teamId: T.string.isRequired,\n _memberIds: T.instanceOf(Immutable.List).isRequired,\n contacts: T.instanceOf(Immutable.List).isRequired,\n onChange: T.func.isRequired,\n isEditable: T.bool,\n maxNum: T.number\n },\n getDefaultProps: function() {\n return {\n isEditable: false\n };\n },\n beyondMaxNum: function() {\n return (this.props.maxNum != null) && this.props.maxNum < this.props._memberIds.size;\n },\n onClickPlus: function() {\n return this.onOpenModal();\n },\n onRemoveMember: function(_id) {\n var _memberIds;\n if (this.props.isEditable) {\n _memberIds = this.props._memberIds.filterNot(function(_memberId) {\n return _memberId === _id;\n });\n return this.props.onChange(_memberIds);\n }\n },\n handleSubmitMember: function(memberIds) {\n return this.props.onChange(memberIds);\n },\n renderRosterManagement: function() {\n return SlimModal({\n name: 'roster-management',\n title: lang.getText('invite-members'),\n show: this.state.showModal,\n onClose: this.onCloseModal\n }, RosterManagement({\n _teamId: this.props._teamId,\n onClose: this.onCloseModal,\n isRemovable: true,\n onSubmit: this.handleSubmitMember,\n selectedContacts: this.props._memberIds\n }));\n },\n renderMember: function(member) {\n var classAvatar, styleAvatar;\n classAvatar = cx('cell', 'avatar-small', 'round');\n return styleAvatar = member.has('avatarUrl') && member.get('avatarUrl').length > 0 ? {\n backgroundImage: `url(${member.get('avatarUrl')})`\n } : {};\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 23, "line_end": 72} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'members-row',\n mixins: [mixinModal, mixinSubscribe, mixinUser, PureRenderMixin],\n propsTypes: {\n _teamId: T.string.isRequired,\n _memberIds: T.instanceOf(Immutable.List).isRequired,\n contacts: T.instanceOf(Immutable.List).isRequired,\n onChange: T.func.isRequired,\n isEditable: T.bool,\n maxNum: T.number\n },\n getDefaultProps: function() {\n return {\n isEditable: false\n };\n },\n beyondMaxNum: function() {\n return (this.props.maxNum != null) && this.props.maxNum < this.props._memberIds.size;\n },\n onClickPlus: function() {\n return this.onOpenModal();\n },\n onRemoveMember: function(_id) {\n var _memberIds;\n if (this.props.isEditable) {\n _memberIds = this.props._memberIds.filterNot(function(_memberId) {\n return _memberId === _id;\n });\n return this.props.onChange(_memberIds);\n }\n },\n handleSubmitMember: function(memberIds) {\n return this.props.onChange(memberIds);\n },\n renderRosterManagement: function() {\n return SlimModal({\n name: 'roster-management',\n title: lang.getText('invite-members'),\n show: this.state.showModal,\n onClose: this.onCloseModal\n }, RosterManagement({\n _teamId: this.props._teamId,\n onClose: this.onCloseModal,\n isRemovable: true,\n onSubmit: this.handleSubmitMember,\n selectedContacts: this.props._memberIds\n }));\n },\n renderMember: function(member) {\n var classAvatar, styleAvatar;\n classAvatar = cx('cell', 'avatar-small', 'round');\n return styleAvatar = member.has('avatarUrl') && member.get('avatarUrl').length > 0 ? {\n backgroundImage: `url(${member.get('avatarUrl')})`\n } : {};\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'members-row'\n mixins: [ mixinModal, mixinSubscribe, mixinUser, PureRenderMixin ]\n\n propsTypes:\n _teamId: T.string.isRequired\n _memberIds: T.instanceOf(Immutable.List).isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onChange: T.func.isRequired\n isEditable: T.bool\n maxNum: T.number\n\n getDefaultProps: ->\n isEditable: false\n\n beyondMaxNum: ->\n @props.maxNum? and @props.maxNum < @props._memberIds.size\n\n onClickPlus: ->\n @onOpenModal()\n\n onRemoveMember: (_id) ->\n if @props.isEditable\n _memberIds = @props._memberIds.filterNot (_memberId) ->\n _memberId is _id\n @props.onChange(_memberIds)\n\n handleSubmitMember: (memberIds) ->\n @props.onChange memberIds\n\n renderRosterManagement: ->\n SlimModal\n name: 'roster-management'\n title: lang.getText('invite-members')\n show: @state.showModal\n onClose: @onCloseModal\n RosterManagement\n _teamId: @props._teamId\n onClose: @onCloseModal\n isRemovable: true\n onSubmit: @handleSubmitMember\n selectedContacts: @props._memberIds\n\n renderMember: (member) ->\n classAvatar = cx 'cell', 'avatar-small', 'round'\n styleAvatar =\n if member.has('avatarUrl') and member.get('avatarUrl').length > 0\n backgroundImage: \"url(#{ member.get('avatarUrl') })\"\n else\n {}", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 23, "line_end": 72} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'members-row'\n mixins: [ mixinModal, mixinSubscribe, mixinUser, PureRenderMixin ]\n\n propsTypes:\n _teamId: T.string.isRequired\n _memberIds: T.instanceOf(Immutable.List).isRequired\n contacts: T.instanceOf(Immutable.List).isRequired\n onChange: T.func.isRequired\n isEditable: T.bool\n maxNum: T.number\n\n getDefaultProps: ->\n isEditable: false\n\n beyondMaxNum: ->\n @props.maxNum? and @props.maxNum < @props._memberIds.size\n\n onClickPlus: ->\n @onOpenModal()\n\n onRemoveMember: (_id) ->\n if @props.isEditable\n _memberIds = @props._memberIds.filterNot (_memberId) ->\n _memberId is _id", "response": "@props.onChange(_memberIds)\n\n handleSubmitMember: (memberIds) ->\n @props.onChange memberIds\n\n renderRosterManagement: ->\n SlimModal\n name: 'roster-management'\n title: lang.getText('invite-members')\n show: @state.showModal\n onClose: @onCloseModal\n RosterManagement\n _teamId: @props._teamId\n onClose: @onCloseModal\n isRemovable: true\n onSubmit: @handleSubmitMember\n selectedContacts: @props._memberIds\n\n renderMember: (member) ->\n classAvatar = cx 'cell', 'avatar-small', 'round'\n styleAvatar =\n if member.has('avatarUrl') and member.get('avatarUrl').length > 0\n backgroundImage: \"url(#{ member.get('avatarUrl') })\"\n else\n {}", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 23, "line_end": 72} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "onClickAvatar = (e) =>\n e.stopPropagation()\n @onRemoveMember member.get('_id')\n\n Tooltip key: member.get('_id'), template: member.get('name'),\n span className: 'cell avatar small round', style: styleAvatar,\n if @props.isEditable and not @isUser member.get '_id'\n Icon name: 'remove', onClick: onClickAvatar\n\n renderMembers: ->\n _memberIds = if @beyondMaxNum() then @props._memberIds[..@props.maxNum - 2] else @props._memberIds\n\n @props.contacts\n .filter (contact) ->\n _memberIds.includes(contact.get('_id'))\n .map @renderMember\n\n renderMore: ->\n if @beyondMaxNum()\n Icon name: 'ellipsis', className: 'muted cell more'\n\n renderPlus: ->\n if @props.isEditable\n Tooltip template: lang.getText('invite-members'),\n span className: 'plus', onClick: @onClickPlus,\n Icon name: 'plus-circle-solid', size: 30\n\n render: ->\n classMembersRow = cx 'members-row', 'is-editable': @props.isEditable\n div className: classMembersRow,\n @renderPlus()\n @renderMembers()\n @renderMore()\n @renderRosterManagement()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 73, "line_end": 106} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nonClickAvatar = (e) =>\n e.stopPropagation()\n @onRemoveMember member.get('_id')\n\n Tooltip key: member.get('_id'), template: member.get('name'),\n span className: 'cell avatar small round', style: styleAvatar,\n if @props.isEditable and not @isUser member.get '_id'\n Icon name: 'remove', onClick: onClickAvatar\n\n renderMembers: ->\n _memberIds = if @beyondMaxNum() then @props._memberIds[..@props.maxNum - 2] else @props._memberIds\n\n @props.contacts\n .filter (contact) ->\n _memberIds.includes(contact.get('_id'))\n .map @renderMember\n\n renderMore: ->\n if @beyondMaxNum()\n Icon name: 'ellipsis', className: 'muted cell more'\n\n renderPlus: ->\n if @props.isEditable\n Tooltip template: lang.getText('invite-members'),\n span className: 'plus', onClick: @onClickPlus,\n Icon name: 'plus-circle-solid', size: 30\n\n render: ->\n classMembersRow = cx 'members-row', 'is-editable': @props.isEditable\n div className: classMembersRow,\n @renderPlus()\n @renderMembers()\n @renderMore()\n @renderRosterManagement()\n```", "response": "var onClickAvatar;\n\nonClickAvatar = (e) => {\n e.stopPropagation();\n return this.onRemoveMember(member.get('_id'));\n};\n\nTooltip({\n key: member.get('_id'),\n template: member.get('name')\n}, span({\n className: 'cell avatar small round',\n style: styleAvatar\n}, this.props.isEditable && !this.isUser(member.get('_id')) ? Icon({\n name: 'remove',\n onClick: onClickAvatar\n}) : void 0));\n\n({\n renderMembers: function() {\n var _memberIds;\n _memberIds = this.beyondMaxNum() ? this.props._memberIds.slice(0, +(this.props.maxNum - 2) + 1 || 9e9) : this.props._memberIds;\n return this.props.contacts.filter(function(contact) {\n return _memberIds.includes(contact.get('_id'));\n }).map(this.renderMember);\n },\n renderMore: function() {\n if (this.beyondMaxNum()) {\n return Icon({\n name: 'ellipsis',\n className: 'muted cell more'\n });\n }\n },\n renderPlus: function() {\n if (this.props.isEditable) {\n return Tooltip({\n template: lang.getText('invite-members')\n }, span({\n className: 'plus',\n onClick: this.onClickPlus\n }, Icon({\n name: 'plus-circle-solid',\n size: 30\n })));\n }\n },\n render: function() {\n var classMembersRow;\n classMembersRow = cx('members-row', {\n 'is-editable': this.props.isEditable\n });\n return div({\n className: classMembersRow\n }, this.renderPlus(), this.renderMembers(), this.renderMore(), this.renderRosterManagement());\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 73, "line_end": 106} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar onClickAvatar;\n\nonClickAvatar = (e) => {\n e.stopPropagation();\n return this.onRemoveMember(member.get('_id'));\n};\n\nTooltip({\n key: member.get('_id'),\n template: member.get('name')\n}, span({\n className: 'cell avatar small round',\n style: styleAvatar\n}, this.props.isEditable && !this.isUser(member.get('_id')) ? Icon({\n name: 'remove',\n onClick: onClickAvatar\n}) : void 0));\n\n({\n renderMembers: function() {\n var _memberIds;\n _memberIds = this.beyondMaxNum() ? this.props._memberIds.slice(0, +(this.props.maxNum - 2) + 1 || 9e9) : this.props._memberIds;\n return this.props.contacts.filter(function(contact) {\n return _memberIds.includes(contact.get('_id'));\n }).map(this.renderMember);\n },\n renderMore: function() {\n if (this.beyondMaxNum()) {\n return Icon({\n name: 'ellipsis',\n className: 'muted cell more'\n });\n }\n },\n renderPlus: function() {\n if (this.props.isEditable) {\n return Tooltip({\n template: lang.getText('invite-members')\n }, span({\n className: 'plus',\n onClick: this.onClickPlus\n }, Icon({\n name: 'plus-circle-solid',\n size: 30\n })));\n }\n },\n render: function() {\n var classMembersRow;\n classMembersRow = cx('members-row', {\n 'is-editable': this.props.isEditable\n });\n return div({\n className: classMembersRow\n }, this.renderPlus(), this.renderMembers(), this.renderMore(), this.renderRosterManagement());\n }\n});\n```", "response": "onClickAvatar = (e) =>\n e.stopPropagation()\n @onRemoveMember member.get('_id')\n\n Tooltip key: member.get('_id'), template: member.get('name'),\n span className: 'cell avatar small round', style: styleAvatar,\n if @props.isEditable and not @isUser member.get '_id'\n Icon name: 'remove', onClick: onClickAvatar\n\n renderMembers: ->\n _memberIds = if @beyondMaxNum() then @props._memberIds[..@props.maxNum - 2] else @props._memberIds\n\n @props.contacts\n .filter (contact) ->\n _memberIds.includes(contact.get('_id'))\n .map @renderMember\n\n renderMore: ->\n if @beyondMaxNum()\n Icon name: 'ellipsis', className: 'muted cell more'\n\n renderPlus: ->\n if @props.isEditable\n Tooltip template: lang.getText('invite-members'),\n span className: 'plus', onClick: @onClickPlus,\n Icon name: 'plus-circle-solid', size: 30\n\n render: ->\n classMembersRow = cx 'members-row', 'is-editable': @props.isEditable\n div className: classMembersRow,\n @renderPlus()\n @renderMembers()\n @renderMore()\n @renderRosterManagement()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 73, "line_end": 106} {"id": "jianliaoim/talk-os:talk-web/client/app/members-row.coffee:2:completion", "type": "completion", "prompt": "onClickAvatar = (e) =>\n e.stopPropagation()\n @onRemoveMember member.get('_id')\n\n Tooltip key: member.get('_id'), template: member.get('name'),\n span className: 'cell avatar small round', style: styleAvatar,\n if @props.isEditable and not @isUser member.get '_id'\n Icon name: 'remove', onClick: onClickAvatar\n\n renderMembers: ->\n _memberIds = if @beyondMaxNum() then @props._memberIds[..@props.maxNum - 2] else @props._memberIds\n\n @props.contacts\n .filter (contact) ->\n _memberIds.includes(contact.get('_id'))\n .map @renderMember", "response": "renderMore: ->\n if @beyondMaxNum()\n Icon name: 'ellipsis', className: 'muted cell more'\n\n renderPlus: ->\n if @props.isEditable\n Tooltip template: lang.getText('invite-members'),\n span className: 'plus', onClick: @onClickPlus,\n Icon name: 'plus-circle-solid', size: 30\n\n render: ->\n classMembersRow = cx 'members-row', 'is-editable': @props.isEditable\n div className: classMembersRow,\n @renderPlus()\n @renderMembers()\n @renderMore()\n @renderRosterManagement()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/members-row.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/members-row.coffee", "line_start": 73, "line_end": 106} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.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\ndescribe 'Unit: _.jsExec', ->\n beforeEach ->\n jasmine.addMatchers {\n toBeFunction: ->\n return {\n compare: (actual) ->\n return {\n pass: _.isFunction actual\n }\n }\n }\n\n it 'should return undefined if given undefined', ->\n expect(_.jsExec(undefined)).toBeUndefined()\n\n it 'should return null if given null', ->\n expect(_.jsExec(null)).toBeNull()\n\n it 'should return a number if given a number', ->\n expect(_.jsExec(99, {})).toBe 99\n\n it 'should return a boolean if given a boolean', ->\n expect(_.jsExec(true, {})).toBeTrue()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 1, "line_end": 39} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.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\ndescribe 'Unit: _.jsExec', ->\n beforeEach ->\n jasmine.addMatchers {\n toBeFunction: ->\n return {\n compare: (actual) ->\n return {\n pass: _.isFunction actual\n }\n }\n }\n\n it 'should return undefined if given undefined', ->\n expect(_.jsExec(undefined)).toBeUndefined()\n\n it 'should return null if given null', ->\n expect(_.jsExec(null)).toBeNull()\n\n it 'should return a number if given a number', ->\n expect(_.jsExec(99, {})).toBe 99\n\n it 'should return a boolean if given a boolean', ->\n expect(_.jsExec(true, {})).toBeTrue()\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 */\ndescribe('Unit: _.jsExec', function() {\n beforeEach(function() {\n return jasmine.addMatchers({\n toBeFunction: function() {\n return {\n compare: function(actual) {\n return {\n pass: _.isFunction(actual)\n };\n }\n };\n }\n });\n });\n it('should return undefined if given undefined', function() {\n return expect(_.jsExec(void 0)).toBeUndefined();\n });\n it('should return null if given null', function() {\n return expect(_.jsExec(null)).toBeNull();\n });\n it('should return a number if given a number', function() {\n return expect(_.jsExec(99, {})).toBe(99);\n });\n return it('should return a boolean if given a boolean', function() {\n return expect(_.jsExec(true, {})).toBeTrue();\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 1, "line_end": 39} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.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 */\ndescribe('Unit: _.jsExec', function() {\n beforeEach(function() {\n return jasmine.addMatchers({\n toBeFunction: function() {\n return {\n compare: function(actual) {\n return {\n pass: _.isFunction(actual)\n };\n }\n };\n }\n });\n });\n it('should return undefined if given undefined', function() {\n return expect(_.jsExec(void 0)).toBeUndefined();\n });\n it('should return null if given null', function() {\n return expect(_.jsExec(null)).toBeNull();\n });\n it('should return a number if given a number', function() {\n return expect(_.jsExec(99, {})).toBe(99);\n });\n return it('should return a boolean if given a boolean', function() {\n return expect(_.jsExec(true, {})).toBeTrue();\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\ndescribe 'Unit: _.jsExec', ->\n beforeEach ->\n jasmine.addMatchers {\n toBeFunction: ->\n return {\n compare: (actual) ->\n return {\n pass: _.isFunction actual\n }\n }\n }\n\n it 'should return undefined if given undefined', ->\n expect(_.jsExec(undefined)).toBeUndefined()\n\n it 'should return null if given null', ->\n expect(_.jsExec(null)).toBeNull()\n\n it 'should return a number if given a number', ->\n expect(_.jsExec(99, {})).toBe 99\n\n it 'should return a boolean if given a boolean', ->\n expect(_.jsExec(true, {})).toBeTrue()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 1, "line_end": 39} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.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\ndescribe 'Unit: _.jsExec', ->\n beforeEach ->\n jasmine.addMatchers {", "response": "toBeFunction: ->\n return {\n compare: (actual) ->\n return {\n pass: _.isFunction actual\n }\n }\n }\n\n it 'should return undefined if given undefined', ->\n expect(_.jsExec(undefined)).toBeUndefined()\n\n it 'should return null if given null', ->\n expect(_.jsExec(null)).toBeNull()\n\n it 'should return a number if given a number', ->\n expect(_.jsExec(99, {})).toBe 99\n\n it 'should return a boolean if given a boolean', ->\n expect(_.jsExec(true, {})).toBeTrue()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 1, "line_end": 39} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "it 'should return empty string if given an empty string', ->\n expect(_.jsExec('', {})).toBeEmptyString()\n\n it 'should return empty string if given an empty inline JS string', ->\n expect(_.jsExec('hello ${}there', {})).toBe 'hello there'\n\n it 'should return an unchanged string if no inline JS is found', ->\n expect(_.jsExec('hello there')).toBe 'hello there'\n\n it 'should perform simple arithmetic', ->\n expect(_.jsExec('The Answer: ${1+1}')).toBe 'The Answer: 2'\n\n it 'should return booleans', ->\n expect(_.jsExec('The Answer: ${true}')).toBe 'The Answer: true'\n\n it 'should replace the entire string with a boolean', ->\n expect(_.jsExec('${true}')).toBeTrue()\n\n it 'should replace the entire string with a number', ->\n expect(_.jsExec('${99.12}')).toBe 99.12\n\n it 'should replace the entire string with a function', ->\n fn = _.jsExec('${function(){return true;}}')\n expect(_.isFunction(fn)).toBeTrue()\n expect(fn()).toBeTrue()\n\n it 'should calculate boolean expressions', ->\n expect(_.jsExec('The Answer: ${2+2==4}')).toBe 'The Answer: true'\n\n it 'should perform string manipulations', ->\n expect(_.jsExec('${\"foo\" + \"bar\"}')).toBe 'foobar'\n\n it 'should allow moment.js expressions', ->\n expect(_.jsExec('${moment.utc([2011, 0, 1, 8]).format(\"YYYY-MM-DD\")}')).toBe '2011-01-01'\n\n it 'should allow javascript functions', ->\n val = _.jsExec('${function (a) { return a+1; }}')\n expect(val).toBeFunction()\n\n it 'should allow javascript functions defined as variables', ->\n val = _.jsExec('${fn = function (a) { return a+1; }}')\n expect(val).toBeFunction()\n expect(val(4)).toBe 5", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 41, "line_end": 83} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nit 'should return empty string if given an empty string', ->\n expect(_.jsExec('', {})).toBeEmptyString()\n\n it 'should return empty string if given an empty inline JS string', ->\n expect(_.jsExec('hello ${}there', {})).toBe 'hello there'\n\n it 'should return an unchanged string if no inline JS is found', ->\n expect(_.jsExec('hello there')).toBe 'hello there'\n\n it 'should perform simple arithmetic', ->\n expect(_.jsExec('The Answer: ${1+1}')).toBe 'The Answer: 2'\n\n it 'should return booleans', ->\n expect(_.jsExec('The Answer: ${true}')).toBe 'The Answer: true'\n\n it 'should replace the entire string with a boolean', ->\n expect(_.jsExec('${true}')).toBeTrue()\n\n it 'should replace the entire string with a number', ->\n expect(_.jsExec('${99.12}')).toBe 99.12\n\n it 'should replace the entire string with a function', ->\n fn = _.jsExec('${function(){return true;}}')\n expect(_.isFunction(fn)).toBeTrue()\n expect(fn()).toBeTrue()\n\n it 'should calculate boolean expressions', ->\n expect(_.jsExec('The Answer: ${2+2==4}')).toBe 'The Answer: true'\n\n it 'should perform string manipulations', ->\n expect(_.jsExec('${\"foo\" + \"bar\"}')).toBe 'foobar'\n\n it 'should allow moment.js expressions', ->\n expect(_.jsExec('${moment.utc([2011, 0, 1, 8]).format(\"YYYY-MM-DD\")}')).toBe '2011-01-01'\n\n it 'should allow javascript functions', ->\n val = _.jsExec('${function (a) { return a+1; }}')\n expect(val).toBeFunction()\n\n it 'should allow javascript functions defined as variables', ->\n val = _.jsExec('${fn = function (a) { return a+1; }}')\n expect(val).toBeFunction()\n expect(val(4)).toBe 5\n```", "response": "it('should return empty string if given an empty string', function() {\n return expect(_.jsExec('', {})).toBeEmptyString();\n});\n\nit('should return empty string if given an empty inline JS string', function() {\n return expect(_.jsExec('hello ${}there', {})).toBe('hello there');\n});\n\nit('should return an unchanged string if no inline JS is found', function() {\n return expect(_.jsExec('hello there')).toBe('hello there');\n});\n\nit('should perform simple arithmetic', function() {\n return expect(_.jsExec('The Answer: ${1+1}')).toBe('The Answer: 2');\n});\n\nit('should return booleans', function() {\n return expect(_.jsExec('The Answer: ${true}')).toBe('The Answer: true');\n});\n\nit('should replace the entire string with a boolean', function() {\n return expect(_.jsExec('${true}')).toBeTrue();\n});\n\nit('should replace the entire string with a number', function() {\n return expect(_.jsExec('${99.12}')).toBe(99.12);\n});\n\nit('should replace the entire string with a function', function() {\n var fn;\n fn = _.jsExec('${function(){return true;}}');\n expect(_.isFunction(fn)).toBeTrue();\n return expect(fn()).toBeTrue();\n});\n\nit('should calculate boolean expressions', function() {\n return expect(_.jsExec('The Answer: ${2+2==4}')).toBe('The Answer: true');\n});\n\nit('should perform string manipulations', function() {\n return expect(_.jsExec('${\"foo\" + \"bar\"}')).toBe('foobar');\n});\n\nit('should allow moment.js expressions', function() {\n return expect(_.jsExec('${moment.utc([2011, 0, 1, 8]).format(\"YYYY-MM-DD\")}')).toBe('2011-01-01');\n});\n\nit('should allow javascript functions', function() {\n var val;\n val = _.jsExec('${function (a) { return a+1; }}');\n return expect(val).toBeFunction();\n});\n\nit('should allow javascript functions defined as variables', function() {\n var val;\n val = _.jsExec('${fn = function (a) { return a+1; }}');\n expect(val).toBeFunction();\n return expect(val(4)).toBe(5);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 41, "line_end": 83} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nit('should return empty string if given an empty string', function() {\n return expect(_.jsExec('', {})).toBeEmptyString();\n});\n\nit('should return empty string if given an empty inline JS string', function() {\n return expect(_.jsExec('hello ${}there', {})).toBe('hello there');\n});\n\nit('should return an unchanged string if no inline JS is found', function() {\n return expect(_.jsExec('hello there')).toBe('hello there');\n});\n\nit('should perform simple arithmetic', function() {\n return expect(_.jsExec('The Answer: ${1+1}')).toBe('The Answer: 2');\n});\n\nit('should return booleans', function() {\n return expect(_.jsExec('The Answer: ${true}')).toBe('The Answer: true');\n});\n\nit('should replace the entire string with a boolean', function() {\n return expect(_.jsExec('${true}')).toBeTrue();\n});\n\nit('should replace the entire string with a number', function() {\n return expect(_.jsExec('${99.12}')).toBe(99.12);\n});\n\nit('should replace the entire string with a function', function() {\n var fn;\n fn = _.jsExec('${function(){return true;}}');\n expect(_.isFunction(fn)).toBeTrue();\n return expect(fn()).toBeTrue();\n});\n\nit('should calculate boolean expressions', function() {\n return expect(_.jsExec('The Answer: ${2+2==4}')).toBe('The Answer: true');\n});\n\nit('should perform string manipulations', function() {\n return expect(_.jsExec('${\"foo\" + \"bar\"}')).toBe('foobar');\n});\n\nit('should allow moment.js expressions', function() {\n return expect(_.jsExec('${moment.utc([2011, 0, 1, 8]).format(\"YYYY-MM-DD\")}')).toBe('2011-01-01');\n});\n\nit('should allow javascript functions', function() {\n var val;\n val = _.jsExec('${function (a) { return a+1; }}');\n return expect(val).toBeFunction();\n});\n\nit('should allow javascript functions defined as variables', function() {\n var val;\n val = _.jsExec('${fn = function (a) { return a+1; }}');\n expect(val).toBeFunction();\n return expect(val(4)).toBe(5);\n});\n```", "response": "it 'should return empty string if given an empty string', ->\n expect(_.jsExec('', {})).toBeEmptyString()\n\n it 'should return empty string if given an empty inline JS string', ->\n expect(_.jsExec('hello ${}there', {})).toBe 'hello there'\n\n it 'should return an unchanged string if no inline JS is found', ->\n expect(_.jsExec('hello there')).toBe 'hello there'\n\n it 'should perform simple arithmetic', ->\n expect(_.jsExec('The Answer: ${1+1}')).toBe 'The Answer: 2'\n\n it 'should return booleans', ->\n expect(_.jsExec('The Answer: ${true}')).toBe 'The Answer: true'\n\n it 'should replace the entire string with a boolean', ->\n expect(_.jsExec('${true}')).toBeTrue()\n\n it 'should replace the entire string with a number', ->\n expect(_.jsExec('${99.12}')).toBe 99.12\n\n it 'should replace the entire string with a function', ->\n fn = _.jsExec('${function(){return true;}}')\n expect(_.isFunction(fn)).toBeTrue()\n expect(fn()).toBeTrue()\n\n it 'should calculate boolean expressions', ->\n expect(_.jsExec('The Answer: ${2+2==4}')).toBe 'The Answer: true'\n\n it 'should perform string manipulations', ->\n expect(_.jsExec('${\"foo\" + \"bar\"}')).toBe 'foobar'\n\n it 'should allow moment.js expressions', ->\n expect(_.jsExec('${moment.utc([2011, 0, 1, 8]).format(\"YYYY-MM-DD\")}')).toBe '2011-01-01'\n\n it 'should allow javascript functions', ->\n val = _.jsExec('${function (a) { return a+1; }}')\n expect(val).toBeFunction()\n\n it 'should allow javascript functions defined as variables', ->\n val = _.jsExec('${fn = function (a) { return a+1; }}')\n expect(val).toBeFunction()\n expect(val(4)).toBe 5", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 41, "line_end": 83} {"id": "ExpediaGroup/cyclotron:cyclotron-site/test/unit/mixins-jsexec-spec.coffee:2:completion", "type": "completion", "prompt": "it 'should return empty string if given an empty string', ->\n expect(_.jsExec('', {})).toBeEmptyString()\n\n it 'should return empty string if given an empty inline JS string', ->\n expect(_.jsExec('hello ${}there', {})).toBe 'hello there'\n\n it 'should return an unchanged string if no inline JS is found', ->\n expect(_.jsExec('hello there')).toBe 'hello there'\n\n it 'should perform simple arithmetic', ->\n expect(_.jsExec('The Answer: ${1+1}')).toBe 'The Answer: 2'\n\n it 'should return booleans', ->\n expect(_.jsExec('The Answer: ${true}')).toBe 'The Answer: true'\n\n it 'should replace the entire string with a boolean', ->\n expect(_.jsExec('${true}')).toBeTrue()\n\n it 'should replace the entire string with a number', ->\n expect(_.jsExec('${99.12}')).toBe 99.12", "response": "it 'should replace the entire string with a function', ->\n fn = _.jsExec('${function(){return true;}}')\n expect(_.isFunction(fn)).toBeTrue()\n expect(fn()).toBeTrue()\n\n it 'should calculate boolean expressions', ->\n expect(_.jsExec('The Answer: ${2+2==4}')).toBe 'The Answer: true'\n\n it 'should perform string manipulations', ->\n expect(_.jsExec('${\"foo\" + \"bar\"}')).toBe 'foobar'\n\n it 'should allow moment.js expressions', ->\n expect(_.jsExec('${moment.utc([2011, 0, 1, 8]).format(\"YYYY-MM-DD\")}')).toBe '2011-01-01'\n\n it 'should allow javascript functions', ->\n val = _.jsExec('${function (a) { return a+1; }}')\n expect(val).toBeFunction()\n\n it 'should allow javascript functions defined as variables', ->\n val = _.jsExec('${fn = function (a) { return a+1; }}')\n expect(val).toBeFunction()\n expect(val(4)).toBe 5", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "license": "MIT", "commit": "0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/test/unit/mixins-jsexec-spec.coffee", "line_start": 41, "line_end": 83} {"id": "meltingice/psd.js:lib/psd/layer_info/unicode_name.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "LayerInfo = require '../layer_info.coffee'\n\nmodule.exports = class UnicodeName extends LayerInfo\n @shouldParse: (key) -> key is 'luni'\n\n parse: ->\n pos = @file.tell()\n @data = @file.readUnicodeString()\n\n @file.seek pos + @length\n return @", "source_lang": "", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/unicode_name.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/unicode_name.coffee", "line_start": 1, "line_end": 11} {"id": "meltingice/psd.js:lib/psd/layer_info/unicode_name.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 UnicodeName extends LayerInfo\n @shouldParse: (key) -> key is 'luni'\n\n parse: ->\n pos = @file.tell()\n @data = @file.readUnicodeString()\n\n @file.seek pos + @length\n return @\n```", "response": "var LayerInfo, UnicodeName;\n\nLayerInfo = require('../layer_info.coffee');\n\nmodule.exports = UnicodeName = class UnicodeName extends LayerInfo {\n static shouldParse(key) {\n return key === 'luni';\n }\n\n parse() {\n var pos;\n pos = this.file.tell();\n this.data = this.file.readUnicodeString();\n this.file.seek(pos + this.length);\n return this;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/unicode_name.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/unicode_name.coffee", "line_start": 1, "line_end": 11} {"id": "meltingice/psd.js:lib/psd/layer_info/unicode_name.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar LayerInfo, UnicodeName;\n\nLayerInfo = require('../layer_info.coffee');\n\nmodule.exports = UnicodeName = class UnicodeName extends LayerInfo {\n static shouldParse(key) {\n return key === 'luni';\n }\n\n parse() {\n var pos;\n pos = this.file.tell();\n this.data = this.file.readUnicodeString();\n this.file.seek(pos + this.length);\n return this;\n }\n\n};\n```", "response": "LayerInfo = require '../layer_info.coffee'\n\nmodule.exports = class UnicodeName extends LayerInfo\n @shouldParse: (key) -> key is 'luni'\n\n parse: ->\n pos = @file.tell()\n @data = @file.readUnicodeString()\n\n @file.seek pos + @length\n return @", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/unicode_name.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/unicode_name.coffee", "line_start": 1, "line_end": 11} {"id": "meltingice/psd.js:lib/psd/layer_info/unicode_name.coffee:1:completion", "type": "completion", "prompt": "LayerInfo = require '../layer_info.coffee'\n\nmodule.exports = class UnicodeName extends LayerInfo\n @shouldParse: (key) -> key is 'luni'", "response": "parse: ->\n pos = @file.tell()\n @data = @file.readUnicodeString()\n\n @file.seek pos + @length\n return @", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "meltingice/psd.js", "path": "lib/psd/layer_info/unicode_name.coffee", "license": "MIT", "commit": "7e8392d20fd5d66ad70ddda7309661b9a0ca67c8", "stars": 2846, "source_url": "https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/unicode_name.coffee", "line_start": 1, "line_end": 11} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "Authenticator = require '../../src/models/authenticator'\nJobManager = require 'meshblu-core-job-manager'\nasync = require 'async'\nredis = require 'fakeredis'\n_ = require 'lodash'\nuuid = require 'uuid'\n\ndescribe 'Authenticator', ->\n beforeEach ->\n @redis = redis.createClient uuid.v1()\n @redis = _.bindAll @redis\n\n beforeEach ->\n @uuid = v1: sinon.stub()\n @sut = new Authenticator {namespace: 'test', timeoutSeconds: 1, client: @redis}, uuid: @uuid\n @jobManager = new JobManager namespace: 'test', client: @redis\n\n describe '->authenticate', ->\n describe 'when redis replies with true', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'\n\n metadata =\n code: 200\n\n data =\n authenticated: true\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, data: data, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should no error', ->\n expect(@error).not.to.exist\n\n it 'should yield true', ->\n expect(@isAuthenticated).to.be.true\n\n it 'should have added a request reference to the request queue', (done) ->\n @redis.lindex 'test:request:queue', 0, (error, result) =>\n return done error if error?", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 1, "line_end": 42} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nAuthenticator = require '../../src/models/authenticator'\nJobManager = require 'meshblu-core-job-manager'\nasync = require 'async'\nredis = require 'fakeredis'\n_ = require 'lodash'\nuuid = require 'uuid'\n\ndescribe 'Authenticator', ->\n beforeEach ->\n @redis = redis.createClient uuid.v1()\n @redis = _.bindAll @redis\n\n beforeEach ->\n @uuid = v1: sinon.stub()\n @sut = new Authenticator {namespace: 'test', timeoutSeconds: 1, client: @redis}, uuid: @uuid\n @jobManager = new JobManager namespace: 'test', client: @redis\n\n describe '->authenticate', ->\n describe 'when redis replies with true', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'\n\n metadata =\n code: 200\n\n data =\n authenticated: true\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, data: data, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should no error', ->\n expect(@error).not.to.exist\n\n it 'should yield true', ->\n expect(@isAuthenticated).to.be.true\n\n it 'should have added a request reference to the request queue', (done) ->\n @redis.lindex 'test:request:queue', 0, (error, result) =>\n return done error if error?\n```", "response": "var Authenticator, JobManager, _, async, redis, uuid;\n\nAuthenticator = require('../../src/models/authenticator');\n\nJobManager = require('meshblu-core-job-manager');\n\nasync = require('async');\n\nredis = require('fakeredis');\n\n_ = require('lodash');\n\nuuid = require('uuid');\n\ndescribe('Authenticator', function() {\n beforeEach(function() {\n this.redis = redis.createClient(uuid.v1());\n return this.redis = _.bindAll(this.redis);\n });\n beforeEach(function() {\n this.uuid = {\n v1: sinon.stub()\n };\n this.sut = new Authenticator({\n namespace: 'test',\n timeoutSeconds: 1,\n client: this.redis\n }, {\n uuid: this.uuid\n });\n return this.jobManager = new JobManager({\n namespace: 'test',\n client: this.redis\n });\n });\n return describe('->authenticate', function() {\n return describe('when redis replies with true', function() {\n beforeEach(function(done) {\n var data, metadata;\n this.uuid.v1.returns('some-uuid');\n metadata = {\n code: 200\n };\n data = {\n authenticated: true\n };\n return this.jobManager.createResponse({\n responseId: 'some-uuid',\n metadata: metadata,\n data: data\n }, done);\n });\n beforeEach(function(done) {\n return this.sut.authenticate('uuid', 'token', (error1, isAuthenticated) => {\n this.error = error1;\n this.isAuthenticated = isAuthenticated;\n return done();\n });\n });\n it('should no error', function() {\n return expect(this.error).not.to.exist;\n });\n it('should yield true', function() {\n return expect(this.isAuthenticated).to.be.true;\n });\n return it('should have added a request reference to the request queue', function(done) {\n return this.redis.lindex('test:request:queue', 0, (error, result) => {\n if (error != null) {\n return done(error);\n }\n });\n });\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 1, "line_end": 42} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar Authenticator, JobManager, _, async, redis, uuid;\n\nAuthenticator = require('../../src/models/authenticator');\n\nJobManager = require('meshblu-core-job-manager');\n\nasync = require('async');\n\nredis = require('fakeredis');\n\n_ = require('lodash');\n\nuuid = require('uuid');\n\ndescribe('Authenticator', function() {\n beforeEach(function() {\n this.redis = redis.createClient(uuid.v1());\n return this.redis = _.bindAll(this.redis);\n });\n beforeEach(function() {\n this.uuid = {\n v1: sinon.stub()\n };\n this.sut = new Authenticator({\n namespace: 'test',\n timeoutSeconds: 1,\n client: this.redis\n }, {\n uuid: this.uuid\n });\n return this.jobManager = new JobManager({\n namespace: 'test',\n client: this.redis\n });\n });\n return describe('->authenticate', function() {\n return describe('when redis replies with true', function() {\n beforeEach(function(done) {\n var data, metadata;\n this.uuid.v1.returns('some-uuid');\n metadata = {\n code: 200\n };\n data = {\n authenticated: true\n };\n return this.jobManager.createResponse({\n responseId: 'some-uuid',\n metadata: metadata,\n data: data\n }, done);\n });\n beforeEach(function(done) {\n return this.sut.authenticate('uuid', 'token', (error1, isAuthenticated) => {\n this.error = error1;\n this.isAuthenticated = isAuthenticated;\n return done();\n });\n });\n it('should no error', function() {\n return expect(this.error).not.to.exist;\n });\n it('should yield true', function() {\n return expect(this.isAuthenticated).to.be.true;\n });\n return it('should have added a request reference to the request queue', function(done) {\n return this.redis.lindex('test:request:queue', 0, (error, result) => {\n if (error != null) {\n return done(error);\n }\n });\n });\n });\n });\n});\n```", "response": "Authenticator = require '../../src/models/authenticator'\nJobManager = require 'meshblu-core-job-manager'\nasync = require 'async'\nredis = require 'fakeredis'\n_ = require 'lodash'\nuuid = require 'uuid'\n\ndescribe 'Authenticator', ->\n beforeEach ->\n @redis = redis.createClient uuid.v1()\n @redis = _.bindAll @redis\n\n beforeEach ->\n @uuid = v1: sinon.stub()\n @sut = new Authenticator {namespace: 'test', timeoutSeconds: 1, client: @redis}, uuid: @uuid\n @jobManager = new JobManager namespace: 'test', client: @redis\n\n describe '->authenticate', ->\n describe 'when redis replies with true', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'\n\n metadata =\n code: 200\n\n data =\n authenticated: true\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, data: data, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should no error', ->\n expect(@error).not.to.exist\n\n it 'should yield true', ->\n expect(@isAuthenticated).to.be.true\n\n it 'should have added a request reference to the request queue', (done) ->\n @redis.lindex 'test:request:queue', 0, (error, result) =>\n return done error if error?", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 1, "line_end": 42} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:1:completion", "type": "completion", "prompt": "Authenticator = require '../../src/models/authenticator'\nJobManager = require 'meshblu-core-job-manager'\nasync = require 'async'\nredis = require 'fakeredis'\n_ = require 'lodash'\nuuid = require 'uuid'\n\ndescribe 'Authenticator', ->\n beforeEach ->\n @redis = redis.createClient uuid.v1()\n @redis = _.bindAll @redis\n\n beforeEach ->\n @uuid = v1: sinon.stub()\n @sut = new Authenticator {namespace: 'test', timeoutSeconds: 1, client: @redis}, uuid: @uuid\n @jobManager = new JobManager namespace: 'test', client: @redis\n\n describe '->authenticate', ->\n describe 'when redis replies with true', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'", "response": "metadata =\n code: 200\n\n data =\n authenticated: true\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, data: data, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should no error', ->\n expect(@error).not.to.exist\n\n it 'should yield true', ->\n expect(@isAuthenticated).to.be.true\n\n it 'should have added a request reference to the request queue', (done) ->\n @redis.lindex 'test:request:queue', 0, (error, result) =>\n return done error if error?", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 1, "line_end": 42} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "expect(result).to.deep.equal 'test:some-uuid'\n done()\n\n it 'should have added a request metadata to the request hash set', (done) ->\n @redis.hget 'test:some-uuid', 'request:metadata', (error, metadataStr) =>\n return done error if error?\n\n metadata = JSON.parse metadataStr\n\n expect(metadata).to.deep.equal\n auth:\n uuid: \"uuid\"\n token: \"token\"\n responseId: \"some-uuid\"\n jobType: \"authenticate\"\n\n done()\n\n describe 'when the auth worker replies with false', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-other-uuid'\n\n metadata =\n code: 200\n\n data =\n authenticated: false\n\n @jobManager.createResponse responseId: 'some-other-uuid', metadata: metadata, data: data, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should no error', ->\n expect(@error).not.to.exist\n\n it 'should yield false', ->\n expect(@isAuthenticated).to.be.false\n\n it 'should have added a job to the request queue', (done) ->\n @redis.lindex 'test:request:queue', 0, (error, requestKey) =>\n return done error if error?\n expect(requestKey).to.deep.equal 'test:some-other-uuid'\n done()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 44, "line_end": 87} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:2:completion", "type": "completion", "prompt": "expect(result).to.deep.equal 'test:some-uuid'\n done()\n\n it 'should have added a request metadata to the request hash set', (done) ->\n @redis.hget 'test:some-uuid', 'request:metadata', (error, metadataStr) =>\n return done error if error?\n\n metadata = JSON.parse metadataStr\n\n expect(metadata).to.deep.equal\n auth:\n uuid: \"uuid\"\n token: \"token\"\n responseId: \"some-uuid\"\n jobType: \"authenticate\"\n\n done()\n\n describe 'when the auth worker replies with false', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-other-uuid'", "response": "metadata =\n code: 200\n\n data =\n authenticated: false\n\n @jobManager.createResponse responseId: 'some-other-uuid', metadata: metadata, data: data, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should no error', ->\n expect(@error).not.to.exist\n\n it 'should yield false', ->\n expect(@isAuthenticated).to.be.false\n\n it 'should have added a job to the request queue', (done) ->\n @redis.lindex 'test:request:queue', 0, (error, requestKey) =>\n return done error if error?\n expect(requestKey).to.deep.equal 'test:some-other-uuid'\n done()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 44, "line_end": 87} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "it 'should have added a request metadata to the request hash set', (done) ->\n @redis.hget 'test:some-other-uuid', 'request:metadata', (error, metadataStr) =>\n return done error if error?\n\n metadata = JSON.parse metadataStr\n\n expect(metadata).to.deep.equal\n auth:\n uuid: \"uuid\"\n token: \"token\"\n responseId: \"some-other-uuid\"\n jobType: \"authenticate\"\n\n done()\n\n describe 'when the auth worker replies with an error', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'\n\n metadata =\n code: 500\n status: 'uh oh'\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@error.code).to.equal 500\n expect(@error.status).to.equal 'uh oh'\n expect(=> throw @error).to.throw '500: uh oh'\n\n describe 'when the auth worker never replies', ->\n beforeEach (done) ->\n @timeout 3000\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@isAuthenticated).not.to.exist\n expect(=> throw @error).to.throw 'No response from authenticate worker'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 89, "line_end": 129} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nit 'should have added a request metadata to the request hash set', (done) ->\n @redis.hget 'test:some-other-uuid', 'request:metadata', (error, metadataStr) =>\n return done error if error?\n\n metadata = JSON.parse metadataStr\n\n expect(metadata).to.deep.equal\n auth:\n uuid: \"uuid\"\n token: \"token\"\n responseId: \"some-other-uuid\"\n jobType: \"authenticate\"\n\n done()\n\n describe 'when the auth worker replies with an error', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'\n\n metadata =\n code: 500\n status: 'uh oh'\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@error.code).to.equal 500\n expect(@error.status).to.equal 'uh oh'\n expect(=> throw @error).to.throw '500: uh oh'\n\n describe 'when the auth worker never replies', ->\n beforeEach (done) ->\n @timeout 3000\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@isAuthenticated).not.to.exist\n expect(=> throw @error).to.throw 'No response from authenticate worker'\n```", "response": "it('should have added a request metadata to the request hash set', function(done) {\n return this.redis.hget('test:some-other-uuid', 'request:metadata', (error, metadataStr) => {\n var metadata;\n if (error != null) {\n return done(error);\n }\n metadata = JSON.parse(metadataStr);\n expect(metadata).to.deep.equal({\n auth: {\n uuid: \"uuid\",\n token: \"token\"\n },\n responseId: \"some-other-uuid\",\n jobType: \"authenticate\"\n });\n return done();\n });\n});\n\ndescribe('when the auth worker replies with an error', function() {\n beforeEach(function(done) {\n var metadata;\n this.uuid.v1.returns('some-uuid');\n metadata = {\n code: 500,\n status: 'uh oh'\n };\n return this.jobManager.createResponse({\n responseId: 'some-uuid',\n metadata: metadata\n }, done);\n });\n beforeEach(function(done) {\n return this.sut.authenticate('uuid', 'token', (error1, isAuthenticated) => {\n this.error = error1;\n this.isAuthenticated = isAuthenticated;\n return done();\n });\n });\n return it('should error', function() {\n expect(this.error.code).to.equal(500);\n expect(this.error.status).to.equal('uh oh');\n return expect(() => {\n throw this.error;\n }).to.throw('500: uh oh');\n });\n});\n\ndescribe('when the auth worker never replies', function() {\n beforeEach(function(done) {\n this.timeout(3000);\n return this.sut.authenticate('uuid', 'token', (error1, isAuthenticated) => {\n this.error = error1;\n this.isAuthenticated = isAuthenticated;\n return done();\n });\n });\n return it('should error', function() {\n expect(this.isAuthenticated).not.to.exist;\n return expect(() => {\n throw this.error;\n }).to.throw('No response from authenticate worker');\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 89, "line_end": 129} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nit('should have added a request metadata to the request hash set', function(done) {\n return this.redis.hget('test:some-other-uuid', 'request:metadata', (error, metadataStr) => {\n var metadata;\n if (error != null) {\n return done(error);\n }\n metadata = JSON.parse(metadataStr);\n expect(metadata).to.deep.equal({\n auth: {\n uuid: \"uuid\",\n token: \"token\"\n },\n responseId: \"some-other-uuid\",\n jobType: \"authenticate\"\n });\n return done();\n });\n});\n\ndescribe('when the auth worker replies with an error', function() {\n beforeEach(function(done) {\n var metadata;\n this.uuid.v1.returns('some-uuid');\n metadata = {\n code: 500,\n status: 'uh oh'\n };\n return this.jobManager.createResponse({\n responseId: 'some-uuid',\n metadata: metadata\n }, done);\n });\n beforeEach(function(done) {\n return this.sut.authenticate('uuid', 'token', (error1, isAuthenticated) => {\n this.error = error1;\n this.isAuthenticated = isAuthenticated;\n return done();\n });\n });\n return it('should error', function() {\n expect(this.error.code).to.equal(500);\n expect(this.error.status).to.equal('uh oh');\n return expect(() => {\n throw this.error;\n }).to.throw('500: uh oh');\n });\n});\n\ndescribe('when the auth worker never replies', function() {\n beforeEach(function(done) {\n this.timeout(3000);\n return this.sut.authenticate('uuid', 'token', (error1, isAuthenticated) => {\n this.error = error1;\n this.isAuthenticated = isAuthenticated;\n return done();\n });\n });\n return it('should error', function() {\n expect(this.isAuthenticated).not.to.exist;\n return expect(() => {\n throw this.error;\n }).to.throw('No response from authenticate worker');\n });\n});\n```", "response": "it 'should have added a request metadata to the request hash set', (done) ->\n @redis.hget 'test:some-other-uuid', 'request:metadata', (error, metadataStr) =>\n return done error if error?\n\n metadata = JSON.parse metadataStr\n\n expect(metadata).to.deep.equal\n auth:\n uuid: \"uuid\"\n token: \"token\"\n responseId: \"some-other-uuid\"\n jobType: \"authenticate\"\n\n done()\n\n describe 'when the auth worker replies with an error', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'\n\n metadata =\n code: 500\n status: 'uh oh'\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@error.code).to.equal 500\n expect(@error.status).to.equal 'uh oh'\n expect(=> throw @error).to.throw '500: uh oh'\n\n describe 'when the auth worker never replies', ->\n beforeEach (done) ->\n @timeout 3000\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@isAuthenticated).not.to.exist\n expect(=> throw @error).to.throw 'No response from authenticate worker'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 89, "line_end": 129} {"id": "octoblu/meshblu:test/models/authenticator-spec.coffee:3:completion", "type": "completion", "prompt": "it 'should have added a request metadata to the request hash set', (done) ->\n @redis.hget 'test:some-other-uuid', 'request:metadata', (error, metadataStr) =>\n return done error if error?\n\n metadata = JSON.parse metadataStr\n\n expect(metadata).to.deep.equal\n auth:\n uuid: \"uuid\"\n token: \"token\"\n responseId: \"some-other-uuid\"\n jobType: \"authenticate\"\n\n done()\n\n describe 'when the auth worker replies with an error', ->\n beforeEach (done) ->\n @uuid.v1.returns 'some-uuid'\n\n metadata =", "response": "code: 500\n status: 'uh oh'\n\n @jobManager.createResponse responseId: 'some-uuid', metadata: metadata, done\n\n beforeEach (done) ->\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@error.code).to.equal 500\n expect(@error.status).to.equal 'uh oh'\n expect(=> throw @error).to.throw '500: uh oh'\n\n describe 'when the auth worker never replies', ->\n beforeEach (done) ->\n @timeout 3000\n @sut.authenticate 'uuid', 'token', (@error, @isAuthenticated) => done()\n\n it 'should error', ->\n expect(@isAuthenticated).not.to.exist\n expect(=> throw @error).to.throw 'No response from authenticate worker'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "octoblu/meshblu", "path": "test/models/authenticator-spec.coffee", "license": "MIT", "commit": "12672e10627e690e2e56bba865f71c38b8a90f25", "stars": 815, "source_url": "https://github.com/octoblu/meshblu/blob/12672e10627e690e2e56bba865f71c38b8a90f25/test/models/authenticator-spec.coffee", "line_start": 89, "line_end": 129} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\" or\n err.stack is \"Error: ENOENT: no such file or directory, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 1, "line_end": 41} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nlongjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\" or\n err.stack is \"Error: ENOENT: no such file or directory, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2\n```", "response": "var assert, longjohn;\n\nlongjohn = require('../lib/longjohn');\n\nassert = require('assert');\n\ndescribe('longjohn', function() {\n it('should work with normal throw', function() {\n return assert.throws(function() {\n throw new Error('foo');\n });\n });\n it('should work with errors from other modules', function(done) {\n var fs;\n fs = require('fs');\n return fs.readFile('not_there.txt', 'utf8', function(err, text) {\n if ((err != null) && err instanceof Error && (err.stack === \"Error: ENOENT, open 'not_there.txt'\" || err.stack === \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\" || err.stack === \"Error: ENOENT: no such file or directory, open 'not_there.txt'\\n at Error (native)\")) {\n return done();\n }\n return assert.fail();\n });\n });\n it('should track frames across setTimeout', function(done) {\n return setTimeout(function() {\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }, 1);\n });\n it('should work for issue #10', function(done) {\n var a, b;\n a = function() {\n return b();\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n return done();\n };\n return setTimeout(a, 0);\n });\n it('should work for issue #10-2', function(done) {\n var a, b;\n a = function() {\n return setTimeout(b, 0);\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3);\n return done();\n };\n return setTimeout(a, 0);\n });\n return it('should allow stack size limiting', function(done) {\n return longjohn.async_trace_limit = 2;\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 1, "line_end": 41} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar assert, longjohn;\n\nlongjohn = require('../lib/longjohn');\n\nassert = require('assert');\n\ndescribe('longjohn', function() {\n it('should work with normal throw', function() {\n return assert.throws(function() {\n throw new Error('foo');\n });\n });\n it('should work with errors from other modules', function(done) {\n var fs;\n fs = require('fs');\n return fs.readFile('not_there.txt', 'utf8', function(err, text) {\n if ((err != null) && err instanceof Error && (err.stack === \"Error: ENOENT, open 'not_there.txt'\" || err.stack === \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\" || err.stack === \"Error: ENOENT: no such file or directory, open 'not_there.txt'\\n at Error (native)\")) {\n return done();\n }\n return assert.fail();\n });\n });\n it('should track frames across setTimeout', function(done) {\n return setTimeout(function() {\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }, 1);\n });\n it('should work for issue #10', function(done) {\n var a, b;\n a = function() {\n return b();\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n return done();\n };\n return setTimeout(a, 0);\n });\n it('should work for issue #10-2', function(done) {\n var a, b;\n a = function() {\n return setTimeout(b, 0);\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3);\n return done();\n };\n return setTimeout(a, 0);\n });\n return it('should allow stack size limiting', function(done) {\n return longjohn.async_trace_limit = 2;\n });\n});\n```", "response": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\" or\n err.stack is \"Error: ENOENT: no such file or directory, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 1, "line_end": 41} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:completion", "type": "completion", "prompt": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\" or\n err.stack is \"Error: ENOENT: no such file or directory, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)", "response": "done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 1, "line_end": 41} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)\n\n foo()\n\n it 'should work with on/emit', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 3)\n\n it 'should work with on/removeListener', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 43, "line_end": 81} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:2:completion", "type": "completion", "prompt": "counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)\n\n foo()\n\n it 'should work with on/emit', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)", "response": "emitter.on('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 3)\n\n it 'should work with on/removeListener', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 43, "line_end": 81} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "assert.equal(count, 1)\n\n it 'should work with on/removeAllListeners (issue #32)', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('removeListener', foo)\n emitter.on('dummy', foo)\n\n emitter.removeAllListeners('dummy')\n\n assert.equal(count, 1)\n\n it 'should work with once/emit', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.once('foo', foo)\n\n emitter.emit('foo')\n emitter.emit('foo')\n emitter.emit('foo')\n\n assert.equal(count, 1)\n\n it 'should work with once/removeListener', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 83, "line_end": 122} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:completion", "type": "completion", "prompt": "assert.equal(count, 1)\n\n it 'should work with on/removeAllListeners (issue #32)', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('removeListener', foo)\n emitter.on('dummy', foo)\n\n emitter.removeAllListeners('dummy')\n\n assert.equal(count, 1)\n\n it 'should work with once/emit', ->\n {EventEmitter} = require 'events'", "response": "count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.once('foo', foo)\n\n emitter.emit('foo')\n emitter.emit('foo')\n emitter.emit('foo')\n\n assert.equal(count, 1)\n\n it 'should work with once/removeListener', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 83, "line_end": 122} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "emitter.once('foo', foo)\n emitter.once('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')\n emitter.emit('foo')\n assert.equal(count, 1)\n\n it 'should work with once/removeAllListeners', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.once('removeListener', foo)\n\n emitter.on('dummy', foo)\n emitter.removeAllListeners('dummy')\n emitter.on('dummy', foo)\n emitter.removeAllListeners('dummy')\n\n assert.equal(count, 1)\n\n\n it 'should work with setTimeout', (done) ->\n setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3\n\n it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 124, "line_end": 162} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:4:completion", "type": "completion", "prompt": "emitter.once('foo', foo)\n emitter.once('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')\n emitter.emit('foo')\n assert.equal(count, 1)\n\n it 'should work with once/removeAllListeners', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.once('removeListener', foo)", "response": "emitter.on('dummy', foo)\n emitter.removeAllListeners('dummy')\n emitter.on('dummy', foo)\n emitter.removeAllListeners('dummy')\n\n assert.equal(count, 1)\n\n\n it 'should work with setTimeout', (done) ->\n setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3\n\n it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 124, "line_end": 162} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3\n\n it 'once should call overriden on', (done) ->\n Transform = require('stream').Transform\n\n emitter = new Transform()\n\n emitter.once('data', () -> )\n emitter.once('end', done)\n\n emitter.push(null)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 164, "line_end": 180} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3\n\n it 'once should call overriden on', (done) ->\n Transform = require('stream').Transform\n\n emitter = new Transform()\n\n emitter.once('data', () -> )\n emitter.once('end', done)\n\n emitter.push(null)\n```", "response": "if (typeof setImmediate !== \"undefined\" && setImmediate !== null) {\n it('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n });\n}\n\nit('once should call overriden on', function(done) {\n var Transform, emitter;\n Transform = require('stream').Transform;\n emitter = new Transform();\n emitter.once('data', function() {});\n emitter.once('end', done);\n return emitter.push(null);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 164, "line_end": 180} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (typeof setImmediate !== \"undefined\" && setImmediate !== null) {\n it('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n });\n}\n\nit('once should call overriden on', function(done) {\n var Transform, emitter;\n Transform = require('stream').Transform;\n emitter = new Transform();\n emitter.once('data', function() {});\n emitter.once('end', done);\n return emitter.push(null);\n});\n```", "response": "if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3\n\n it 'once should call overriden on', (done) ->\n Transform = require('stream').Transform\n\n emitter = new Transform()\n\n emitter.once('data', () -> )\n emitter.once('end', done)\n\n emitter.push(null)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 164, "line_end": 180} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:completion", "type": "completion", "prompt": "if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "response": "it 'once should call overriden on', (done) ->\n Transform = require('stream').Transform\n\n emitter = new Transform()\n\n emitter.once('data', () -> )\n emitter.once('end', done)\n\n emitter.push(null)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5c7a47963cd042253fff578cbb2d26555870f48c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5c7a47963cd042253fff578cbb2d26555870f48c/test/test-longjohn.coffee", "line_start": 164, "line_end": 180} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "958d1af76d99d9e30394b316af7e58c058f3a541", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/958d1af76d99d9e30394b316af7e58c058f3a541/test/test-longjohn.coffee", "line_start": 164, "line_end": 170} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nif setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3\n```", "response": "if (typeof setImmediate !== \"undefined\" && setImmediate !== null) {\n it('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n });\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "958d1af76d99d9e30394b316af7e58c058f3a541", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/958d1af76d99d9e30394b316af7e58c058f3a541/test/test-longjohn.coffee", "line_start": 164, "line_end": 170} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nif (typeof setImmediate !== \"undefined\" && setImmediate !== null) {\n it('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n });\n}\n```", "response": "if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "958d1af76d99d9e30394b316af7e58c058f3a541", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/958d1af76d99d9e30394b316af7e58c058f3a541/test/test-longjohn.coffee", "line_start": 164, "line_end": 170} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:5:completion", "type": "completion", "prompt": "if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->", "response": "assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "958d1af76d99d9e30394b316af7e58c058f3a541", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/958d1af76d99d9e30394b316af7e58c058f3a541/test/test-longjohn.coffee", "line_start": 164, "line_end": 170} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "2b708a7675b7bac6e553b4146f4bf9555875735c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/2b708a7675b7bac6e553b4146f4bf9555875735c/test/test-longjohn.coffee", "line_start": 1, "line_end": 40} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nlongjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2\n```", "response": "var assert, longjohn;\n\nlongjohn = require('../lib/longjohn');\n\nassert = require('assert');\n\ndescribe('longjohn', function() {\n it('should work with normal throw', function() {\n return assert.throws(function() {\n throw new Error('foo');\n });\n });\n it('should work with errors from other modules', function(done) {\n var fs;\n fs = require('fs');\n return fs.readFile('not_there.txt', 'utf8', function(err, text) {\n if ((err != null) && err instanceof Error && (err.stack === \"Error: ENOENT, open 'not_there.txt'\" || err.stack === \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\")) {\n return done();\n }\n return assert.fail();\n });\n });\n it('should track frames across setTimeout', function(done) {\n return setTimeout(function() {\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }, 1);\n });\n it('should work for issue #10', function(done) {\n var a, b;\n a = function() {\n return b();\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n return done();\n };\n return setTimeout(a, 0);\n });\n it('should work for issue #10-2', function(done) {\n var a, b;\n a = function() {\n return setTimeout(b, 0);\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3);\n return done();\n };\n return setTimeout(a, 0);\n });\n return it('should allow stack size limiting', function(done) {\n return longjohn.async_trace_limit = 2;\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "2b708a7675b7bac6e553b4146f4bf9555875735c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/2b708a7675b7bac6e553b4146f4bf9555875735c/test/test-longjohn.coffee", "line_start": 1, "line_end": 40} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar assert, longjohn;\n\nlongjohn = require('../lib/longjohn');\n\nassert = require('assert');\n\ndescribe('longjohn', function() {\n it('should work with normal throw', function() {\n return assert.throws(function() {\n throw new Error('foo');\n });\n });\n it('should work with errors from other modules', function(done) {\n var fs;\n fs = require('fs');\n return fs.readFile('not_there.txt', 'utf8', function(err, text) {\n if ((err != null) && err instanceof Error && (err.stack === \"Error: ENOENT, open 'not_there.txt'\" || err.stack === \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\")) {\n return done();\n }\n return assert.fail();\n });\n });\n it('should track frames across setTimeout', function(done) {\n return setTimeout(function() {\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }, 1);\n });\n it('should work for issue #10', function(done) {\n var a, b;\n a = function() {\n return b();\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n return done();\n };\n return setTimeout(a, 0);\n });\n it('should work for issue #10-2', function(done) {\n var a, b;\n a = function() {\n return setTimeout(b, 0);\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3);\n return done();\n };\n return setTimeout(a, 0);\n });\n return it('should allow stack size limiting', function(done) {\n return longjohn.async_trace_limit = 2;\n });\n});\n```", "response": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "2b708a7675b7bac6e553b4146f4bf9555875735c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/2b708a7675b7bac6e553b4146f4bf9555875735c/test/test-longjohn.coffee", "line_start": 1, "line_end": 40} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:completion", "type": "completion", "prompt": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and\n (err.stack is \"Error: ENOENT, open 'not_there.txt'\" or\n err.stack is \"Error: ENOENT, open 'not_there.txt'\\n at Error (native)\")\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()", "response": ", 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "2b708a7675b7bac6e553b4146f4bf9555875735c", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/2b708a7675b7bac6e553b4146f4bf9555875735c/test/test-longjohn.coffee", "line_start": 1, "line_end": 40} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)\n\n foo()\n\n it 'should work with on/emit', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 3)\n\n it 'should work with removeListener', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "a9ebaaf90290635028ce0ea481f568e6193178d4", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/a9ebaaf90290635028ce0ea481f568e6193178d4/test/test-longjohn.coffee", "line_start": 42, "line_end": 80} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:2:completion", "type": "completion", "prompt": "counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)\n\n foo()\n\n it 'should work with on/emit', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)", "response": "emitter.on('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 3)\n\n it 'should work with removeListener', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "a9ebaaf90290635028ce0ea481f568e6193178d4", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/a9ebaaf90290635028ce0ea481f568e6193178d4/test/test-longjohn.coffee", "line_start": 42, "line_end": 80} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "assert.equal(count, 1)\n\n it 'should work with removeAllListeners (issue #32)', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('removeListener', foo)\n emitter.on('dummy', foo)\n\n emitter.removeAllListeners('dummy', foo)\n\n assert.equal(count, 1)\n\n it 'should work with setTimeout', (done) ->\n setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3\n\n it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "a9ebaaf90290635028ce0ea481f568e6193178d4", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/a9ebaaf90290635028ce0ea481f568e6193178d4/test/test-longjohn.coffee", "line_start": 82, "line_end": 118} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:completion", "type": "completion", "prompt": "assert.equal(count, 1)\n\n it 'should work with removeAllListeners (issue #32)', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('removeListener', foo)\n emitter.on('dummy', foo)\n\n emitter.removeAllListeners('dummy', foo)\n\n assert.equal(count, 1)\n\n it 'should work with setTimeout', (done) ->", "response": "setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3\n\n it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "a9ebaaf90290635028ce0ea481f568e6193178d4", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/a9ebaaf90290635028ce0ea481f568e6193178d4/test/test-longjohn.coffee", "line_start": 82, "line_end": 118} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "assert.equal(count, 1)\n\n it 'should work with setTimeout', (done) ->\n setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3\n\n it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "2c5099da98410fd052df0e9140280a40616257a2", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/2c5099da98410fd052df0e9140280a40616257a2/test/test-longjohn.coffee", "line_start": 82, "line_end": 103} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:completion", "type": "completion", "prompt": "assert.equal(count, 1)\n\n it 'should work with setTimeout', (done) ->\n setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3\n\n it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])", "response": "clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "2c5099da98410fd052df0e9140280a40616257a2", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/2c5099da98410fd052df0e9140280a40616257a2/test/test-longjohn.coffee", "line_start": 82, "line_end": 103} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and err.stack is \"Error: ENOENT, open 'not_there.txt'\"\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2\n\n counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 1, "line_end": 45} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nlongjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and err.stack is \"Error: ENOENT, open 'not_there.txt'\"\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2\n\n counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)\n```", "response": "var assert, longjohn;\n\nlongjohn = require('../lib/longjohn');\n\nassert = require('assert');\n\ndescribe('longjohn', function() {\n it('should work with normal throw', function() {\n return assert.throws(function() {\n throw new Error('foo');\n });\n });\n it('should work with errors from other modules', function(done) {\n var fs;\n fs = require('fs');\n return fs.readFile('not_there.txt', 'utf8', function(err, text) {\n if ((err != null) && err instanceof Error && err.stack === \"Error: ENOENT, open 'not_there.txt'\") {\n return done();\n }\n return assert.fail();\n });\n });\n it('should track frames across setTimeout', function(done) {\n return setTimeout(function() {\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }, 1);\n });\n it('should work for issue #10', function(done) {\n var a, b;\n a = function() {\n return b();\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n return done();\n };\n return setTimeout(a, 0);\n });\n it('should work for issue #10-2', function(done) {\n var a, b;\n a = function() {\n return setTimeout(b, 0);\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3);\n return done();\n };\n return setTimeout(a, 0);\n });\n return it('should allow stack size limiting', function(done) {\n var counter, foo;\n longjohn.async_trace_limit = 2;\n counter = 0;\n return foo = function() {\n if (++counter > 3) {\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }\n return setTimeout(foo, 1);\n };\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 1, "line_end": 45} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar assert, longjohn;\n\nlongjohn = require('../lib/longjohn');\n\nassert = require('assert');\n\ndescribe('longjohn', function() {\n it('should work with normal throw', function() {\n return assert.throws(function() {\n throw new Error('foo');\n });\n });\n it('should work with errors from other modules', function(done) {\n var fs;\n fs = require('fs');\n return fs.readFile('not_there.txt', 'utf8', function(err, text) {\n if ((err != null) && err instanceof Error && err.stack === \"Error: ENOENT, open 'not_there.txt'\") {\n return done();\n }\n return assert.fail();\n });\n });\n it('should track frames across setTimeout', function(done) {\n return setTimeout(function() {\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }, 1);\n });\n it('should work for issue #10', function(done) {\n var a, b;\n a = function() {\n return b();\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n return done();\n };\n return setTimeout(a, 0);\n });\n it('should work for issue #10-2', function(done) {\n var a, b;\n a = function() {\n return setTimeout(b, 0);\n };\n b = function() {\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3);\n return done();\n };\n return setTimeout(a, 0);\n });\n return it('should allow stack size limiting', function(done) {\n var counter, foo;\n longjohn.async_trace_limit = 2;\n counter = 0;\n return foo = function() {\n if (++counter > 3) {\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2);\n return done();\n }\n return setTimeout(foo, 1);\n };\n });\n});\n```", "response": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and err.stack is \"Error: ENOENT, open 'not_there.txt'\"\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2\n\n counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 1, "line_end": 45} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:1:completion", "type": "completion", "prompt": "longjohn = require '../lib/longjohn'\nassert = require 'assert'\n\ndescribe 'longjohn', ->\n it 'should work with normal throw', ->\n assert.throws -> throw new Error('foo')\n\n it 'should work with errors from other modules', (done) ->\n fs = require('fs')\n\n fs.readFile 'not_there.txt', 'utf8', (err, text) ->\n return done() if err? and err instanceof Error and err.stack is \"Error: ENOENT, open 'not_there.txt'\"\n assert.fail()\n\n it 'should track frames across setTimeout', (done) ->\n setTimeout ->\n assert.equal(new Error('foobar').stack.split(longjohn.empty_frame).length, 2)\n done()\n , 1\n\n it 'should work for issue #10', (done) ->\n a = -> b()", "response": "b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);\n done()\n\n setTimeout(a, 0)\n\n it 'should work for issue #10-2', (done) ->\n a = -> setTimeout(b, 0)\n b = ->\n assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3)\n done()\n\n setTimeout(a, 0)\n\n it 'should allow stack size limiting', (done) ->\n longjohn.async_trace_limit = 2\n\n counter = 0\n foo = ->\n if ++counter > 3\n assert.equal(new Error('foo').stack.split(longjohn.empty_frame).length, 2)\n return done()\n setTimeout(foo, 1)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 1, "line_end": 45} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "foo()\n\n it 'should work with on/emit', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 3)\n\n it 'should work with removeListener', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 1)\n\n it 'should work with setTimeout', (done) ->\n setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 47, "line_end": 86} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:2:completion", "type": "completion", "prompt": "foo()\n\n it 'should work with on/emit', ->\n {EventEmitter} = require 'events'\n\n count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 3)\n\n it 'should work with removeListener', ->\n {EventEmitter} = require 'events'", "response": "count = 0\n foo = -> ++count\n\n emitter = new EventEmitter()\n\n emitter.on('foo', foo)\n emitter.on('foo', foo)\n\n emitter.removeListener('foo', foo)\n\n emitter.emit('foo')\n\n assert.equal(count, 1)\n\n it 'should work with setTimeout', (done) ->\n setTimeout ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n done()\n , 1, 1, 2, 3", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 47, "line_end": 86} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 88, "line_end": 101} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nit 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3\n```", "response": "it('should work with setInterval', function(done) {\n var interval_id;\n return interval_id = setInterval(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearInterval(interval_id);\n return done();\n }, 1, 1, 2, 3);\n});\n\nif (typeof setImmediate !== \"undefined\" && setImmediate !== null) {\n it('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n });\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 88, "line_end": 101} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nit('should work with setInterval', function(done) {\n var interval_id;\n return interval_id = setInterval(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearInterval(interval_id);\n return done();\n }, 1, 1, 2, 3);\n});\n\nif (typeof setImmediate !== \"undefined\" && setImmediate !== null) {\n it('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n });\n}\n```", "response": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 88, "line_end": 101} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:completion", "type": "completion", "prompt": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3", "response": "if setImmediate?\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "5f151d7661874def1979fb68f5bebaec0985fa02", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/5f151d7661874def1979fb68f5bebaec0985fa02/test/test-longjohn.coffee", "line_start": 88, "line_end": 101} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7/test/test-longjohn.coffee", "line_start": 88, "line_end": 100} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nit 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3\n```", "response": "it('should work with setInterval', function(done) {\n var interval_id;\n return interval_id = setInterval(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearInterval(interval_id);\n return done();\n }, 1, 1, 2, 3);\n});\n\nit('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7/test/test-longjohn.coffee", "line_start": 88, "line_end": 100} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nit('should work with setInterval', function(done) {\n var interval_id;\n return interval_id = setInterval(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearInterval(interval_id);\n return done();\n }, 1, 1, 2, 3);\n});\n\nit('should work with setImmediate', function(done) {\n var immediate_id;\n return immediate_id = setImmediate(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearImmediate(immediate_id);\n return done();\n }, 1, 2, 3);\n});\n```", "response": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n\n it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7/test/test-longjohn.coffee", "line_start": 88, "line_end": 100} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:completion", "type": "completion", "prompt": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3", "response": "it 'should work with setImmediate', (done) ->\n immediate_id = setImmediate ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearImmediate(immediate_id)\n done()\n , 1, 2, 3", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/f7e01faf8feaba8c644fba4d7fb2880acdc8ffd7/test/test-longjohn.coffee", "line_start": 88, "line_end": 100} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3", "source_lang": "", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "4648d8df3081673ac039da001363831dc67b86d8", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/4648d8df3081673ac039da001363831dc67b86d8/test/test-longjohn.coffee", "line_start": 88, "line_end": 93} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nit 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3\n```", "response": "it('should work with setInterval', function(done) {\n var interval_id;\n return interval_id = setInterval(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearInterval(interval_id);\n return done();\n }, 1, 1, 2, 3);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "4648d8df3081673ac039da001363831dc67b86d8", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/4648d8df3081673ac039da001363831dc67b86d8/test/test-longjohn.coffee", "line_start": 88, "line_end": 93} {"id": "mattinsler/longjohn:test/test-longjohn.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nit('should work with setInterval', function(done) {\n var interval_id;\n return interval_id = setInterval(function() {\n assert.deepEqual(Array.prototype.slice.call(arguments), [1, 2, 3]);\n clearInterval(interval_id);\n return done();\n }, 1, 1, 2, 3);\n});\n```", "response": "it 'should work with setInterval', (done) ->\n interval_id = setInterval ->\n assert.deepEqual(Array::slice.call(arguments), [1, 2, 3])\n clearInterval(interval_id)\n done()\n , 1, 1, 2, 3", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "mattinsler/longjohn", "path": "test/test-longjohn.coffee", "license": "MIT", "commit": "4648d8df3081673ac039da001363831dc67b86d8", "stars": 841, "source_url": "https://github.com/mattinsler/longjohn/blob/4648d8df3081673ac039da001363831dc67b86d8/test/test-longjohn.coffee", "line_start": 88, "line_end": 93} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if typeof value != \"undefined\"\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "26d3a70df2c3b701780acdcf2af187dd745cfc0b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/26d3a70df2c3b701780acdcf2af187dd745cfc0b/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if typeof value != \"undefined\"\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n```", "response": "(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (typeof value !== \"undefined\") {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.css = function(property, value) {\n return this.style(property, value);\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "26d3a70df2c3b701780acdcf2af187dd745cfc0b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/26d3a70df2c3b701780acdcf2af187dd745cfc0b/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (typeof value !== \"undefined\") {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.css = function(property, value) {\n return this.style(property, value);\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if typeof value != \"undefined\"\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "26d3a70df2c3b701780acdcf2af187dd745cfc0b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/26d3a70df2c3b701780acdcf2af187dd745cfc0b/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else", "response": "@className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if typeof value != \"undefined\"\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "26d3a70df2c3b701780acdcf2af187dd745cfc0b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/26d3a70df2c3b701780acdcf2af187dd745cfc0b/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n this.length > 0 and _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else if this.length > 0\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "103e44d838b3d453a3750b314a3bf787472a55eb", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/103e44d838b3d453a3750b314a3bf787472a55eb/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n this.length > 0 and _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else if this.length > 0\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n```", "response": "(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return this.length > 0 && _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (value) {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else if (this.length > 0) {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.css = function(property, value) {\n return this.style(property, value);\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "103e44d838b3d453a3750b314a3bf787472a55eb", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/103e44d838b3d453a3750b314a3bf787472a55eb/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return this.length > 0 && _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (value) {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else if (this.length > 0) {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.css = function(property, value) {\n return this.style(property, value);\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n this.length > 0 and _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else if this.length > 0\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "103e44d838b3d453a3750b314a3bf787472a55eb", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/103e44d838b3d453a3750b314a3bf787472a55eb/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else", "response": "@className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n this.length > 0 and _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else if this.length > 0\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "103e44d838b3d453a3750b314a3bf787472a55eb", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/103e44d838b3d453a3750b314a3bf787472a55eb/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "8860e62800b09b2a30f9d7f4c08de5bb0212bad8", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/8860e62800b09b2a30f9d7f4c08de5bb0212bad8/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n```", "response": "(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (value) {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.css = function(property, value) {\n return this.style(property, value);\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "8860e62800b09b2a30f9d7f4c08de5bb0212bad8", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/8860e62800b09b2a30f9d7f4c08de5bb0212bad8/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (value) {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.css = function(property, value) {\n return this.style(property, value);\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "8860e62800b09b2a30f9d7f4c08de5bb0212bad8", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/8860e62800b09b2a30f9d7f4c08de5bb0212bad8/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else", "response": "@className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.css = (property, value) -> @style property, value\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "8860e62800b09b2a30f9d7f4c08de5bb0212bad8", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/8860e62800b09b2a30f9d7f4c08de5bb0212bad8/src/quo.style.coffee", "line_start": 1, "line_end": 45} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7233988cec24392d354c84687e914d52869251dc", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7233988cec24392d354c84687e914d52869251dc/src/quo.style.coffee", "line_start": 1, "line_end": 43} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n```", "response": "(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (value) {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7233988cec24392d354c84687e914d52869251dc", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7233988cec24392d354c84687e914d52869251dc/src/quo.style.coffee", "line_start": 1, "line_end": 43} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var VENDORS, _computedStyle, _existsClass;\n VENDORS = [\"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\"];\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (value) {\n return this.each(function() {\n return this.style[property] = value;\n });\n } else {\n return this[0].style[property] || _computedStyle(this[0], property);\n }\n };\n $$.fn.vendor = function(property, value) {\n var i, len, results, vendor;\n results = [];\n for (i = 0, len = VENDORS.length; i < len; i++) {\n vendor = VENDORS[i];\n results.push(this.style(`${vendor}${property}`, value));\n }\n return results;\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7233988cec24392d354c84687e914d52869251dc", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7233988cec24392d354c84687e914d52869251dc/src/quo.style.coffee", "line_start": 1, "line_end": 43} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n VENDORS = [ \"-webkit-\", \"-moz-\", \"-ms-\", \"-o-\", \"\" ]\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")", "response": "else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n if value\n @each -> @style[property] = value\n else\n this[0].style[property] or _computedStyle(this[0], property)\n\n $$.fn.vendor = (property, value) ->\n @style(\"#{vendor}#{property}\", value) for vendor in VENDORS\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7233988cec24392d354c84687e914d52869251dc", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7233988cec24392d354c84687e914d52869251dc/src/quo.style.coffee", "line_start": 1, "line_end": 43} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "do ($$ = Quo) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.style.coffee", "line_start": 1, "line_end": 37} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndo ($$ = Quo) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n```", "response": "(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.style.coffee", "line_start": 1, "line_end": 37} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n return _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "do ($$ = Quo) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.style.coffee", "line_start": 1, "line_end": 37} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "do ($$ = Quo) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)", "response": "@className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "16ffe8834cfcfd1fac35a01223a91bdc7eaadd33", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.style.coffee", "line_start": 1, "line_end": 37} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo\n```", "response": "/*\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "###\n QuoJS\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->", "response": "if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "3742ee4605295dc1823773b55a3ab9f34cdd021a", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo\n```", "response": "/*\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "###\n QuoJS 2.2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->", "response": "if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "e640f494375e859b542ad25aaa2b6f7682ab941b", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/e640f494375e859b542ad25aaa2b6f7682ab941b/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo\n```", "response": "/*\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "###\n QuoJS 2.1\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->", "response": "if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "27a6117dbd521ad5d555abf20e120556c6000301", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\n QuoJS 2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7e5225294024e93c4226d70bce6d7f8056d68e61", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7e5225294024e93c4226d70bce6d7f8056d68e61/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\n QuoJS 2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo\n```", "response": "/*\n QuoJS 2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7e5225294024e93c4226d70bce6d7f8056d68e61", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7e5225294024e93c4226d70bce6d7f8056d68e61/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\n QuoJS 2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n*/\n(function($$) {\n var _computedStyle, _existsClass;\n $$.fn.addClass = function(name) {\n return this.each(function() {\n if (!_existsClass(name, this.className)) {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.removeClass = function(name) {\n return this.each(function() {\n if (!name) {\n return this.className = \"\";\n } else {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \").replace(/\\s+/g, \" \").trim();\n }\n }\n });\n };\n $$.fn.toggleClass = function(name) {\n return this.each(function() {\n if (_existsClass(name, this.className)) {\n return this.className = this.className.replace(name, \" \");\n } else {\n this.className += \" \" + name;\n return this.className = this.className.trim();\n }\n });\n };\n $$.fn.hasClass = function(name) {\n return _existsClass(name, this[0].className);\n };\n $$.fn.style = function(property, value) {\n if (!value) {\n return this[0].style[property] || _computedStyle(this[0], property);\n } else {\n return this.each(function() {\n return this.style[property] = value;\n });\n }\n };\n _existsClass = function(name, className) {\n var classes;\n classes = className.split(/\\s+/g);\n return classes.indexOf(name) >= 0;\n };\n _computedStyle = function(element, property) {\n return document.defaultView.getComputedStyle(element, \"\")[property];\n };\n})(Quo);\n```", "response": "###\n QuoJS 2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->\n if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7e5225294024e93c4226d70bce6d7f8056d68e61", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7e5225294024e93c4226d70bce6d7f8056d68e61/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "soyjavi/QuoJS:src/quo.style.coffee:1:completion", "type": "completion", "prompt": "###\n QuoJS 2.0\n (c) 2011, 2012 Javi Jiménez Villar (@soyjavi)\n http://quojs.tapquo.com\n###\n\n(($$) ->\n\n $$.fn.addClass = (name) ->\n @each ->\n unless _existsClass(name, @className)\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.removeClass = (name) ->\n @each ->\n unless name\n @className = \"\"\n else\n @className = @className.replace(name, \" \").replace(/\\s+/g, \" \").trim() if _existsClass(name, @className)\n\n $$.fn.toggleClass = (name) ->\n @each ->", "response": "if _existsClass(name, @className)\n @className = @className.replace(name, \" \")\n else\n @className += \" \" + name\n @className = @className.trim()\n\n $$.fn.hasClass = (name) ->\n _existsClass name, this[0].className\n\n $$.fn.style = (property, value) ->\n (if (not value) then this[0].style[property] or _computedStyle(this[0], property) else @each(->\n @style[property] = value\n ))\n\n _existsClass = (name, className) ->\n classes = className.split(/\\s+/g)\n classes.indexOf(name) >= 0\n\n _computedStyle = (element, property) ->\n document.defaultView.getComputedStyle(element, \"\")[property]\n\n return\n\n) Quo", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "soyjavi/QuoJS", "path": "src/quo.style.coffee", "license": "MIT", "commit": "7e5225294024e93c4226d70bce6d7f8056d68e61", "stars": 2055, "source_url": "https://github.com/soyjavi/QuoJS/blob/7e5225294024e93c4226d70bce6d7f8056d68e61/src/quo.style.coffee", "line_start": 1, "line_end": 47} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/signup.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'app-signup'\n\n propTypes:\n topics: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n name: ''\n email: ''\n isEmailValid: true\n\n onNameChange: (event) ->\n name = event.target.value\n @setState {name}\n\n onEmailChange: (event) ->\n email = event.target.value\n @setState {email, isEmailValid: true}\n\n onNameKeydown: (event) ->\n if event.keyCode is keyboard.enter\n @refs.email.focus()\n\n onEmailKeydown: (event) ->\n if event.keyCode is keyboard.enter\n @onSubmit()\n\n onSubmit: ->\n data =\n name: @state.name\n email: @state.email\n\n if @state.name.trim().length is 0\n return\n\n guestActions.userCreate data.name, data.email, undefined,\n (resp) ->\n handlers.registerUser resp\n handlers.joinTopic()\n (resp) =>\n console.error 'signup user error', resp\n @setState isEmailValid: false\n\n renderForm: ->\n # guest page gets only part of the data,\n # guessing topic name since there's only one topic\n topicName = @props.topics.first().first().get('topic')\n\n if topicName\n welcome = lang.getText('visiting-topic').replace('%s', topicName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/signup.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/signup.coffee", "line_start": 24, "line_end": 73} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/signup.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'app-signup'\n\n propTypes:\n topics: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n name: ''\n email: ''\n isEmailValid: true\n\n onNameChange: (event) ->\n name = event.target.value\n @setState {name}\n\n onEmailChange: (event) ->\n email = event.target.value\n @setState {email, isEmailValid: true}\n\n onNameKeydown: (event) ->\n if event.keyCode is keyboard.enter\n @refs.email.focus()\n\n onEmailKeydown: (event) ->\n if event.keyCode is keyboard.enter\n @onSubmit()\n\n onSubmit: ->\n data =\n name: @state.name\n email: @state.email\n\n if @state.name.trim().length is 0\n return\n\n guestActions.userCreate data.name, data.email, undefined,\n (resp) ->\n handlers.registerUser resp\n handlers.joinTopic()\n (resp) =>\n console.error 'signup user error', resp\n @setState isEmailValid: false\n\n renderForm: ->\n # guest page gets only part of the data,\n # guessing topic name since there's only one topic\n topicName = @props.topics.first().first().get('topic')\n\n if topicName\n welcome = lang.getText('visiting-topic').replace('%s', topicName)\n```", "response": "module.exports = React.createClass({\n displayName: 'app-signup',\n propTypes: {\n topics: T.instanceOf(Immutable.Map).isRequired\n },\n getInitialState: function() {\n return {\n name: '',\n email: '',\n isEmailValid: true\n };\n },\n onNameChange: function(event) {\n var name;\n name = event.target.value;\n return this.setState({name});\n },\n onEmailChange: function(event) {\n var email;\n email = event.target.value;\n return this.setState({\n email,\n isEmailValid: true\n });\n },\n onNameKeydown: function(event) {\n if (event.keyCode === keyboard.enter) {\n return this.refs.email.focus();\n }\n },\n onEmailKeydown: function(event) {\n if (event.keyCode === keyboard.enter) {\n return this.onSubmit();\n }\n },\n onSubmit: function() {\n var data;\n data = {\n name: this.state.name,\n email: this.state.email\n };\n if (this.state.name.trim().length === 0) {\n return;\n }\n return guestActions.userCreate(data.name, data.email, void 0, function(resp) {\n handlers.registerUser(resp);\n return handlers.joinTopic();\n }, (resp) => {\n console.error('signup user error', resp);\n return this.setState({\n isEmailValid: false\n });\n });\n },\n renderForm: function() {\n var topicName, welcome;\n // guest page gets only part of the data,\n // guessing topic name since there's only one topic\n topicName = this.props.topics.first().first().get('topic');\n if (topicName) {\n return welcome = lang.getText('visiting-topic').replace('%s', topicName);\n }\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/signup.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/signup.coffee", "line_start": 24, "line_end": 73} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/signup.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'app-signup',\n propTypes: {\n topics: T.instanceOf(Immutable.Map).isRequired\n },\n getInitialState: function() {\n return {\n name: '',\n email: '',\n isEmailValid: true\n };\n },\n onNameChange: function(event) {\n var name;\n name = event.target.value;\n return this.setState({name});\n },\n onEmailChange: function(event) {\n var email;\n email = event.target.value;\n return this.setState({\n email,\n isEmailValid: true\n });\n },\n onNameKeydown: function(event) {\n if (event.keyCode === keyboard.enter) {\n return this.refs.email.focus();\n }\n },\n onEmailKeydown: function(event) {\n if (event.keyCode === keyboard.enter) {\n return this.onSubmit();\n }\n },\n onSubmit: function() {\n var data;\n data = {\n name: this.state.name,\n email: this.state.email\n };\n if (this.state.name.trim().length === 0) {\n return;\n }\n return guestActions.userCreate(data.name, data.email, void 0, function(resp) {\n handlers.registerUser(resp);\n return handlers.joinTopic();\n }, (resp) => {\n console.error('signup user error', resp);\n return this.setState({\n isEmailValid: false\n });\n });\n },\n renderForm: function() {\n var topicName, welcome;\n // guest page gets only part of the data,\n // guessing topic name since there's only one topic\n topicName = this.props.topics.first().first().get('topic');\n if (topicName) {\n return welcome = lang.getText('visiting-topic').replace('%s', topicName);\n }\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'app-signup'\n\n propTypes:\n topics: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n name: ''\n email: ''\n isEmailValid: true\n\n onNameChange: (event) ->\n name = event.target.value\n @setState {name}\n\n onEmailChange: (event) ->\n email = event.target.value\n @setState {email, isEmailValid: true}\n\n onNameKeydown: (event) ->\n if event.keyCode is keyboard.enter\n @refs.email.focus()\n\n onEmailKeydown: (event) ->\n if event.keyCode is keyboard.enter\n @onSubmit()\n\n onSubmit: ->\n data =\n name: @state.name\n email: @state.email\n\n if @state.name.trim().length is 0\n return\n\n guestActions.userCreate data.name, data.email, undefined,\n (resp) ->\n handlers.registerUser resp\n handlers.joinTopic()\n (resp) =>\n console.error 'signup user error', resp\n @setState isEmailValid: false\n\n renderForm: ->\n # guest page gets only part of the data,\n # guessing topic name since there's only one topic\n topicName = @props.topics.first().first().get('topic')\n\n if topicName\n welcome = lang.getText('visiting-topic').replace('%s', topicName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/signup.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/signup.coffee", "line_start": 24, "line_end": 73} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/signup.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'app-signup'\n\n propTypes:\n topics: T.instanceOf(Immutable.Map).isRequired\n\n getInitialState: ->\n name: ''\n email: ''\n isEmailValid: true\n\n onNameChange: (event) ->\n name = event.target.value\n @setState {name}\n\n onEmailChange: (event) ->\n email = event.target.value\n @setState {email, isEmailValid: true}\n\n onNameKeydown: (event) ->\n if event.keyCode is keyboard.enter\n @refs.email.focus()\n\n onEmailKeydown: (event) ->\n if event.keyCode is keyboard.enter", "response": "@onSubmit()\n\n onSubmit: ->\n data =\n name: @state.name\n email: @state.email\n\n if @state.name.trim().length is 0\n return\n\n guestActions.userCreate data.name, data.email, undefined,\n (resp) ->\n handlers.registerUser resp\n handlers.joinTopic()\n (resp) =>\n console.error 'signup user error', resp\n @setState isEmailValid: false\n\n renderForm: ->\n # guest page gets only part of the data,\n # guessing topic name since there's only one topic\n topicName = @props.topics.first().first().get('topic')\n\n if topicName\n welcome = lang.getText('visiting-topic').replace('%s', topicName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/signup.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/signup.coffee", "line_start": 24, "line_end": 73} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/signup.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "else\n welcome = lang.getText('visiting-guest')\n emailClass = cx\n email: true\n 'form-control': true\n 'is-invalid': not @state.isEmailValid\n\n div className: 'box paragraph',\n div className: '', welcome\n div className: 'line',\n input\n className: 'name form-control', value: @state.name, type: 'text'\n placeholder: lang.getText('your-name')\n onChange: @onNameChange, onKeyDown: @onNameKeydown\n div className: 'line',\n input\n type: 'text', className: emailClass, ref: 'email', value: @state.email\n placeholder: lang.getText('email-optional')\n onChange: @onEmailChange, onKeyDown: @onEmailKeydown\n span\n className: 'email-help simpletip is-right'\n 'data-tip': lang.getText('may-email-conversation')\n span className: 'icon icon-help muted'\n div className: 'line',\n button className: 'button is-primary is-extended', onClick: @onSubmit,\n lang.getText('join-topic')\n\n renderFooter: ->\n\n homeLink = 'https://jianliao.com'\n blogLink = 'https://jianliao.com/blog/'\n loginLink = 'https://account.jianliao.com/signin'\n signupLink = 'https://account.jianliao.com/signup'\n\n div className: 'footer',\n div className: 'sites line',\n a target: '_blank', className: 'button is-link', href: homeLink,\n lang.getText('home')\n a target: '_blank', className: 'button is-link', href: blogLink,\n lang.getText('blog')\n a target: '_blank', className: 'button is-link', href: loginLink,\n lang.getText('login')\n a target: '_blank', className: 'button is-link', href: signupLink,\n lang.getText('signup')\n div className: 'rights muted',\n 'Copyright © 2012-2016 Teambition Ltd.'\n\n render: ->\n\n div className: 'app-signup',", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/signup.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/signup.coffee", "line_start": 74, "line_end": 123} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/signup.coffee:2:completion", "type": "completion", "prompt": "else\n welcome = lang.getText('visiting-guest')\n emailClass = cx\n email: true\n 'form-control': true\n 'is-invalid': not @state.isEmailValid\n\n div className: 'box paragraph',\n div className: '', welcome\n div className: 'line',\n input\n className: 'name form-control', value: @state.name, type: 'text'\n placeholder: lang.getText('your-name')\n onChange: @onNameChange, onKeyDown: @onNameKeydown\n div className: 'line',\n input\n type: 'text', className: emailClass, ref: 'email', value: @state.email\n placeholder: lang.getText('email-optional')\n onChange: @onEmailChange, onKeyDown: @onEmailKeydown\n span\n className: 'email-help simpletip is-right'\n 'data-tip': lang.getText('may-email-conversation')\n span className: 'icon icon-help muted'\n div className: 'line',\n button className: 'button is-primary is-extended', onClick: @onSubmit,", "response": "lang.getText('join-topic')\n\n renderFooter: ->\n\n homeLink = 'https://jianliao.com'\n blogLink = 'https://jianliao.com/blog/'\n loginLink = 'https://account.jianliao.com/signin'\n signupLink = 'https://account.jianliao.com/signup'\n\n div className: 'footer',\n div className: 'sites line',\n a target: '_blank', className: 'button is-link', href: homeLink,\n lang.getText('home')\n a target: '_blank', className: 'button is-link', href: blogLink,\n lang.getText('blog')\n a target: '_blank', className: 'button is-link', href: loginLink,\n lang.getText('login')\n a target: '_blank', className: 'button is-link', href: signupLink,\n lang.getText('signup')\n div className: 'rights muted',\n 'Copyright © 2012-2016 Teambition Ltd.'\n\n render: ->\n\n div className: 'app-signup',", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/signup.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/signup.coffee", "line_start": 74, "line_end": 123} {"id": "jianliaoim/talk-os:talk-web/client/guest-app/signup.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "div className: \"logo is-#{lang.getLang()}\"\n @renderForm()\n @renderFooter()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/guest-app/signup.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/guest-app/signup.coffee", "line_start": 124, "line_end": 126} {"id": "outsideris/popularconvention:src/timeline.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n .on 'complete', (err) ->\n callback err if err instanceof Error\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n .on 'complete', (err) ->\n callback err if err instanceof Error\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n```", "response": "// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 50 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n }).on('complete', function(err) {\n if (err instanceof Error) {\n return callback(err);\n }\n });\n },\n checkApiLimit: function(callback) {\n return restler.get(generateApiUrl(\"/users/whatever\")).on('success', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n }).on('fail', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n });\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 50 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n }).on('complete', function(err) {\n if (err instanceof Error) {\n return callback(err);\n }\n });\n },\n checkApiLimit: function(callback) {\n return restler.get(generateApiUrl(\"/users/whatever\")).on('success', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n }).on('fail', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n });\n }\n};\n```", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n .on 'complete', (err) ->\n callback err if err instanceof Error\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:completion", "type": "completion", "prompt": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline", "response": "repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n .on 'complete', (err) ->\n callback err if err instanceof Error\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/timeline.coffee", "line_start": 51, "line_end": 53} {"id": "outsideris/popularconvention:src/timeline.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"\n```", "response": "// private\nvar generateApiUrl;\n\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/timeline.coffee", "line_start": 51, "line_end": 53} {"id": "outsideris/popularconvention:src/timeline.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// private\nvar generateApiUrl;\n\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};\n```", "response": "# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "4e14df19a1d7fd3747c73620648df56853902087", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/4e14df19a1d7fd3747c73620648df56853902087/src/timeline.coffee", "line_start": 51, "line_end": 53} {"id": "outsideris/popularconvention:src/timeline.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ae65abb477ee097a58b79b5f06d3c198c1d276ac", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ae65abb477ee097a58b79b5f06d3c198c1d276ac/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->\n```", "response": "// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 50 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n },\n checkApiLimit: function(callback) {\n return restler.get(generateApiUrl(\"/users/whatever\")).on('success', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n }).on('fail', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ae65abb477ee097a58b79b5f06d3c198c1d276ac", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ae65abb477ee097a58b79b5f06d3c198c1d276ac/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 50 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n },\n checkApiLimit: function(callback) {\n return restler.get(generateApiUrl(\"/users/whatever\")).on('success', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n }).on('fail', function(data, res) {\n logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);\n return callback(res.headers['x-ratelimit-remaining']);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {};\n```", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ae65abb477ee097a58b79b5f06d3c198c1d276ac", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ae65abb477ee097a58b79b5f06d3c198c1d276ac/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:completion", "type": "completion", "prompt": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline", "response": "repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 50 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n logger.debug \"API rate ramained #{res.headers['x-ratelimit-remaining']}\"\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ae65abb477ee097a58b79b5f06d3c198c1d276ac", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ae65abb477ee097a58b79b5f06d3c198c1d276ac/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n console.log('success');\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n console.log('fail');\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "132d91edec9fe032a0d97463e5be2ada61956843", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/132d91edec9fe032a0d97463e5be2ada61956843/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n console.log('success');\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n console.log('fail');\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->\n```", "response": "// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 100 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n },\n checkApiLimit: function(callback) {\n return restler.get(generateApiUrl(\"/users/whatever\")).on('success', function(data, res) {\n console.log('success');\n return callback(res.headers['x-ratelimit-remaining']);\n }).on('fail', function(data, res) {\n console.log('fail');\n return callback(res.headers['x-ratelimit-remaining']);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "132d91edec9fe032a0d97463e5be2ada61956843", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/132d91edec9fe032a0d97463e5be2ada61956843/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 100 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n },\n checkApiLimit: function(callback) {\n return restler.get(generateApiUrl(\"/users/whatever\")).on('success', function(data, res) {\n console.log('success');\n return callback(res.headers['x-ratelimit-remaining']);\n }).on('fail', function(data, res) {\n console.log('fail');\n return callback(res.headers['x-ratelimit-remaining']);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {};\n```", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n console.log('success');\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n console.log('fail');\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "132d91edec9fe032a0d97463e5be2ada61956843", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/132d91edec9fe032a0d97463e5be2ada61956843/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:completion", "type": "completion", "prompt": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline", "response": "repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n checkApiLimit: (callback) ->\n restler.get(generateApiUrl \"/users/whatever\")\n .on 'success', (data, res) ->\n console.log('success');\n callback res.headers['x-ratelimit-remaining']\n .on 'fail', (data, res) ->\n console.log('fail');\n callback res.headers['x-ratelimit-remaining']\n\n# private\ngenerateApiUrl = (url) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "132d91edec9fe032a0d97463e5be2ada61956843", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/132d91edec9fe032a0d97463e5be2ada61956843/src/timeline.coffee", "line_start": 1, "line_end": 50} {"id": "outsideris/popularconvention:src/timeline.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "e779fca9bffe97d42787d561f88395c72c4342e0", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/e779fca9bffe97d42787d561f88395c72c4342e0/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"\n```", "response": "// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 100 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "e779fca9bffe97d42787d561f88395c72c4342e0", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/e779fca9bffe97d42787d561f88395c72c4342e0/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n if (res.headers['x-ratelimit-remaining'] % 100 === 0) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};\n```", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "e779fca9bffe97d42787d561f88395c72c4342e0", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/e779fca9bffe97d42787d561f88395c72c4342e0/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:completion", "type": "completion", "prompt": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =", "response": "getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] % 100 is 0\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "e779fca9bffe97d42787d561f88395c72c4342e0", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/e779fca9bffe97d42787d561f88395c72c4342e0/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\"\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ff72df2e3db01bf82dc753509a6418c17662cc4f", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ff72df2e3db01bf82dc753509a6418c17662cc4f/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\"\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"\n```", "response": "// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ff72df2e3db01bf82dc753509a6418c17662cc4f", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ff72df2e3db01bf82dc753509a6418c17662cc4f/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\nlogger = helpers.logger;\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\ntl = module.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n //'x-ratelimit-limit': '5000',\n //'x-ratelimit-remaining': '4986',\n logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n if (res.headers['x-ratelimit-remaining'] < '10') {\n logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);\n }\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n return callback(data);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};\n```", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\"\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ff72df2e3db01bf82dc753509a6418c17662cc4f", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ff72df2e3db01bf82dc753509a6418c17662cc4f/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:completion", "type": "completion", "prompt": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\nlogger = helpers.logger\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\ntl = module.exports =", "response": "getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n #'x-ratelimit-limit': '5000',\n #'x-ratelimit-remaining': '4986',\n logger.info \"github api limit: #{res.headers['x-ratelimit-remaining']}\"\n logger.error \"github api limit: #{res.headers['x-ratelimit-remaining']}\" if res.headers['x-ratelimit-remaining'] < '10'\n callback null, data, res\n .on 'fail', (data, res) ->\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "ff72df2e3db01bf82dc753509a6418c17662cc4f", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/ff72df2e3db01bf82dc753509a6418c17662cc4f/src/timeline.coffee", "line_start": 1, "line_end": 42} {"id": "outsideris/popularconvention:src/timeline.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\nmodule.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/timeline.coffee", "line_start": 1, "line_end": 38} {"id": "outsideris/popularconvention:src/timeline.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\nmodule.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"\n```", "response": "// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, path, postfix, restler, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\nmodule.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n console.log(`${res.statusCode}:`, data);\n return callback(data);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/timeline.coffee", "line_start": 1, "line_end": 38} {"id": "outsideris/popularconvention:src/timeline.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar fs, generateApiUrl, githubHost, helpers, path, postfix, restler, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\nhelpers = require('./helpers');\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\nmodule.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === helpers.extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n console.log(`${res.statusCode}:`, data);\n return callback(data);\n });\n }\n};\n\n// private\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};\n```", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\nmodule.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/timeline.coffee", "line_start": 1, "line_end": 38} {"id": "outsideris/popularconvention:src/timeline.coffee:1:completion", "type": "completion", "prompt": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\nhelpers = require './helpers'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"", "response": "module.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse timeline if 'string' is helpers.extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "a63c08b3721d317537737c46e4c813893ec71263", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/a63c08b3721d317537737c46e4c813893ec71263/src/timeline.coffee", "line_start": 1, "line_end": 38} {"id": "outsideris/popularconvention:src/timeline.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\nmodule.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline) if 'string' is extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\nextractType = (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "d5cced919f11b68e8b159171d3ca9d3f973544e9", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/d5cced919f11b68e8b159171d3ca9d3f973544e9/src/timeline.coffee", "line_start": 1, "line_end": 40} {"id": "outsideris/popularconvention:src/timeline.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\nmodule.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline) if 'string' is extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\nextractType = (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"\n```", "response": "// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar extractType, fs, generateApiUrl, githubHost, path, postfix, restler, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\nmodule.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n console.log(`${res.statusCode}:`, data);\n return callback(data);\n });\n }\n};\n\n// private\nextractType = function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n};\n\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "d5cced919f11b68e8b159171d3ca9d3f973544e9", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/d5cced919f11b68e8b159171d3ca9d3f973544e9/src/timeline.coffee", "line_start": 1, "line_end": 40} {"id": "outsideris/popularconvention:src/timeline.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// # Handle github timeline\n\n// Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n// Licensed under the MIT license.\n// \nvar extractType, fs, generateApiUrl, githubHost, path, postfix, restler, token, tokenPath;\n\nrestler = require('restler');\n\npath = require('path');\n\nfs = require('fs');\n\ngithubHost = 'https://api.github.com';\n\n// github.json contained token should be in .tokens directory\n// ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n// WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve(`${__dirname}`, \"../.tokens\");\n\ntoken = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));\n\npostfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;\n\nmodule.exports = {\n getCommitUrls: function(timeline) {\n var i, len, ref, repo, results, sha;\n if ('string' === extractType(timeline)) {\n // GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline);\n }\n repo = timeline.repository;\n ref = timeline.payload.shas;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n sha = ref[i];\n results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);\n }\n return results;\n },\n getCommitInfo: function(url, callback) {\n return restler.get(generateApiUrl(url)).on('success', function(data, res) {\n return callback(null, data, res);\n }).on('fail', function(data, res) {\n console.log(`${res.statusCode}:`, data);\n return callback(data);\n });\n }\n};\n\n// private\nextractType = function(target) {\n return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();\n};\n\ngenerateApiUrl = function(url) {\n return `${githubHost}${url}${postfix}`;\n};\n```", "response": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\nmodule.exports =\n getCommitUrls: (timeline) ->\n # GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline) if 'string' is extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\nextractType = (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "d5cced919f11b68e8b159171d3ca9d3f973544e9", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/d5cced919f11b68e8b159171d3ca9d3f973544e9/src/timeline.coffee", "line_start": 1, "line_end": 40} {"id": "outsideris/popularconvention:src/timeline.coffee:1:completion", "type": "completion", "prompt": "# # Handle github timeline\n#\n# Copyright (c) 2013 JeongHoon Byun aka \"Outsider\", \n# Licensed under the MIT license.\n# \n\nrestler = require 'restler'\npath = require 'path'\nfs = require 'fs'\n\ngithubHost = 'https://api.github.com'\n# github.json contained token should be in .tokens directory\n# ex: { \"cliendId\": \"\", \"clientSecret\": \"\" }\n# WARRING: MUST NOT commit github.json file\ntokenPath = path.resolve \"#{__dirname}\", \"../.tokens\"\ntoken = JSON.parse(fs.readFileSync \"#{tokenPath}/github.json\", 'utf8')\npostfix = \"?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}\"\n\nmodule.exports =\n getCommitUrls: (timeline) ->", "response": "# GET /repos/:owner/:repo/commits/:sha\n timeline = JSON.parse(timeline) if 'string' is extractType timeline\n\n repo = timeline.repository\n \"/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}\" for sha in timeline.payload.shas\n\n getCommitInfo: (url, callback) ->\n restler.get(generateApiUrl url)\n .on 'success', (data, res) ->\n callback null, data, res\n .on 'fail', (data, res) ->\n console.log \"#{res.statusCode}:\", data\n callback data\n\n# private\nextractType = (target) ->\n Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()\n\ngenerateApiUrl = (url) ->\n \"#{githubHost}#{url}#{postfix}\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "outsideris/popularconvention", "path": "src/timeline.coffee", "license": "MIT", "commit": "d5cced919f11b68e8b159171d3ca9d3f973544e9", "stars": 730, "source_url": "https://github.com/outsideris/popularconvention/blob/d5cced919f11b68e8b159171d3ca9d3f973544e9/src/timeline.coffee", "line_start": 1, "line_end": 40} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'form-file'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n imageWidth: T.number\n onUploaded: T.func\n willSubmit: T.bool\n imageHeight: T.number\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n onDelete: T.func\n onImageClick: T.func\n\n getDefaultProps: ->\n onChange: (->)\n onDelete: (->)\n onSubmit: (->)\n onImageClick: (->)\n readOnly: false\n imageWidth: 600\n onUploaded: (->)\n willSubmit: false\n imageHeight: 400\n\n getInitialState: ->\n data: @props.data or Immutable.Map PROTO_DATA\n isUploaded: @props.data?\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 PROTO_DATA\n isUploaded: 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 PROTO_DATA\n isUploaded: @props.data?\n\n getPreviewSize: ->\n @refs.preview?.getBoundingClientRect() or {}\n\n isFileClickable: ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 31, "line_end": 80} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'form-file'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n imageWidth: T.number\n onUploaded: T.func\n willSubmit: T.bool\n imageHeight: T.number\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n onDelete: T.func\n onImageClick: T.func\n\n getDefaultProps: ->\n onChange: (->)\n onDelete: (->)\n onSubmit: (->)\n onImageClick: (->)\n readOnly: false\n imageWidth: 600\n onUploaded: (->)\n willSubmit: false\n imageHeight: 400\n\n getInitialState: ->\n data: @props.data or Immutable.Map PROTO_DATA\n isUploaded: @props.data?\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 PROTO_DATA\n isUploaded: 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 PROTO_DATA\n isUploaded: @props.data?\n\n getPreviewSize: ->\n @refs.preview?.getBoundingClientRect() or {}\n\n isFileClickable: ->\n```", "response": "module.exports = React.createClass({\n displayName: 'form-file',\n propTypes: {\n data: T.instanceOf(Immutable.Map),\n onChange: T.func,\n onSubmit: T.func,\n readOnly: T.bool,\n imageWidth: T.number,\n onUploaded: T.func,\n willSubmit: T.bool,\n imageHeight: T.number,\n displayMode: T.oneOf(['create', 'edit']).isRequired,\n onDelete: T.func,\n onImageClick: T.func\n },\n getDefaultProps: function() {\n return {\n onChange: (function() {}),\n onDelete: (function() {}),\n onSubmit: (function() {}),\n onImageClick: (function() {}),\n readOnly: false,\n imageWidth: 600,\n onUploaded: (function() {}),\n willSubmit: false,\n imageHeight: 400\n };\n },\n getInitialState: function() {\n return {\n data: this.props.data || Immutable.Map(PROTO_DATA),\n isUploaded: this.props.data != null\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(PROTO_DATA),\n isUploaded: 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(PROTO_DATA),\n isUploaded: this.props.data != null\n });\n }\n }\n },\n getPreviewSize: function() {\n var ref;\n return ((ref = this.refs.preview) != null ? ref.getBoundingClientRect() : void 0) || {};\n },\n isFileClickable: function() {}\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 31, "line_end": 80} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'form-file',\n propTypes: {\n data: T.instanceOf(Immutable.Map),\n onChange: T.func,\n onSubmit: T.func,\n readOnly: T.bool,\n imageWidth: T.number,\n onUploaded: T.func,\n willSubmit: T.bool,\n imageHeight: T.number,\n displayMode: T.oneOf(['create', 'edit']).isRequired,\n onDelete: T.func,\n onImageClick: T.func\n },\n getDefaultProps: function() {\n return {\n onChange: (function() {}),\n onDelete: (function() {}),\n onSubmit: (function() {}),\n onImageClick: (function() {}),\n readOnly: false,\n imageWidth: 600,\n onUploaded: (function() {}),\n willSubmit: false,\n imageHeight: 400\n };\n },\n getInitialState: function() {\n return {\n data: this.props.data || Immutable.Map(PROTO_DATA),\n isUploaded: this.props.data != null\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(PROTO_DATA),\n isUploaded: 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(PROTO_DATA),\n isUploaded: this.props.data != null\n });\n }\n }\n },\n getPreviewSize: function() {\n var ref;\n return ((ref = this.refs.preview) != null ? ref.getBoundingClientRect() : void 0) || {};\n },\n isFileClickable: function() {}\n});\n```", "response": "module.exports = React.createClass\n displayName: 'form-file'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n imageWidth: T.number\n onUploaded: T.func\n willSubmit: T.bool\n imageHeight: T.number\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n onDelete: T.func\n onImageClick: T.func\n\n getDefaultProps: ->\n onChange: (->)\n onDelete: (->)\n onSubmit: (->)\n onImageClick: (->)\n readOnly: false\n imageWidth: 600\n onUploaded: (->)\n willSubmit: false\n imageHeight: 400\n\n getInitialState: ->\n data: @props.data or Immutable.Map PROTO_DATA\n isUploaded: @props.data?\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 PROTO_DATA\n isUploaded: 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 PROTO_DATA\n isUploaded: @props.data?\n\n getPreviewSize: ->\n @refs.preview?.getBoundingClientRect() or {}\n\n isFileClickable: ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 31, "line_end": 80} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'form-file'\n\n propTypes:\n data: T.instanceOf(Immutable.Map)\n onChange: T.func\n onSubmit: T.func\n readOnly: T.bool\n imageWidth: T.number\n onUploaded: T.func\n willSubmit: T.bool\n imageHeight: T.number\n displayMode: T.oneOf([ 'create', 'edit' ]).isRequired\n onDelete: T.func\n onImageClick: T.func\n\n getDefaultProps: ->\n onChange: (->)\n onDelete: (->)\n onSubmit: (->)\n onImageClick: (->)\n readOnly: false\n imageWidth: 600\n onUploaded: (->)\n willSubmit: false", "response": "imageHeight: 400\n\n getInitialState: ->\n data: @props.data or Immutable.Map PROTO_DATA\n isUploaded: @props.data?\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 PROTO_DATA\n isUploaded: 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 PROTO_DATA\n isUploaded: @props.data?\n\n getPreviewSize: ->\n @refs.preview?.getBoundingClientRect() or {}\n\n isFileClickable: ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 31, "line_end": 80} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@props.readOnly and detect.isImageWithPreview(@props.data)\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n @props.onChange newState.data\n\n handleFileDelete: (event) ->\n event.stopPropagation()\n\n newState =\n data: Immutable.Map PROTO_DATA\n isUploaded: false\n\n @setState newState\n @props.onChange newState.data\n @props.onDelete()\n\n handleFileView: (event) ->\n\n\n handleFileComplete: (uploadedData) ->\n newState =\n data: Immutable.Map uploadedData\n isUploaded: true\n\n @setState newState\n @props.onChange newState.data\n @props.onUploaded()\n\n handleFileNameChange: (event) ->\n @willChange 'fileName', event.target.value\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n\n renderPreview: ->\n imageWidth = @props.imageWidth\n imageHeight = @props.imageHeight\n thumbnailUrl = @state.data.get 'thumbnailUrl'\n\n isWidther = @state.data.get('imageWidth') > imageWidth\n isHeighter = @state.data.get('imageHeight') > imageHeight", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 81, "line_end": 130} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n@props.readOnly and detect.isImageWithPreview(@props.data)\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n @props.onChange newState.data\n\n handleFileDelete: (event) ->\n event.stopPropagation()\n\n newState =\n data: Immutable.Map PROTO_DATA\n isUploaded: false\n\n @setState newState\n @props.onChange newState.data\n @props.onDelete()\n\n handleFileView: (event) ->\n\n\n handleFileComplete: (uploadedData) ->\n newState =\n data: Immutable.Map uploadedData\n isUploaded: true\n\n @setState newState\n @props.onChange newState.data\n @props.onUploaded()\n\n handleFileNameChange: (event) ->\n @willChange 'fileName', event.target.value\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n\n renderPreview: ->\n imageWidth = @props.imageWidth\n imageHeight = @props.imageHeight\n thumbnailUrl = @state.data.get 'thumbnailUrl'\n\n isWidther = @state.data.get('imageWidth') > imageWidth\n isHeighter = @state.data.get('imageHeight') > imageHeight\n```", "response": "this.props.readOnly && detect.isImageWithPreview(this.props.data)({\n willChange: function(key, value) {\n var newState;\n newState = {\n data: this.state.data.set(key, value)\n };\n this.setState(newState);\n return this.props.onChange(newState.data);\n },\n handleFileDelete: function(event) {\n var newState;\n event.stopPropagation();\n newState = {\n data: Immutable.Map(PROTO_DATA),\n isUploaded: false\n };\n this.setState(newState);\n this.props.onChange(newState.data);\n return this.props.onDelete();\n },\n handleFileView: function(event) {},\n handleFileComplete: function(uploadedData) {\n var newState;\n newState = {\n data: Immutable.Map(uploadedData),\n isUploaded: true\n };\n this.setState(newState);\n this.props.onChange(newState.data);\n return this.props.onUploaded();\n },\n handleFileNameChange: function(event) {\n return this.willChange('fileName', event.target.value);\n },\n handleTextChange: function(event) {\n return this.willChange('text', event.target.value);\n },\n onFormSubmit: function(event) {\n event.preventDefault();\n return this.props.onSubmit(this.state.data);\n },\n renderPreview: function() {\n var imageHeight, imageWidth, isHeighter, isWidther, thumbnailUrl;\n imageWidth = this.props.imageWidth;\n imageHeight = this.props.imageHeight;\n thumbnailUrl = this.state.data.get('thumbnailUrl');\n isWidther = this.state.data.get('imageWidth') > imageWidth;\n return isHeighter = this.state.data.get('imageHeight') > imageHeight;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 81, "line_end": 130} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nthis.props.readOnly && detect.isImageWithPreview(this.props.data)({\n willChange: function(key, value) {\n var newState;\n newState = {\n data: this.state.data.set(key, value)\n };\n this.setState(newState);\n return this.props.onChange(newState.data);\n },\n handleFileDelete: function(event) {\n var newState;\n event.stopPropagation();\n newState = {\n data: Immutable.Map(PROTO_DATA),\n isUploaded: false\n };\n this.setState(newState);\n this.props.onChange(newState.data);\n return this.props.onDelete();\n },\n handleFileView: function(event) {},\n handleFileComplete: function(uploadedData) {\n var newState;\n newState = {\n data: Immutable.Map(uploadedData),\n isUploaded: true\n };\n this.setState(newState);\n this.props.onChange(newState.data);\n return this.props.onUploaded();\n },\n handleFileNameChange: function(event) {\n return this.willChange('fileName', event.target.value);\n },\n handleTextChange: function(event) {\n return this.willChange('text', event.target.value);\n },\n onFormSubmit: function(event) {\n event.preventDefault();\n return this.props.onSubmit(this.state.data);\n },\n renderPreview: function() {\n var imageHeight, imageWidth, isHeighter, isWidther, thumbnailUrl;\n imageWidth = this.props.imageWidth;\n imageHeight = this.props.imageHeight;\n thumbnailUrl = this.state.data.get('thumbnailUrl');\n isWidther = this.state.data.get('imageWidth') > imageWidth;\n return isHeighter = this.state.data.get('imageHeight') > imageHeight;\n }\n});\n```", "response": "@props.readOnly and detect.isImageWithPreview(@props.data)\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n @props.onChange newState.data\n\n handleFileDelete: (event) ->\n event.stopPropagation()\n\n newState =\n data: Immutable.Map PROTO_DATA\n isUploaded: false\n\n @setState newState\n @props.onChange newState.data\n @props.onDelete()\n\n handleFileView: (event) ->\n\n\n handleFileComplete: (uploadedData) ->\n newState =\n data: Immutable.Map uploadedData\n isUploaded: true\n\n @setState newState\n @props.onChange newState.data\n @props.onUploaded()\n\n handleFileNameChange: (event) ->\n @willChange 'fileName', event.target.value\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n\n renderPreview: ->\n imageWidth = @props.imageWidth\n imageHeight = @props.imageHeight\n thumbnailUrl = @state.data.get 'thumbnailUrl'\n\n isWidther = @state.data.get('imageWidth') > imageWidth\n isHeighter = @state.data.get('imageHeight') > imageHeight", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 81, "line_end": 130} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:2:completion", "type": "completion", "prompt": "@props.readOnly and detect.isImageWithPreview(@props.data)\n\n willChange: (key, value) ->\n newState =\n data: @state.data.set key, value\n\n @setState newState\n @props.onChange newState.data\n\n handleFileDelete: (event) ->\n event.stopPropagation()\n\n newState =\n data: Immutable.Map PROTO_DATA\n isUploaded: false\n\n @setState newState\n @props.onChange newState.data\n @props.onDelete()\n\n handleFileView: (event) ->\n\n\n handleFileComplete: (uploadedData) ->\n newState =", "response": "data: Immutable.Map uploadedData\n isUploaded: true\n\n @setState newState\n @props.onChange newState.data\n @props.onUploaded()\n\n handleFileNameChange: (event) ->\n @willChange 'fileName', event.target.value\n\n handleTextChange: (event) ->\n @willChange 'text', event.target.value\n\n onFormSubmit: (event) ->\n event.preventDefault()\n @props.onSubmit @state.data\n\n\n renderPreview: ->\n imageWidth = @props.imageWidth\n imageHeight = @props.imageHeight\n thumbnailUrl = @state.data.get 'thumbnailUrl'\n\n isWidther = @state.data.get('imageWidth') > imageWidth\n isHeighter = @state.data.get('imageHeight') > imageHeight", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 81, "line_end": 130} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isCover = isWidther and isHeighter\n\n url = constraint.thumbnail thumbnailUrl, imageHeight, imageWidth\n style = if url? then backgroundImage: \"url(#{ url })\" else {}\n\n div className: cx('preview', 'is-cover': isCover), style: style\n\n renderExtension: ->\n fileType = @state.data.get 'fileType'\n\n div className: 'extension',\n i className: 'ti ti-file-holder'\n span {}, fileType\n\n render: ->\n cxView = cx 'file-view', 'is-clickable': @isFileClickable()\n\n onFileClick = =>\n if @isFileClickable()\n @props.onImageClick()\n\n form className: cx('form-table', 'is-dashed': not @state.isUploaded), onSubmit: @onFormSubmit,\n if @state.isUploaded\n div className: cxView, onClick: onFileClick,\n if @state.data.get('fileCategory').length is 0\n noscript()\n else if detect.isImageWithPreview(@state.data)\n @renderPreview()\n else\n @renderExtension()\n span className: 'btn-group',\n if not @props.readOnly\n a className: 'btn btn-delete', onClick: @handleFileDelete,\n Icon size: 18, name: 'trash'\n else noscript()\n\n # Disable file preview for a while.\n # if @props.displayMode isnt 'create'\n # a className: 'btn btn-view', onClick: @handleFileView,\n # Icon size: 18, name: 'search'\n # else noscript()\n else noscript()\n fieldset {},\n if not @state.isUploaded\n Uploader\n data: @state.data\n onComplete: @handleFileComplete\n else noscript()\n div className: 'form-row', hidden: not @state.isUploaded,\n input", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 131, "line_end": 180} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:3:completion", "type": "completion", "prompt": "isCover = isWidther and isHeighter\n\n url = constraint.thumbnail thumbnailUrl, imageHeight, imageWidth\n style = if url? then backgroundImage: \"url(#{ url })\" else {}\n\n div className: cx('preview', 'is-cover': isCover), style: style\n\n renderExtension: ->\n fileType = @state.data.get 'fileType'\n\n div className: 'extension',\n i className: 'ti ti-file-holder'\n span {}, fileType\n\n render: ->\n cxView = cx 'file-view', 'is-clickable': @isFileClickable()\n\n onFileClick = =>\n if @isFileClickable()\n @props.onImageClick()\n\n form className: cx('form-table', 'is-dashed': not @state.isUploaded), onSubmit: @onFormSubmit,\n if @state.isUploaded\n div className: cxView, onClick: onFileClick,\n if @state.data.get('fileCategory').length is 0", "response": "noscript()\n else if detect.isImageWithPreview(@state.data)\n @renderPreview()\n else\n @renderExtension()\n span className: 'btn-group',\n if not @props.readOnly\n a className: 'btn btn-delete', onClick: @handleFileDelete,\n Icon size: 18, name: 'trash'\n else noscript()\n\n # Disable file preview for a while.\n # if @props.displayMode isnt 'create'\n # a className: 'btn btn-view', onClick: @handleFileView,\n # Icon size: 18, name: 'search'\n # else noscript()\n else noscript()\n fieldset {},\n if not @state.isUploaded\n Uploader\n data: @state.data\n onComplete: @handleFileComplete\n else noscript()\n div className: 'form-row', hidden: not @state.isUploaded,\n input", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/form-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 131, "line_end": 180} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "type: 'text'\n value: @state.data.get('fileName') or ''\n onChange: @handleFileNameChange\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-filename'\n div className: 'form-row', hidden: not @state.isUploaded,\n Textarea\n value: @state.data.get('text') or ''\n onChange: @handleTextChange\n readOnly: @props.readOnly\n className: 'textarea-row font-normal'\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-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 181, "line_end": 194} {"id": "jianliaoim/talk-os:talk-web/client/app/form-file.coffee:4:completion", "type": "completion", "prompt": "type: 'text'\n value: @state.data.get('fileName') or ''\n onChange: @handleFileNameChange\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-filename'", "response": "div className: 'form-row', hidden: not @state.isUploaded,\n Textarea\n value: @state.data.get('text') or ''\n onChange: @handleTextChange\n readOnly: @props.readOnly\n className: 'textarea-row font-normal'\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-file.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/form-file.coffee", "line_start": 181, "line_end": 194} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.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\n#\n# Home controller - Home page containing the Dashoard list and editor\n#\ncyclotronApp.controller 'HomeController', ($scope, $location, $modal, configService, dashboardService, tagService, userService) ->\n\n #\n # Scope Variables\n #\n\n $scope.cyclotronVersion = configService.version\n $scope.changelogLink ?= configService.changelogLink\n\n $scope.showSplash = true\n $scope.loading = false\n\n $scope.search =\n allTags: []\n hints: []\n query: []\n\n $scope.isTag = (hint) ->\n _.contains $scope.search.allTags, hint\n\n $scope.selectTag = (tag) ->\n # Only used when selecting tags from the Search Results\n $scope.search.query = _.union($scope.search.query, [tag])", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 1, "line_end": 42} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.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\n#\n# Home controller - Home page containing the Dashoard list and editor\n#\ncyclotronApp.controller 'HomeController', ($scope, $location, $modal, configService, dashboardService, tagService, userService) ->\n\n #\n # Scope Variables\n #\n\n $scope.cyclotronVersion = configService.version\n $scope.changelogLink ?= configService.changelogLink\n\n $scope.showSplash = true\n $scope.loading = false\n\n $scope.search =\n allTags: []\n hints: []\n query: []\n\n $scope.isTag = (hint) ->\n _.contains $scope.search.allTags, hint\n\n $scope.selectTag = (tag) ->\n # Only used when selecting tags from the Search Results\n $scope.search.query = _.union($scope.search.query, [tag])\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\n// Home controller - Home page containing the Dashoard list and editor\n\ncyclotronApp.controller('HomeController', function($scope, $location, $modal, configService, dashboardService, tagService, userService) {\n\n // Scope Variables\n\n $scope.cyclotronVersion = configService.version;\n if ($scope.changelogLink == null) {\n $scope.changelogLink = configService.changelogLink;\n }\n $scope.showSplash = true;\n $scope.loading = false;\n $scope.search = {\n allTags: [],\n hints: [],\n query: []\n };\n $scope.isTag = function(hint) {\n return _.contains($scope.search.allTags, hint);\n };\n return $scope.selectTag = function(tag) {\n // Only used when selecting tags from the Search Results\n return $scope.search.query = _.union($scope.search.query, [tag]);\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 1, "line_end": 42} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.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 */\n\n// Home controller - Home page containing the Dashoard list and editor\n\ncyclotronApp.controller('HomeController', function($scope, $location, $modal, configService, dashboardService, tagService, userService) {\n\n // Scope Variables\n\n $scope.cyclotronVersion = configService.version;\n if ($scope.changelogLink == null) {\n $scope.changelogLink = configService.changelogLink;\n }\n $scope.showSplash = true;\n $scope.loading = false;\n $scope.search = {\n allTags: [],\n hints: [],\n query: []\n };\n $scope.isTag = function(hint) {\n return _.contains($scope.search.allTags, hint);\n };\n return $scope.selectTag = function(tag) {\n // Only used when selecting tags from the Search Results\n return $scope.search.query = _.union($scope.search.query, [tag]);\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\n#\n# Home controller - Home page containing the Dashoard list and editor\n#\ncyclotronApp.controller 'HomeController', ($scope, $location, $modal, configService, dashboardService, tagService, userService) ->\n\n #\n # Scope Variables\n #\n\n $scope.cyclotronVersion = configService.version\n $scope.changelogLink ?= configService.changelogLink\n\n $scope.showSplash = true\n $scope.loading = false\n\n $scope.search =\n allTags: []\n hints: []\n query: []\n\n $scope.isTag = (hint) ->\n _.contains $scope.search.allTags, hint\n\n $scope.selectTag = (tag) ->\n # Only used when selecting tags from the Search Results\n $scope.search.query = _.union($scope.search.query, [tag])", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 1, "line_end": 42} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.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\n#\n# Home controller - Home page containing the Dashoard list and editor\n#\ncyclotronApp.controller 'HomeController', ($scope, $location, $modal, configService, dashboardService, tagService, userService) ->", "response": "#\n # Scope Variables\n #\n\n $scope.cyclotronVersion = configService.version\n $scope.changelogLink ?= configService.changelogLink\n\n $scope.showSplash = true\n $scope.loading = false\n\n $scope.search =\n allTags: []\n hints: []\n query: []\n\n $scope.isTag = (hint) ->\n _.contains $scope.search.allTags, hint\n\n $scope.selectTag = (tag) ->\n # Only used when selecting tags from the Search Results\n $scope.search.query = _.union($scope.search.query, [tag])", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 1, "line_end": 42} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Load search autocomplete\n $scope.getSearchHints = ->\n tagService.getSearchHints (searchHints) ->\n $scope.search.hints = searchHints\n\n $scope.canEdit = (dashboard) ->\n return true unless $scope.isLoggedIn()\n if dashboard? then dashboard._canView else true\n\n $scope.canDelete = (dashboard) ->\n return false unless $scope.isLoggedIn()\n if dashboard? then dashboard._canEdit else true\n\n $scope.loginAlert = ->\n alertify.error('Please login to enable', 2500)\n\n $scope.loadDashboards = ->\n $scope.dashboards = null\n return unless $scope.search.query.length > 0\n\n $scope.showSplash = false\n $scope.loading = true\n\n p = dashboardService.getDashboards $scope.search.query.join(',')\n p.then (dashboards) ->\n $scope.dashboards = dashboards\n $scope.updateDashboardVisits()\n $scope.updateDashboardPermissions()\n $scope.loading = false\n\n p.catch (response) ->\n if response.status == 500\n $modal.open {\n templateUrl: '/partials/500.html'\n scope: $scope\n controller: 'GenericErrorModalController'\n backdrop: 'static'\n keyboard: false\n }", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 44, "line_end": 82} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Load search autocomplete\n $scope.getSearchHints = ->\n tagService.getSearchHints (searchHints) ->\n $scope.search.hints = searchHints\n\n $scope.canEdit = (dashboard) ->\n return true unless $scope.isLoggedIn()\n if dashboard? then dashboard._canView else true\n\n $scope.canDelete = (dashboard) ->\n return false unless $scope.isLoggedIn()\n if dashboard? then dashboard._canEdit else true\n\n $scope.loginAlert = ->\n alertify.error('Please login to enable', 2500)\n\n $scope.loadDashboards = ->\n $scope.dashboards = null\n return unless $scope.search.query.length > 0\n\n $scope.showSplash = false\n $scope.loading = true\n\n p = dashboardService.getDashboards $scope.search.query.join(',')\n p.then (dashboards) ->\n $scope.dashboards = dashboards\n $scope.updateDashboardVisits()\n $scope.updateDashboardPermissions()\n $scope.loading = false\n\n p.catch (response) ->\n if response.status == 500\n $modal.open {\n templateUrl: '/partials/500.html'\n scope: $scope\n controller: 'GenericErrorModalController'\n backdrop: 'static'\n keyboard: false\n }\n```", "response": "// Load search autocomplete\n$scope.getSearchHints = function() {\n return tagService.getSearchHints(function(searchHints) {\n return $scope.search.hints = searchHints;\n });\n};\n\n$scope.canEdit = function(dashboard) {\n if (!$scope.isLoggedIn()) {\n return true;\n }\n if (dashboard != null) {\n return dashboard._canView;\n } else {\n return true;\n }\n};\n\n$scope.canDelete = function(dashboard) {\n if (!$scope.isLoggedIn()) {\n return false;\n }\n if (dashboard != null) {\n return dashboard._canEdit;\n } else {\n return true;\n }\n};\n\n$scope.loginAlert = function() {\n return alertify.error('Please login to enable', 2500);\n};\n\n$scope.loadDashboards = function() {\n var p;\n $scope.dashboards = null;\n if (!($scope.search.query.length > 0)) {\n return;\n }\n $scope.showSplash = false;\n $scope.loading = true;\n p = dashboardService.getDashboards($scope.search.query.join(','));\n p.then(function(dashboards) {\n $scope.dashboards = dashboards;\n $scope.updateDashboardVisits();\n $scope.updateDashboardPermissions();\n return $scope.loading = false;\n });\n return p.catch(function(response) {\n if (response.status === 500) {\n return $modal.open({\n templateUrl: '/partials/500.html',\n scope: $scope,\n controller: 'GenericErrorModalController',\n backdrop: 'static',\n keyboard: false\n });\n }\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 44, "line_end": 82} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Load search autocomplete\n$scope.getSearchHints = function() {\n return tagService.getSearchHints(function(searchHints) {\n return $scope.search.hints = searchHints;\n });\n};\n\n$scope.canEdit = function(dashboard) {\n if (!$scope.isLoggedIn()) {\n return true;\n }\n if (dashboard != null) {\n return dashboard._canView;\n } else {\n return true;\n }\n};\n\n$scope.canDelete = function(dashboard) {\n if (!$scope.isLoggedIn()) {\n return false;\n }\n if (dashboard != null) {\n return dashboard._canEdit;\n } else {\n return true;\n }\n};\n\n$scope.loginAlert = function() {\n return alertify.error('Please login to enable', 2500);\n};\n\n$scope.loadDashboards = function() {\n var p;\n $scope.dashboards = null;\n if (!($scope.search.query.length > 0)) {\n return;\n }\n $scope.showSplash = false;\n $scope.loading = true;\n p = dashboardService.getDashboards($scope.search.query.join(','));\n p.then(function(dashboards) {\n $scope.dashboards = dashboards;\n $scope.updateDashboardVisits();\n $scope.updateDashboardPermissions();\n return $scope.loading = false;\n });\n return p.catch(function(response) {\n if (response.status === 500) {\n return $modal.open({\n templateUrl: '/partials/500.html',\n scope: $scope,\n controller: 'GenericErrorModalController',\n backdrop: 'static',\n keyboard: false\n });\n }\n });\n};\n```", "response": "# Load search autocomplete\n $scope.getSearchHints = ->\n tagService.getSearchHints (searchHints) ->\n $scope.search.hints = searchHints\n\n $scope.canEdit = (dashboard) ->\n return true unless $scope.isLoggedIn()\n if dashboard? then dashboard._canView else true\n\n $scope.canDelete = (dashboard) ->\n return false unless $scope.isLoggedIn()\n if dashboard? then dashboard._canEdit else true\n\n $scope.loginAlert = ->\n alertify.error('Please login to enable', 2500)\n\n $scope.loadDashboards = ->\n $scope.dashboards = null\n return unless $scope.search.query.length > 0\n\n $scope.showSplash = false\n $scope.loading = true\n\n p = dashboardService.getDashboards $scope.search.query.join(',')\n p.then (dashboards) ->\n $scope.dashboards = dashboards\n $scope.updateDashboardVisits()\n $scope.updateDashboardPermissions()\n $scope.loading = false\n\n p.catch (response) ->\n if response.status == 500\n $modal.open {\n templateUrl: '/partials/500.html'\n scope: $scope\n controller: 'GenericErrorModalController'\n backdrop: 'static'\n keyboard: false\n }", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 44, "line_end": 82} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:2:completion", "type": "completion", "prompt": "# Load search autocomplete\n $scope.getSearchHints = ->\n tagService.getSearchHints (searchHints) ->\n $scope.search.hints = searchHints\n\n $scope.canEdit = (dashboard) ->\n return true unless $scope.isLoggedIn()\n if dashboard? then dashboard._canView else true\n\n $scope.canDelete = (dashboard) ->\n return false unless $scope.isLoggedIn()\n if dashboard? then dashboard._canEdit else true\n\n $scope.loginAlert = ->\n alertify.error('Please login to enable', 2500)\n\n $scope.loadDashboards = ->\n $scope.dashboards = null\n return unless $scope.search.query.length > 0", "response": "$scope.showSplash = false\n $scope.loading = true\n\n p = dashboardService.getDashboards $scope.search.query.join(',')\n p.then (dashboards) ->\n $scope.dashboards = dashboards\n $scope.updateDashboardVisits()\n $scope.updateDashboardPermissions()\n $scope.loading = false\n\n p.catch (response) ->\n if response.status == 500\n $modal.open {\n templateUrl: '/partials/500.html'\n scope: $scope\n controller: 'GenericErrorModalController'\n backdrop: 'static'\n keyboard: false\n }", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 44, "line_end": 82} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n controller: 'DeleteDashboardController'\n resolve: {\n dashboardName: -> dashboardName\n }\n }\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->\n _.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 122} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n controller: 'DeleteDashboardController'\n resolve: {\n dashboardName: -> dashboardName\n }\n }\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->\n _.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #\n```", "response": "$scope.updateDashboardVisits = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard.visitCategory = dashboardService.getVisitCategory(dashboard);\n });\n};\n\n$scope.updateDashboardPermissions = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard._canEdit = userService.hasEditPermission(dashboard);\n dashboard._canView = userService.hasViewPermission(dashboard);\n });\n};\n\n$scope.delete = function(dashboardName) {\n var modalInstance;\n // Confirmation dialog\n modalInstance = $modal.open({\n templateUrl: '/partials/editor/delete.html',\n controller: 'DeleteDashboardController',\n resolve: {\n dashboardName: function() {\n return dashboardName;\n }\n }\n });\n return modalInstance.result.then(function() {\n var q;\n q = dashboardService.delete(dashboardName);\n return q.then(function() {\n var tagIndex;\n _.remove($scope.dashboards, {\n name: dashboardName\n });\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName);\n if (tagIndex > -1) {\n return $scope.searchOptions.tags.splice(tagIndex, 1);\n }\n });\n });\n};\n\n$scope.loadQueryString = function(q) {\n return $scope.search.query = _.isEmpty(q) ? [] : _.uniq(q.split(','));\n};\n\n\n// Initialization", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 122} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n$scope.updateDashboardVisits = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard.visitCategory = dashboardService.getVisitCategory(dashboard);\n });\n};\n\n$scope.updateDashboardPermissions = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard._canEdit = userService.hasEditPermission(dashboard);\n dashboard._canView = userService.hasViewPermission(dashboard);\n });\n};\n\n$scope.delete = function(dashboardName) {\n var modalInstance;\n // Confirmation dialog\n modalInstance = $modal.open({\n templateUrl: '/partials/editor/delete.html',\n controller: 'DeleteDashboardController',\n resolve: {\n dashboardName: function() {\n return dashboardName;\n }\n }\n });\n return modalInstance.result.then(function() {\n var q;\n q = dashboardService.delete(dashboardName);\n return q.then(function() {\n var tagIndex;\n _.remove($scope.dashboards, {\n name: dashboardName\n });\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName);\n if (tagIndex > -1) {\n return $scope.searchOptions.tags.splice(tagIndex, 1);\n }\n });\n });\n};\n\n$scope.loadQueryString = function(q) {\n return $scope.search.query = _.isEmpty(q) ? [] : _.uniq(q.split(','));\n};\n\n\n// Initialization\n```", "response": "$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n controller: 'DeleteDashboardController'\n resolve: {\n dashboardName: -> dashboardName\n }\n }\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->\n _.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 122} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:completion", "type": "completion", "prompt": "$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n controller: 'DeleteDashboardController'\n resolve: {\n dashboardName: -> dashboardName\n }", "response": "}\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->\n _.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 122} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()\n\n # Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)\n\n if _.isEmpty query\n $location.search 'q', null\n $scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 124, "line_end": 161} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()\n\n # Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)\n\n if _.isEmpty query\n $location.search 'q', null\n $scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)\n```", "response": "// Parse query params / default to none\nvar q, ref;\n\nq = (ref = $location.search()) != null ? ref.q : void 0;\n\nif ((q != null) && q.length > 0) {\n $scope.loadQueryString(q);\n $scope.loadDashboards();\n}\n\n// Load all tags\ntagService.getTags(function(tags) {\n $scope.search.allTags = tags;\n // Reload the query search after loading tags\n // This will enable tag icons in search terms (if they are tags)\n if ((q != null) && q.length > 0) {\n $scope.loadQueryString(q);\n }\n // Watch for Search changes\n return $scope.$watch('search.query', function(query, oldQuery) {\n if (!_.isArray(query)) {\n return;\n }\n if (_.isEqual(query, oldQuery)) {\n return;\n }\n if (_.isEmpty(query)) {\n $location.search('q', null);\n $scope.showSplash = true;\n } else {\n $location.search('q', query.join(','));\n }\n return $scope.loadDashboards();\n });\n});\n\n// Load search hints\n$scope.getSearchHints();\n\n// Update displayed permissions after logging in/out\n$scope.$watch('isLoggedIn()', $scope.updateDashboardPermissions);\n\n// Update search.query after using the back/forward buttons\n$scope.$watch((function() {\n return $location.search();\n}), function(newSearch, oldSearch) {\n if (_.isEqual(newSearch.q, oldSearch, q)) {\n return;\n }\n return $scope.loadQueryString(newSearch.q);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 124, "line_end": 161} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Parse query params / default to none\nvar q, ref;\n\nq = (ref = $location.search()) != null ? ref.q : void 0;\n\nif ((q != null) && q.length > 0) {\n $scope.loadQueryString(q);\n $scope.loadDashboards();\n}\n\n// Load all tags\ntagService.getTags(function(tags) {\n $scope.search.allTags = tags;\n // Reload the query search after loading tags\n // This will enable tag icons in search terms (if they are tags)\n if ((q != null) && q.length > 0) {\n $scope.loadQueryString(q);\n }\n // Watch for Search changes\n return $scope.$watch('search.query', function(query, oldQuery) {\n if (!_.isArray(query)) {\n return;\n }\n if (_.isEqual(query, oldQuery)) {\n return;\n }\n if (_.isEmpty(query)) {\n $location.search('q', null);\n $scope.showSplash = true;\n } else {\n $location.search('q', query.join(','));\n }\n return $scope.loadDashboards();\n });\n});\n\n// Load search hints\n$scope.getSearchHints();\n\n// Update displayed permissions after logging in/out\n$scope.$watch('isLoggedIn()', $scope.updateDashboardPermissions);\n\n// Update search.query after using the back/forward buttons\n$scope.$watch((function() {\n return $location.search();\n}), function(newSearch, oldSearch) {\n if (_.isEqual(newSearch.q, oldSearch, q)) {\n return;\n }\n return $scope.loadQueryString(newSearch.q);\n});\n```", "response": "# Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()\n\n # Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)\n\n if _.isEmpty query\n $location.search 'q', null\n $scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 124, "line_end": 161} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:completion", "type": "completion", "prompt": "# Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()\n\n # Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)", "response": "if _.isEmpty query\n $location.search 'q', null\n $scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "00fd9d26c0087b1b9f6594821d39d030056c9faf", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/00fd9d26c0087b1b9f6594821d39d030056c9faf/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 124, "line_end": 161} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n scope: $scope\n }\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->\n _.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #\n\n # Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 125} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n scope: $scope\n }\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->\n _.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #\n\n # Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()\n```", "response": "var q, ref;\n\n$scope.updateDashboardVisits = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard.visitCategory = dashboardService.getVisitCategory(dashboard);\n });\n};\n\n$scope.updateDashboardPermissions = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard._canEdit = userService.hasEditPermission(dashboard);\n dashboard._canView = userService.hasViewPermission(dashboard);\n });\n};\n\n$scope.delete = function(dashboardName) {\n var modalInstance;\n // Confirmation dialog\n modalInstance = $modal.open({\n templateUrl: '/partials/editor/delete.html',\n scope: $scope\n });\n return modalInstance.result.then(function() {\n var q;\n q = dashboardService.delete(dashboardName);\n return q.then(function() {\n var tagIndex;\n _.remove($scope.dashboards, {\n name: dashboardName\n });\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName);\n if (tagIndex > -1) {\n return $scope.searchOptions.tags.splice(tagIndex, 1);\n }\n });\n });\n};\n\n$scope.loadQueryString = function(q) {\n return $scope.search.query = _.isEmpty(q) ? [] : _.uniq(q.split(','));\n};\n\n\n// Initialization\n\n// Parse query params / default to none\nq = (ref = $location.search()) != null ? ref.q : void 0;\n\nif ((q != null) && q.length > 0) {\n $scope.loadQueryString(q);\n $scope.loadDashboards();\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 125} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar q, ref;\n\n$scope.updateDashboardVisits = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard.visitCategory = dashboardService.getVisitCategory(dashboard);\n });\n};\n\n$scope.updateDashboardPermissions = function() {\n return _.each($scope.dashboards, function(dashboard) {\n dashboard._canEdit = userService.hasEditPermission(dashboard);\n dashboard._canView = userService.hasViewPermission(dashboard);\n });\n};\n\n$scope.delete = function(dashboardName) {\n var modalInstance;\n // Confirmation dialog\n modalInstance = $modal.open({\n templateUrl: '/partials/editor/delete.html',\n scope: $scope\n });\n return modalInstance.result.then(function() {\n var q;\n q = dashboardService.delete(dashboardName);\n return q.then(function() {\n var tagIndex;\n _.remove($scope.dashboards, {\n name: dashboardName\n });\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName);\n if (tagIndex > -1) {\n return $scope.searchOptions.tags.splice(tagIndex, 1);\n }\n });\n });\n};\n\n$scope.loadQueryString = function(q) {\n return $scope.search.query = _.isEmpty(q) ? [] : _.uniq(q.split(','));\n};\n\n\n// Initialization\n\n// Parse query params / default to none\nq = (ref = $location.search()) != null ? ref.q : void 0;\n\nif ((q != null) && q.length > 0) {\n $scope.loadQueryString(q);\n $scope.loadDashboards();\n}\n```", "response": "$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n scope: $scope\n }\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->\n _.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #\n\n # Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 125} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:3:completion", "type": "completion", "prompt": "$scope.updateDashboardVisits = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard.visitCategory = dashboardService.getVisitCategory dashboard\n return\n\n $scope.updateDashboardPermissions = ->\n _.each $scope.dashboards, (dashboard) ->\n dashboard._canEdit = userService.hasEditPermission dashboard\n dashboard._canView = userService.hasViewPermission dashboard\n return\n\n $scope.delete = (dashboardName) ->\n # Confirmation dialog\n modalInstance = $modal.open {\n templateUrl: '/partials/editor/delete.html'\n scope: $scope\n }\n\n modalInstance.result.then ->\n q = dashboardService.delete(dashboardName)\n q.then ->", "response": "_.remove $scope.dashboards, { name: dashboardName }\n\n tagIndex = $scope.searchOptions.tags.indexOf(dashboardName)\n if (tagIndex > -1)\n $scope.searchOptions.tags.splice(tagIndex, 1);\n\n $scope.loadQueryString = (q) ->\n $scope.search.query = if _.isEmpty q\n []\n else\n _.uniq q.split(',')\n\n #\n # Initialization\n #\n\n # Parse query params / default to none\n q = $location.search()?.q\n if q? and q.length > 0\n $scope.loadQueryString(q)\n $scope.loadDashboards()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 84, "line_end": 125} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)\n\n if _.isEmpty query\n $location.search 'q', null\n $scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 127, "line_end": 158} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)\n\n if _.isEmpty query\n $location.search 'q', null\n $scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)\n```", "response": "// Load all tags\ntagService.getTags(function(tags) {\n $scope.search.allTags = tags;\n // Reload the query search after loading tags\n // This will enable tag icons in search terms (if they are tags)\n if ((typeof q !== \"undefined\" && q !== null) && q.length > 0) {\n $scope.loadQueryString(q);\n }\n // Watch for Search changes\n return $scope.$watch('search.query', function(query, oldQuery) {\n if (!_.isArray(query)) {\n return;\n }\n if (_.isEqual(query, oldQuery)) {\n return;\n }\n if (_.isEmpty(query)) {\n $location.search('q', null);\n $scope.showSplash = true;\n } else {\n $location.search('q', query.join(','));\n }\n return $scope.loadDashboards();\n });\n});\n\n// Load search hints\n$scope.getSearchHints();\n\n// Update displayed permissions after logging in/out\n$scope.$watch('isLoggedIn()', $scope.updateDashboardPermissions);\n\n// Update search.query after using the back/forward buttons\n$scope.$watch((function() {\n return $location.search();\n}), function(newSearch, oldSearch) {\n if (_.isEqual(newSearch.q, oldSearch, q)) {\n return;\n }\n return $scope.loadQueryString(newSearch.q);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 127, "line_end": 158} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// Load all tags\ntagService.getTags(function(tags) {\n $scope.search.allTags = tags;\n // Reload the query search after loading tags\n // This will enable tag icons in search terms (if they are tags)\n if ((typeof q !== \"undefined\" && q !== null) && q.length > 0) {\n $scope.loadQueryString(q);\n }\n // Watch for Search changes\n return $scope.$watch('search.query', function(query, oldQuery) {\n if (!_.isArray(query)) {\n return;\n }\n if (_.isEqual(query, oldQuery)) {\n return;\n }\n if (_.isEmpty(query)) {\n $location.search('q', null);\n $scope.showSplash = true;\n } else {\n $location.search('q', query.join(','));\n }\n return $scope.loadDashboards();\n });\n});\n\n// Load search hints\n$scope.getSearchHints();\n\n// Update displayed permissions after logging in/out\n$scope.$watch('isLoggedIn()', $scope.updateDashboardPermissions);\n\n// Update search.query after using the back/forward buttons\n$scope.$watch((function() {\n return $location.search();\n}), function(newSearch, oldSearch) {\n if (_.isEqual(newSearch.q, oldSearch, q)) {\n return;\n }\n return $scope.loadQueryString(newSearch.q);\n});\n```", "response": "# Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)\n\n if _.isEmpty query\n $location.search 'q', null\n $scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 127, "line_end": 158} {"id": "ExpediaGroup/cyclotron:cyclotron-site/app/scripts/mgmt/controller.home.coffee:4:completion", "type": "completion", "prompt": "# Load all tags\n tagService.getTags (tags) ->\n $scope.search.allTags = tags\n\n # Reload the query search after loading tags\n # This will enable tag icons in search terms (if they are tags)\n if q? and q.length > 0\n $scope.loadQueryString(q)\n\n # Watch for Search changes\n $scope.$watch 'search.query', (query, oldQuery) ->\n return unless _.isArray query\n return if _.isEqual(query, oldQuery)\n\n if _.isEmpty query\n $location.search 'q', null", "response": "$scope.showSplash = true\n else\n $location.search 'q', query.join(',')\n\n $scope.loadDashboards()\n\n # Load search hints\n $scope.getSearchHints()\n\n # Update displayed permissions after logging in/out\n $scope.$watch 'isLoggedIn()', $scope.updateDashboardPermissions\n\n # Update search.query after using the back/forward buttons\n $scope.$watch (-> $location.search()), (newSearch, oldSearch) ->\n return if _.isEqual newSearch.q, oldSearch,q\n $scope.loadQueryString(newSearch.q)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "ExpediaGroup/cyclotron", "path": "cyclotron-site/app/scripts/mgmt/controller.home.coffee", "license": "MIT", "commit": "14b0e411415be801f94fe13ea6f63d5ad957c2ed", "stars": 1544, "source_url": "https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/scripts/mgmt/controller.home.coffee", "line_start": 127, "line_end": 158} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = React.createClass\n displayName: 'inte-manager'\n mixins: [mixinSubscribe, PureRenderMixin]\n\n propTypes:\n _teamId: T.string.isRequired\n _roomId: T.string.isRequired\n onEdit: T.func.isRequired\n settings: T.instanceOf(Immutable.List).isRequired\n\n getInitialState: ->\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n query: ''\n\n componentDidMount: ->\n @subscribe recorder, =>\n @setState\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n\n getIntes: ->\n query.intesBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n getTopics: ->\n query.topicsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n getContacts: ->\n query.contactsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n detectShowRobot: (service) ->\n category = service.get('category')\n usingSetting = @props.settings.find (setting) ->\n setting.get('name') is category\n if usingSetting?\n usingSetting.get('showRobot')\n else false\n\n onInteEdit: (data) ->\n @props.onEdit data\n\n onQueryChange: (value) ->\n @setState query: value\n\n renderIntegrations: (integrations) ->\n Transition transitionName: 'fade', enterTimeout: 200, leaveTimeout: 350,\n integrations.map (service) =>\n showRobot = @detectShowRobot service", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 26, "line_end": 75} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = React.createClass\n displayName: 'inte-manager'\n mixins: [mixinSubscribe, PureRenderMixin]\n\n propTypes:\n _teamId: T.string.isRequired\n _roomId: T.string.isRequired\n onEdit: T.func.isRequired\n settings: T.instanceOf(Immutable.List).isRequired\n\n getInitialState: ->\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n query: ''\n\n componentDidMount: ->\n @subscribe recorder, =>\n @setState\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n\n getIntes: ->\n query.intesBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n getTopics: ->\n query.topicsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n getContacts: ->\n query.contactsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n detectShowRobot: (service) ->\n category = service.get('category')\n usingSetting = @props.settings.find (setting) ->\n setting.get('name') is category\n if usingSetting?\n usingSetting.get('showRobot')\n else false\n\n onInteEdit: (data) ->\n @props.onEdit data\n\n onQueryChange: (value) ->\n @setState query: value\n\n renderIntegrations: (integrations) ->\n Transition transitionName: 'fade', enterTimeout: 200, leaveTimeout: 350,\n integrations.map (service) =>\n showRobot = @detectShowRobot service\n```", "response": "module.exports = React.createClass({\n displayName: 'inte-manager',\n mixins: [mixinSubscribe, PureRenderMixin],\n propTypes: {\n _teamId: T.string.isRequired,\n _roomId: T.string.isRequired,\n onEdit: T.func.isRequired,\n settings: T.instanceOf(Immutable.List).isRequired\n },\n getInitialState: function() {\n return {\n integrations: this.getIntes(),\n topics: this.getTopics(),\n contacts: this.getContacts(),\n query: ''\n };\n },\n componentDidMount: function() {\n return this.subscribe(recorder, () => {\n return this.setState({\n integrations: this.getIntes(),\n topics: this.getTopics(),\n contacts: this.getContacts()\n });\n });\n },\n getIntes: function() {\n return query.intesBy(recorder.getState(), this.props._teamId) || Immutable.List();\n },\n getTopics: function() {\n return query.topicsBy(recorder.getState(), this.props._teamId) || Immutable.List();\n },\n getContacts: function() {\n return query.contactsBy(recorder.getState(), this.props._teamId) || Immutable.List();\n },\n detectShowRobot: function(service) {\n var category, usingSetting;\n category = service.get('category');\n usingSetting = this.props.settings.find(function(setting) {\n return setting.get('name') === category;\n });\n if (usingSetting != null) {\n return usingSetting.get('showRobot');\n } else {\n return false;\n }\n },\n onInteEdit: function(data) {\n return this.props.onEdit(data);\n },\n onQueryChange: function(value) {\n return this.setState({\n query: value\n });\n },\n renderIntegrations: function(integrations) {\n return Transition({\n transitionName: 'fade',\n enterTimeout: 200,\n leaveTimeout: 350\n }, integrations.map((service) => {\n var showRobot;\n return showRobot = this.detectShowRobot(service);\n }));\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 26, "line_end": 75} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = React.createClass({\n displayName: 'inte-manager',\n mixins: [mixinSubscribe, PureRenderMixin],\n propTypes: {\n _teamId: T.string.isRequired,\n _roomId: T.string.isRequired,\n onEdit: T.func.isRequired,\n settings: T.instanceOf(Immutable.List).isRequired\n },\n getInitialState: function() {\n return {\n integrations: this.getIntes(),\n topics: this.getTopics(),\n contacts: this.getContacts(),\n query: ''\n };\n },\n componentDidMount: function() {\n return this.subscribe(recorder, () => {\n return this.setState({\n integrations: this.getIntes(),\n topics: this.getTopics(),\n contacts: this.getContacts()\n });\n });\n },\n getIntes: function() {\n return query.intesBy(recorder.getState(), this.props._teamId) || Immutable.List();\n },\n getTopics: function() {\n return query.topicsBy(recorder.getState(), this.props._teamId) || Immutable.List();\n },\n getContacts: function() {\n return query.contactsBy(recorder.getState(), this.props._teamId) || Immutable.List();\n },\n detectShowRobot: function(service) {\n var category, usingSetting;\n category = service.get('category');\n usingSetting = this.props.settings.find(function(setting) {\n return setting.get('name') === category;\n });\n if (usingSetting != null) {\n return usingSetting.get('showRobot');\n } else {\n return false;\n }\n },\n onInteEdit: function(data) {\n return this.props.onEdit(data);\n },\n onQueryChange: function(value) {\n return this.setState({\n query: value\n });\n },\n renderIntegrations: function(integrations) {\n return Transition({\n transitionName: 'fade',\n enterTimeout: 200,\n leaveTimeout: 350\n }, integrations.map((service) => {\n var showRobot;\n return showRobot = this.detectShowRobot(service);\n }));\n }\n});\n```", "response": "module.exports = React.createClass\n displayName: 'inte-manager'\n mixins: [mixinSubscribe, PureRenderMixin]\n\n propTypes:\n _teamId: T.string.isRequired\n _roomId: T.string.isRequired\n onEdit: T.func.isRequired\n settings: T.instanceOf(Immutable.List).isRequired\n\n getInitialState: ->\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n query: ''\n\n componentDidMount: ->\n @subscribe recorder, =>\n @setState\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n\n getIntes: ->\n query.intesBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n getTopics: ->\n query.topicsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n getContacts: ->\n query.contactsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n detectShowRobot: (service) ->\n category = service.get('category')\n usingSetting = @props.settings.find (setting) ->\n setting.get('name') is category\n if usingSetting?\n usingSetting.get('showRobot')\n else false\n\n onInteEdit: (data) ->\n @props.onEdit data\n\n onQueryChange: (value) ->\n @setState query: value\n\n renderIntegrations: (integrations) ->\n Transition transitionName: 'fade', enterTimeout: 200, leaveTimeout: 350,\n integrations.map (service) =>\n showRobot = @detectShowRobot service", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 26, "line_end": 75} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:1:completion", "type": "completion", "prompt": "module.exports = React.createClass\n displayName: 'inte-manager'\n mixins: [mixinSubscribe, PureRenderMixin]\n\n propTypes:\n _teamId: T.string.isRequired\n _roomId: T.string.isRequired\n onEdit: T.func.isRequired\n settings: T.instanceOf(Immutable.List).isRequired\n\n getInitialState: ->\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n query: ''\n\n componentDidMount: ->\n @subscribe recorder, =>\n @setState\n integrations: @getIntes()\n topics: @getTopics()\n contacts: @getContacts()\n\n getIntes: ->\n query.intesBy(recorder.getState(), @props._teamId) or Immutable.List()", "response": "getTopics: ->\n query.topicsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n getContacts: ->\n query.contactsBy(recorder.getState(), @props._teamId) or Immutable.List()\n\n detectShowRobot: (service) ->\n category = service.get('category')\n usingSetting = @props.settings.find (setting) ->\n setting.get('name') is category\n if usingSetting?\n usingSetting.get('showRobot')\n else false\n\n onInteEdit: (data) ->\n @props.onEdit data\n\n onQueryChange: (value) ->\n @setState query: value\n\n renderIntegrations: (integrations) ->\n Transition transitionName: 'fade', enterTimeout: 200, leaveTimeout: 350,\n integrations.map (service) =>\n showRobot = @detectShowRobot service", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 26, "line_end": 75} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "InteItem key: service.get('_id'), data: service, onClick: @onInteEdit, showRobot: showRobot\n\n renderGroup: (group) ->\n div key: group.getIn(['room', '_id']),\n div className: 'topic short',\n '#'\n TopicCorrection\n topic: group.get('room')\n div className: 'service',\n @renderIntegrations group.get('integrations')\n\n render: ->\n _userId = query.userId(recorder.getState())\n userContact = @state.contacts.find (contact) ->\n contact.get('_id') is _userId\n isAdmin = userContact?.get('role') in ['owner', 'admin']\n searchLocale = lang.getText('find-by-name-or-service')\n\n integrations = search.inteItems @state.integrations, @state.query, @state.topics\n modifiedIntes = integrations.map (inte) ->\n inte.set 'canEdit', (inte.get('_creatorId') is _userId) or isAdmin\n\n integrationRobot = modifiedIntes.filter (inte) ->\n inte.get('robot')?\n integrationWithoutRobot = modifiedIntes.filterNot (inte) ->\n inte.get('robot')?\n\n integrationData = integrationWithoutRobot.groupBy (inte) ->\n inte.get('_roomId')\n integrationData = integrationData.map (list, _roomId) =>\n Immutable.fromJS\n room: @state.topics.find (topic) -> topic.get('_id') is _roomId\n integrations: list\n # integrations of private topic may cause bug\n integrationData = integrationData.filter (group) ->\n group.get('room')?\n\n currentGroup = integrationData.filter (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n otherGroups = integrationData.filterNot (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n\n div className: 'inte-manager lm-content',\n div className: 'filter',\n LiteSearchBox value: @state.query, onChange: @onQueryChange, locale: searchLocale, autoFocus: false\n\n if @props._roomId?\n if currentGroup.get(@props._roomId)?\n @renderGroup currentGroup.get(@props._roomId)\n else", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 76, "line_end": 125} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nInteItem key: service.get('_id'), data: service, onClick: @onInteEdit, showRobot: showRobot\n\n renderGroup: (group) ->\n div key: group.getIn(['room', '_id']),\n div className: 'topic short',\n '#'\n TopicCorrection\n topic: group.get('room')\n div className: 'service',\n @renderIntegrations group.get('integrations')\n\n render: ->\n _userId = query.userId(recorder.getState())\n userContact = @state.contacts.find (contact) ->\n contact.get('_id') is _userId\n isAdmin = userContact?.get('role') in ['owner', 'admin']\n searchLocale = lang.getText('find-by-name-or-service')\n\n integrations = search.inteItems @state.integrations, @state.query, @state.topics\n modifiedIntes = integrations.map (inte) ->\n inte.set 'canEdit', (inte.get('_creatorId') is _userId) or isAdmin\n\n integrationRobot = modifiedIntes.filter (inte) ->\n inte.get('robot')?\n integrationWithoutRobot = modifiedIntes.filterNot (inte) ->\n inte.get('robot')?\n\n integrationData = integrationWithoutRobot.groupBy (inte) ->\n inte.get('_roomId')\n integrationData = integrationData.map (list, _roomId) =>\n Immutable.fromJS\n room: @state.topics.find (topic) -> topic.get('_id') is _roomId\n integrations: list\n # integrations of private topic may cause bug\n integrationData = integrationData.filter (group) ->\n group.get('room')?\n\n currentGroup = integrationData.filter (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n otherGroups = integrationData.filterNot (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n\n div className: 'inte-manager lm-content',\n div className: 'filter',\n LiteSearchBox value: @state.query, onChange: @onQueryChange, locale: searchLocale, autoFocus: false\n\n if @props._roomId?\n if currentGroup.get(@props._roomId)?\n @renderGroup currentGroup.get(@props._roomId)\n else\n```", "response": "InteItem({\n key: service.get('_id'),\n data: service,\n onClick: this.onInteEdit,\n showRobot: showRobot({\n renderGroup: function(group) {\n return div({\n key: group.getIn(['room', '_id'])\n }, div({\n className: 'topic short'\n }, '#', TopicCorrection({\n topic: group.get('room')\n })), div({\n className: 'service'\n }, this.renderIntegrations(group.get('integrations'))));\n },\n render: function() {\n var _userId, currentGroup, integrationData, integrationRobot, integrationWithoutRobot, integrations, isAdmin, modifiedIntes, otherGroups, ref, searchLocale, userContact;\n _userId = query.userId(recorder.getState());\n userContact = this.state.contacts.find(function(contact) {\n return contact.get('_id') === _userId;\n });\n isAdmin = (ref = userContact != null ? userContact.get('role') : void 0) === 'owner' || ref === 'admin';\n searchLocale = lang.getText('find-by-name-or-service');\n integrations = search.inteItems(this.state.integrations, this.state.query, this.state.topics);\n modifiedIntes = integrations.map(function(inte) {\n return inte.set('canEdit', (inte.get('_creatorId') === _userId) || isAdmin);\n });\n integrationRobot = modifiedIntes.filter(function(inte) {\n return inte.get('robot') != null;\n });\n integrationWithoutRobot = modifiedIntes.filterNot(function(inte) {\n return inte.get('robot') != null;\n });\n integrationData = integrationWithoutRobot.groupBy(function(inte) {\n return inte.get('_roomId');\n });\n integrationData = integrationData.map((list, _roomId) => {\n return Immutable.fromJS({\n room: this.state.topics.find(function(topic) {\n return topic.get('_id') === _roomId;\n }),\n integrations: list\n });\n });\n // integrations of private topic may cause bug\n integrationData = integrationData.filter(function(group) {\n return group.get('room') != null;\n });\n currentGroup = integrationData.filter((data) => {\n return data.getIn(['room', '_id']) === this.props._roomId;\n });\n otherGroups = integrationData.filterNot((data) => {\n return data.getIn(['room', '_id']) === this.props._roomId;\n });\n return div({\n className: 'inte-manager lm-content'\n }, div({\n className: 'filter'\n }, LiteSearchBox({\n value: this.state.query,\n onChange: this.onQueryChange,\n locale: searchLocale,\n autoFocus: false\n })), this.props._roomId != null ? currentGroup.get(this.props._roomId) != null ? this.renderGroup(currentGroup.get(this.props._roomId)) : void 0 : void 0);\n }\n })\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 76, "line_end": 125} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nInteItem({\n key: service.get('_id'),\n data: service,\n onClick: this.onInteEdit,\n showRobot: showRobot({\n renderGroup: function(group) {\n return div({\n key: group.getIn(['room', '_id'])\n }, div({\n className: 'topic short'\n }, '#', TopicCorrection({\n topic: group.get('room')\n })), div({\n className: 'service'\n }, this.renderIntegrations(group.get('integrations'))));\n },\n render: function() {\n var _userId, currentGroup, integrationData, integrationRobot, integrationWithoutRobot, integrations, isAdmin, modifiedIntes, otherGroups, ref, searchLocale, userContact;\n _userId = query.userId(recorder.getState());\n userContact = this.state.contacts.find(function(contact) {\n return contact.get('_id') === _userId;\n });\n isAdmin = (ref = userContact != null ? userContact.get('role') : void 0) === 'owner' || ref === 'admin';\n searchLocale = lang.getText('find-by-name-or-service');\n integrations = search.inteItems(this.state.integrations, this.state.query, this.state.topics);\n modifiedIntes = integrations.map(function(inte) {\n return inte.set('canEdit', (inte.get('_creatorId') === _userId) || isAdmin);\n });\n integrationRobot = modifiedIntes.filter(function(inte) {\n return inte.get('robot') != null;\n });\n integrationWithoutRobot = modifiedIntes.filterNot(function(inte) {\n return inte.get('robot') != null;\n });\n integrationData = integrationWithoutRobot.groupBy(function(inte) {\n return inte.get('_roomId');\n });\n integrationData = integrationData.map((list, _roomId) => {\n return Immutable.fromJS({\n room: this.state.topics.find(function(topic) {\n return topic.get('_id') === _roomId;\n }),\n integrations: list\n });\n });\n // integrations of private topic may cause bug\n integrationData = integrationData.filter(function(group) {\n return group.get('room') != null;\n });\n currentGroup = integrationData.filter((data) => {\n return data.getIn(['room', '_id']) === this.props._roomId;\n });\n otherGroups = integrationData.filterNot((data) => {\n return data.getIn(['room', '_id']) === this.props._roomId;\n });\n return div({\n className: 'inte-manager lm-content'\n }, div({\n className: 'filter'\n }, LiteSearchBox({\n value: this.state.query,\n onChange: this.onQueryChange,\n locale: searchLocale,\n autoFocus: false\n })), this.props._roomId != null ? currentGroup.get(this.props._roomId) != null ? this.renderGroup(currentGroup.get(this.props._roomId)) : void 0 : void 0);\n }\n })\n});\n```", "response": "InteItem key: service.get('_id'), data: service, onClick: @onInteEdit, showRobot: showRobot\n\n renderGroup: (group) ->\n div key: group.getIn(['room', '_id']),\n div className: 'topic short',\n '#'\n TopicCorrection\n topic: group.get('room')\n div className: 'service',\n @renderIntegrations group.get('integrations')\n\n render: ->\n _userId = query.userId(recorder.getState())\n userContact = @state.contacts.find (contact) ->\n contact.get('_id') is _userId\n isAdmin = userContact?.get('role') in ['owner', 'admin']\n searchLocale = lang.getText('find-by-name-or-service')\n\n integrations = search.inteItems @state.integrations, @state.query, @state.topics\n modifiedIntes = integrations.map (inte) ->\n inte.set 'canEdit', (inte.get('_creatorId') is _userId) or isAdmin\n\n integrationRobot = modifiedIntes.filter (inte) ->\n inte.get('robot')?\n integrationWithoutRobot = modifiedIntes.filterNot (inte) ->\n inte.get('robot')?\n\n integrationData = integrationWithoutRobot.groupBy (inte) ->\n inte.get('_roomId')\n integrationData = integrationData.map (list, _roomId) =>\n Immutable.fromJS\n room: @state.topics.find (topic) -> topic.get('_id') is _roomId\n integrations: list\n # integrations of private topic may cause bug\n integrationData = integrationData.filter (group) ->\n group.get('room')?\n\n currentGroup = integrationData.filter (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n otherGroups = integrationData.filterNot (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n\n div className: 'inte-manager lm-content',\n div className: 'filter',\n LiteSearchBox value: @state.query, onChange: @onQueryChange, locale: searchLocale, autoFocus: false\n\n if @props._roomId?\n if currentGroup.get(@props._roomId)?\n @renderGroup currentGroup.get(@props._roomId)\n else", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 76, "line_end": 125} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:2:completion", "type": "completion", "prompt": "InteItem key: service.get('_id'), data: service, onClick: @onInteEdit, showRobot: showRobot\n\n renderGroup: (group) ->\n div key: group.getIn(['room', '_id']),\n div className: 'topic short',\n '#'\n TopicCorrection\n topic: group.get('room')\n div className: 'service',\n @renderIntegrations group.get('integrations')\n\n render: ->\n _userId = query.userId(recorder.getState())\n userContact = @state.contacts.find (contact) ->\n contact.get('_id') is _userId\n isAdmin = userContact?.get('role') in ['owner', 'admin']\n searchLocale = lang.getText('find-by-name-or-service')\n\n integrations = search.inteItems @state.integrations, @state.query, @state.topics\n modifiedIntes = integrations.map (inte) ->\n inte.set 'canEdit', (inte.get('_creatorId') is _userId) or isAdmin\n\n integrationRobot = modifiedIntes.filter (inte) ->\n inte.get('robot')?\n integrationWithoutRobot = modifiedIntes.filterNot (inte) ->", "response": "inte.get('robot')?\n\n integrationData = integrationWithoutRobot.groupBy (inte) ->\n inte.get('_roomId')\n integrationData = integrationData.map (list, _roomId) =>\n Immutable.fromJS\n room: @state.topics.find (topic) -> topic.get('_id') is _roomId\n integrations: list\n # integrations of private topic may cause bug\n integrationData = integrationData.filter (group) ->\n group.get('room')?\n\n currentGroup = integrationData.filter (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n otherGroups = integrationData.filterNot (data) =>\n data.getIn(['room', '_id']) is @props._roomId\n\n div className: 'inte-manager lm-content',\n div className: 'filter',\n LiteSearchBox value: @state.query, onChange: @onQueryChange, locale: searchLocale, autoFocus: false\n\n if @props._roomId?\n if currentGroup.get(@props._roomId)?\n @renderGroup currentGroup.get(@props._roomId)\n else", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 76, "line_end": 125} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "div null,\n div className: 'muted service-empty', lang.getText('current-service-empty')\n hr className: 'divider-thin'\n\n div className: 'modal-paragraph',\n if integrationRobot.get(0)?\n div null,\n div className: 'topic short', lang.getText('custom-robot')\n div className: 'service',\n @renderIntegrations integrationRobot\n if otherGroups.size > 0\n otherGroups\n .map (group) => @renderGroup group\n .toList()\n else\n div className: 'muted service-empty', lang.getText('service-empty')", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 126, "line_end": 141} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\ndiv null,\n div className: 'muted service-empty', lang.getText('current-service-empty')\n hr className: 'divider-thin'\n\n div className: 'modal-paragraph',\n if integrationRobot.get(0)?\n div null,\n div className: 'topic short', lang.getText('custom-robot')\n div className: 'service',\n @renderIntegrations integrationRobot\n if otherGroups.size > 0\n otherGroups\n .map (group) => @renderGroup group\n .toList()\n else\n div className: 'muted service-empty', lang.getText('service-empty')\n```", "response": "div(null, div({\n className: 'muted service-empty'\n}, lang.getText('current-service-empty')), hr({\n className: 'divider-thin'\n}));\n\ndiv({\n className: 'modal-paragraph'\n}, integrationRobot.get(0) != null ? div(null, div({\n className: 'topic short'\n}, lang.getText('custom-robot')), div({\n className: 'service'\n}, this.renderIntegrations(integrationRobot))) : void 0, otherGroups.size > 0 ? otherGroups.map((group) => {\n return this.renderGroup(group);\n}).toList() : div({\n className: 'muted service-empty'\n}, lang.getText('service-empty')));", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 126, "line_end": 141} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\ndiv(null, div({\n className: 'muted service-empty'\n}, lang.getText('current-service-empty')), hr({\n className: 'divider-thin'\n}));\n\ndiv({\n className: 'modal-paragraph'\n}, integrationRobot.get(0) != null ? div(null, div({\n className: 'topic short'\n}, lang.getText('custom-robot')), div({\n className: 'service'\n}, this.renderIntegrations(integrationRobot))) : void 0, otherGroups.size > 0 ? otherGroups.map((group) => {\n return this.renderGroup(group);\n}).toList() : div({\n className: 'muted service-empty'\n}, lang.getText('service-empty')));\n```", "response": "div null,\n div className: 'muted service-empty', lang.getText('current-service-empty')\n hr className: 'divider-thin'\n\n div className: 'modal-paragraph',\n if integrationRobot.get(0)?\n div null,\n div className: 'topic short', lang.getText('custom-robot')\n div className: 'service',\n @renderIntegrations integrationRobot\n if otherGroups.size > 0\n otherGroups\n .map (group) => @renderGroup group\n .toList()\n else\n div className: 'muted service-empty', lang.getText('service-empty')", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 126, "line_end": 141} {"id": "jianliaoim/talk-os:talk-web/client/app/inte-manager.coffee:3:completion", "type": "completion", "prompt": "div null,\n div className: 'muted service-empty', lang.getText('current-service-empty')\n hr className: 'divider-thin'\n\n div className: 'modal-paragraph',\n if integrationRobot.get(0)?\n div null,\n div className: 'topic short', lang.getText('custom-robot')", "response": "div className: 'service',\n @renderIntegrations integrationRobot\n if otherGroups.size > 0\n otherGroups\n .map (group) => @renderGroup group\n .toList()\n else\n div className: 'muted service-empty', lang.getText('service-empty')", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-web/client/app/inte-manager.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-manager.coffee", "line_start": 126, "line_end": 141} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->\n```", "response": "var _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-clean\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).union(config.enableSass ? [\"grunt-sass\"] : void 0).union(config.enableAssetFingerprint ? [\"grunt-asset-fingerprint\"] : void 0).union(config.loadNpmTasks).compact().value();\n return _.each(npmTasks, function(taskName) {});\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-clean\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).union(config.enableSass ? [\"grunt-sass\"] : void 0).union(config.enableAssetFingerprint ? [\"grunt-asset-fingerprint\"] : void 0).union(config.loadNpmTasks).compact().value();\n return _.each(npmTasks, function(taskName) {});\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]", "response": "loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "11ff3633ffd8c2bb055376cda0faf45f4d24728d", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/11ff3633ffd8c2bb055376cda0faf45f4d24728d/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->\n```", "response": "var _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-clean\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).union(config.enableSass ? [\"grunt-sass\"] : void 0).union(config.enableAssetFingerprint ? [\"grunt-asset-fingerprint\"] : void 0).union(config.loadNpmTasks).compact().value();\n return _.each(npmTasks, function(taskName) {});\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "11ff3633ffd8c2bb055376cda0faf45f4d24728d", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/11ff3633ffd8c2bb055376cda0faf45f4d24728d/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-clean\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).union(config.enableSass ? [\"grunt-sass\"] : void 0).union(config.enableAssetFingerprint ? [\"grunt-asset-fingerprint\"] : void 0).union(config.loadNpmTasks).compact().value();\n return _.each(npmTasks, function(taskName) {});\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "11ff3633ffd8c2bb055376cda0faf45f4d24728d", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/11ff3633ffd8c2bb055376cda0faf45f4d24728d/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-clean\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]", "response": "loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _.find(pluginTaskModuleLocations(taskModule), fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules)\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).\n union([\"grunt-sass\"] if config.enableSass).\n union([\"grunt-asset-fingerprint\"] if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _.each npmTasks, (taskName) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "11ff3633ffd8c2bb055376cda0faf45f4d24728d", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/11ff3633ffd8c2bb055376cda0faf45f4d24728d/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n```", "response": "var _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->", "response": "if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/1c1e7ea8ba8ad3ee0a32ae2ebe8f9bbc550f853e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "29756ea72b410dcf01791c60e93ae35794786987", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/29756ea72b410dcf01791c60e93ae35794786987/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n```", "response": "var _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "29756ea72b410dcf01791c60e93ae35794786987", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/29756ea72b410dcf01791c60e93ae35794786987/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", config.watch.options.module];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "29756ea72b410dcf01791c60e93ae35794786987", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/29756ea72b410dcf01791c60e93ae35794786987/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n config.watch.options.module\n ]\n\n loadTask = (module) ->", "response": "if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "29756ea72b410dcf01791c60e93ae35794786987", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/29756ea72b410dcf01791c60e93ae35794786987/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "cb848d104be19f2252f951056855b36531f0c71e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/cb848d104be19f2252f951056855b36531f0c71e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n```", "response": "var _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "cb848d104be19f2252f951056855b36531f0c71e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/cb848d104be19f2252f951056855b36531f0c71e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "cb848d104be19f2252f951056855b36531f0c71e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/cb848d104be19f2252f951056855b36531f0c71e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->", "response": "if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "cb848d104be19f2252f951056855b36531f0c71e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/cb848d104be19f2252f951056855b36531f0c71e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "da7b69982e44220bdd107798d86abc78749dc125", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/da7b69982e44220bdd107798d86abc78749dc125/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n```", "response": "var _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {});\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "da7b69982e44220bdd107798d86abc78749dc125", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/da7b69982e44220bdd107798d86abc78749dc125/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _, buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\n_ = require(\"lodash\");\n\nmodule.exports = function(grunt) {\n var config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {});\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "da7b69982e44220bdd107798d86abc78749dc125", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/da7b69982e44220bdd107798d86abc78749dc125/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n_ = require(\"lodash\")\n\nmodule.exports = (grunt) ->\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]", "response": "loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "da7b69982e44220bdd107798d86abc78749dc125", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/da7b69982e44220bdd107798d86abc78749dc125/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ec87f89976569a3236266159725a5b913ef631f5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ec87f89976569a3236266159725a5b913ef631f5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n```", "response": "var buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n return npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ec87f89976569a3236266159725a5b913ef631f5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ec87f89976569a3236266159725a5b913ef631f5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-concat-sourcemap\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n return npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ec87f89976569a3236266159725a5b913ef631f5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ec87f89976569a3236266159725a5b913ef631f5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-concat-sourcemap\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"", "response": "]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ec87f89976569a3236266159725a5b913ef631f5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ec87f89976569a3236266159725a5b913ef631f5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ec87f89976569a3236266159725a5b913ef631f5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ec87f89976569a3236266159725a5b913ef631f5/tasks/load-stuff.coffee", "line_start": 51, "line_end": 53} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)\n```", "response": "_(npmTasks).each(function(taskName) {\n loadTask(taskName);\n return hooks.trigger(`loadNpmTasks.afterLoad.${taskName}`, \"afterLoad\", taskName);\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ec87f89976569a3236266159725a5b913ef631f5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ec87f89976569a3236266159725a5b913ef631f5/tasks/load-stuff.coffee", "line_start": 51, "line_end": 53} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n_(npmTasks).each(function(taskName) {\n loadTask(taskName);\n return hooks.trigger(`loadNpmTasks.afterLoad.${taskName}`, \"afterLoad\", taskName);\n});\n```", "response": "_(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ec87f89976569a3236266159725a5b913ef631f5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ec87f89976569a3236266159725a5b913ef631f5/tasks/load-stuff.coffee", "line_start": 51, "line_end": 53} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "9610ff6435b6e325e1c67291fadd807f75d3c05e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/9610ff6435b6e325e1c67291fadd807f75d3c05e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n```", "response": "var buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n return npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "9610ff6435b6e325e1c67291fadd807f75d3c05e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/9610ff6435b6e325e1c67291fadd807f75d3c05e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar buildsAppConfig, findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nbuildsAppConfig = require('./../lib/builds-app-config');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = buildsAppConfig.forGrunt();\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n return npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "9610ff6435b6e325e1c67291fadd807f75d3c05e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/9610ff6435b6e325e1c67291fadd807f75d3c05e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nbuildsAppConfig = require('./../lib/builds-app-config')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = buildsAppConfig.forGrunt()\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"", "response": "]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "9610ff6435b6e325e1c67291fadd807f75d3c05e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/9610ff6435b6e325e1c67291fadd807f75d3c05e/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "92b48faa29da6ae7508696ce33301c4e04b4df1b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/92b48faa29da6ae7508696ce33301c4e04b4df1b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n```", "response": "var findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {});\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "92b48faa29da6ae7508696ce33301c4e04b4df1b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/92b48faa29da6ae7508696ce33301c4e04b4df1b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {});\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "92b48faa29da6ae7508696ce33301c4e04b4df1b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/92b48faa29da6ae7508696ce33301c4e04b4df1b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]", "response": "loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "92b48faa29da6ae7508696ce33301c4e04b4df1b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/92b48faa29da6ae7508696ce33301c4e04b4df1b/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n```", "response": "var findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->", "response": "if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/ac7f5d1b6cfd597a880e69d9d5ca6c9429b3cefb/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if resolvesQuietly.resolve(module, basedir: process.cwd())\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if resolvesQuietly.resolve(module, basedir: process.cwd())\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n```", "response": "var findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (resolvesQuietly.resolve(module, {\n basedir: process.cwd()\n })) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findsPluginModules, fs, hooks, resolvesQuietly;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nresolvesQuietly = require('./../lib/resolves-quietly');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskPathsFor, pluginModules, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n pluginModules = findsPluginModules.find();\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var path;\n if (resolvesQuietly.resolve(module, {\n basedir: process.cwd()\n })) {\n return grunt.loadNpmTasks(module);\n } else if (path = otherTaskPathsFor(module)) {\n return grunt.loadTasks(`${path}/tasks`);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskPathsFor = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, {\n basedir: `${__dirname}/../`\n });\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(pluginModules).chain().map(function(pluginModule) {\n return resolvesQuietly.resolve(taskModule, {\n basedir: pluginModule.dir\n });\n }).compact().value();\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n return loadTask(taskName);\n });\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if resolvesQuietly.resolve(module, basedir: process.cwd())\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\nresolvesQuietly = require('./../lib/resolves-quietly')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n pluginModules = findsPluginModules.find()\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->", "response": "if resolvesQuietly.resolve(module, basedir: process.cwd())\n grunt.loadNpmTasks(module)\n else if path = otherTaskPathsFor(module)\n grunt.loadTasks(\"#{path}/tasks\")\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskPathsFor = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule)).find(fs.existsSync) || resolvesQuietly.resolve(taskModule, basedir: \"#{__dirname}/../\")\n\n pluginTaskModuleLocations = (taskModule) ->\n _(pluginModules).chain()\n .map (pluginModule) ->\n resolvesQuietly.resolve(taskModule, basedir: pluginModule.dir)\n .compact()\n .value()\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "33f0d060d207ab07e032da98f88fc6a478b3bcd6", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/33f0d060d207ab07e032da98f88fc6a478b3bcd6/tasks/load-stuff.coffee", "line_start": 1, "line_end": 50} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if modulePath = otherTaskModuleLocation(module)\n grunt.loadTasks(modulePath)\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskModuleLocation = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule).concat(\"#{__dirname}/../node_modules/#{taskModule}/tasks\")).\n find(fs.existsSync)\n\n pluginTaskModuleLocations = (taskModule) ->\n _(findsPluginModules.find()).map (pluginModule) ->\n \"#{process.cwd()}/node_modules/#{pluginModule}/node_modules/#{taskModule}/tasks\"\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "c0d891164420dae9cddbd0d5e6cfc9ce0df3d618", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/c0d891164420dae9cddbd0d5e6cfc9ce0df3d618/tasks/load-stuff.coffee", "line_start": 1, "line_end": 46} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if modulePath = otherTaskModuleLocation(module)\n grunt.loadTasks(modulePath)\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskModuleLocation = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule).concat(\"#{__dirname}/../node_modules/#{taskModule}/tasks\")).\n find(fs.existsSync)\n\n pluginTaskModuleLocations = (taskModule) ->\n _(findsPluginModules.find()).map (pluginModule) ->\n \"#{process.cwd()}/node_modules/#{pluginModule}/node_modules/#{taskModule}/tasks\"\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)\n```", "response": "var findsPluginModules, fs, hooks;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskModuleLocation, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var modulePath;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (modulePath = otherTaskModuleLocation(module)) {\n return grunt.loadTasks(modulePath);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskModuleLocation = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule).concat(`${__dirname}/../node_modules/${taskModule}/tasks`)).find(fs.existsSync);\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(findsPluginModules.find()).map(function(pluginModule) {\n return `${process.cwd()}/node_modules/${pluginModule}/node_modules/${taskModule}/tasks`;\n });\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n loadTask(taskName);\n return hooks.trigger(`loadNpmTasks.afterLoad.${taskName}`, \"afterLoad\", taskName);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "c0d891164420dae9cddbd0d5e6cfc9ce0df3d618", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/c0d891164420dae9cddbd0d5e6cfc9ce0df3d618/tasks/load-stuff.coffee", "line_start": 1, "line_end": 46} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar findsPluginModules, fs, hooks;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nfindsPluginModules = require('./../lib/finds-plugin-modules');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks, otherTaskModuleLocation, pluginTaskModuleLocations;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n var modulePath;\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else if (modulePath = otherTaskModuleLocation(module)) {\n return grunt.loadTasks(modulePath);\n } else {\n return grunt.log.error(`Task module ${module} not found`);\n }\n };\n otherTaskModuleLocation = function(taskModule) {\n return _(pluginTaskModuleLocations(taskModule).concat(`${__dirname}/../node_modules/${taskModule}/tasks`)).find(fs.existsSync);\n };\n pluginTaskModuleLocations = function(taskModule) {\n return _(findsPluginModules.find()).map(function(pluginModule) {\n return `${process.cwd()}/node_modules/${pluginModule}/node_modules/${taskModule}/tasks`;\n });\n };\n npmTasks = _(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n loadTask(taskName);\n return hooks.trigger(`loadNpmTasks.afterLoad.${taskName}`, \"afterLoad\", taskName);\n });\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else if modulePath = otherTaskModuleLocation(module)\n grunt.loadTasks(modulePath)\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskModuleLocation = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule).concat(\"#{__dirname}/../node_modules/#{taskModule}/tasks\")).\n find(fs.existsSync)\n\n pluginTaskModuleLocations = (taskModule) ->\n _(findsPluginModules.find()).map (pluginModule) ->\n \"#{process.cwd()}/node_modules/#{pluginModule}/node_modules/#{taskModule}/tasks\"\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "c0d891164420dae9cddbd0d5e6cfc9ce0df3d618", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/c0d891164420dae9cddbd0d5e6cfc9ce0df3d618/tasks/load-stuff.coffee", "line_start": 1, "line_end": 46} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\nfindsPluginModules = require('./../lib/finds-plugin-modules')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")", "response": "grunt.loadNpmTasks(module)\n else if modulePath = otherTaskModuleLocation(module)\n grunt.loadTasks(modulePath)\n else\n grunt.log.error(\"Task module #{module} not found\")\n\n otherTaskModuleLocation = (taskModule) ->\n _(pluginTaskModuleLocations(taskModule).concat(\"#{__dirname}/../node_modules/#{taskModule}/tasks\")).\n find(fs.existsSync)\n\n pluginTaskModuleLocations = (taskModule) ->\n _(findsPluginModules.find()).map (pluginModule) ->\n \"#{process.cwd()}/node_modules/#{pluginModule}/node_modules/#{taskModule}/tasks\"\n\n npmTasks = _(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "c0d891164420dae9cddbd0d5e6cfc9ce0df3d618", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/c0d891164420dae9cddbd0d5e6cfc9ce0df3d618/tasks/load-stuff.coffee", "line_start": 1, "line_end": 46} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "2cf8a8fa540d676691bf7ac80c643622afc426f7", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/2cf8a8fa540d676691bf7ac80c643622afc426f7/tasks/load-stuff.coffee", "line_start": 1, "line_end": 35} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\nhooks = require('./../lib/hooks')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)\n```", "response": "var fs, hooks;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n loadTask(taskName);\n return hooks.trigger(`loadNpmTasks.afterLoad.${taskName}`, \"afterLoad\", taskName);\n });\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "2cf8a8fa540d676691bf7ac80c643622afc426f7", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/2cf8a8fa540d676691bf7ac80c643622afc426f7/tasks/load-stuff.coffee", "line_start": 1, "line_end": 35} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs, hooks;\n\nfs = require('fs');\n\nhooks = require('./../lib/hooks');\n\nmodule.exports = function(grunt) {\n var _, config, linemanNpmTasks, loadTask, npmTasks;\n _ = grunt.util._;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n return _(npmTasks).each(function(taskName) {\n loadTask(taskName);\n return hooks.trigger(`loadNpmTasks.afterLoad.${taskName}`, \"afterLoad\", taskName);\n });\n};\n```", "response": "fs = require('fs')\nhooks = require('./../lib/hooks')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "2cf8a8fa540d676691bf7ac80c643622afc426f7", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/2cf8a8fa540d676691bf7ac80c643622afc426f7/tasks/load-stuff.coffee", "line_start": 1, "line_end": 35} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\nhooks = require('./../lib/hooks')\n\nmodule.exports = (grunt) ->\n _ = grunt.util._\n\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"", "response": "\"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n _(npmTasks).each (taskName) ->\n loadTask(taskName)\n hooks.trigger(\"loadNpmTasks.afterLoad.#{taskName}\", \"afterLoad\", taskName)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "2cf8a8fa540d676691bf7ac80c643622afc426f7", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/2cf8a8fa540d676691bf7ac80c643622afc426f7/tasks/load-stuff.coffee", "line_start": 1, "line_end": 35} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8a81b6c86422dbd37c551b8a61560fa3cc8effe5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8a81b6c86422dbd37c551b8a61560fa3cc8effe5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n```", "response": "var fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, results, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n results = [];\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n results.push(loadTask(task));\n }\n return results;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8a81b6c86422dbd37c551b8a61560fa3cc8effe5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8a81b6c86422dbd37c551b8a61560fa3cc8effe5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, results, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.enableAssetFingerprint ? \"grunt-asset-fingerprint\" : void 0).union(config.loadNpmTasks).compact().value();\n results = [];\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n results.push(loadTask(task));\n }\n return results;\n};\n```", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8a81b6c86422dbd37c551b8a61560fa3cc8effe5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8a81b6c86422dbd37c551b8a61560fa3cc8effe5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"", "response": "]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(\"grunt-asset-fingerprint\" if config.enableAssetFingerprint).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8a81b6c86422dbd37c551b8a61560fa3cc8effe5", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8a81b6c86422dbd37c551b8a61560fa3cc8effe5/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n \"grunt-asset-fingerprint\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "afe840327c4692bc8dd95a9043d5cc99e836d6e1", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/afe840327c4692bc8dd95a9043d5cc99e836d6e1/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n \"grunt-asset-fingerprint\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n```", "response": "var fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, results, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\", \"grunt-asset-fingerprint\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n results = [];\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n results.push(loadTask(task));\n }\n return results;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "afe840327c4692bc8dd95a9043d5cc99e836d6e1", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/afe840327c4692bc8dd95a9043d5cc99e836d6e1/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, results, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\", \"grunt-asset-fingerprint\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n results = [];\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n results.push(loadTask(task));\n }\n return results;\n};\n```", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n \"grunt-asset-fingerprint\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "afe840327c4692bc8dd95a9043d5cc99e836d6e1", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/afe840327c4692bc8dd95a9043d5cc99e836d6e1/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"", "response": "\"grunt-asset-fingerprint\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "afe840327c4692bc8dd95a9043d5cc99e836d6e1", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/afe840327c4692bc8dd95a9043d5cc99e836d6e1/tasks/load-stuff.coffee", "line_start": 1, "line_end": 30} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "3428e18b30a667d4f4cdfd6462b7c59a43b16816", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/3428e18b30a667d4f4cdfd6462b7c59a43b16816/tasks/load-stuff.coffee", "line_start": 1, "line_end": 29} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n```", "response": "var fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, results, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n results = [];\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n results.push(loadTask(task));\n }\n return results;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "3428e18b30a667d4f4cdfd6462b7c59a43b16816", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/3428e18b30a667d4f4cdfd6462b7c59a43b16816/tasks/load-stuff.coffee", "line_start": 1, "line_end": 29} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, results, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n results = [];\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n results.push(loadTask(task));\n }\n return results;\n};\n```", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "3428e18b30a667d4f4cdfd6462b7c59a43b16816", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/3428e18b30a667d4f4cdfd6462b7c59a43b16816/tasks/load-stuff.coffee", "line_start": 1, "line_end": 29} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"", "response": "\"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "3428e18b30a667d4f4cdfd6462b7c59a43b16816", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/3428e18b30a667d4f4cdfd6462b7c59a43b16816/tasks/load-stuff.coffee", "line_start": 1, "line_end": 29} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8106d0f435ab596af4147917a1ee4894f90628ca", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8106d0f435ab596af4147917a1ee4894f90628ca/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland\n```", "response": "var fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n loadTask(task);\n }\n grunt.renameTask(\"copy\", \"images\");\n loadTask(\"grunt-contrib-copy\"); // load again so webfonts can use it\n grunt.renameTask(\"copy\", \"webfonts\");\n return loadTask(\"grunt-contrib-copy\"); // load again to make available in userland\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8106d0f435ab596af4147917a1ee4894f90628ca", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8106d0f435ab596af4147917a1ee4894f90628ca/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-watch-nospawn\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n loadTask(task);\n }\n grunt.renameTask(\"copy\", \"images\");\n loadTask(\"grunt-contrib-copy\"); // load again so webfonts can use it\n grunt.renameTask(\"copy\", \"webfonts\");\n return loadTask(\"grunt-contrib-copy\"); // load again to make available in userland\n};\n```", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8106d0f435ab596af4147917a1ee4894f90628ca", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8106d0f435ab596af4147917a1ee4894f90628ca/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-watch-nospawn\"\n ]", "response": "loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "8106d0f435ab596af4147917a1ee4894f90628ca", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/8106d0f435ab596af4147917a1ee4894f90628ca/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland\n```", "response": "var fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-contrib-watch\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n loadTask(task);\n }\n grunt.renameTask(\"copy\", \"images\");\n loadTask(\"grunt-contrib-copy\"); // load again so webfonts can use it\n grunt.renameTask(\"copy\", \"webfonts\");\n return loadTask(\"grunt-contrib-copy\"); // load again to make available in userland\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-contrib-watch\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n loadTask(task);\n }\n grunt.renameTask(\"copy\", \"images\");\n loadTask(\"grunt-contrib-copy\"); // load again so webfonts can use it\n grunt.renameTask(\"copy\", \"webfonts\");\n return loadTask(\"grunt-contrib-copy\"); // load again to make available in userland\n};\n```", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]", "response": "loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n loadTask \"grunt-contrib-copy\" # load again so webfonts can use it\n\n grunt.renameTask \"copy\", \"webfonts\"\n loadTask \"grunt-contrib-copy\" # load again to make available in userland", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/998a2b68b9b1ba712bfcb38f6cfcd2cbc3f6e307/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n\n # must load again after a rename\n loadTask \"grunt-contrib-copy\"\n grunt.renameTask \"copy\", \"webfonts\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "0d9aa45b5a0bef0726c7ba50262b71204b919486", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0d9aa45b5a0bef0726c7ba50262b71204b919486/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n\n # must load again after a rename\n loadTask \"grunt-contrib-copy\"\n grunt.renameTask \"copy\", \"webfonts\"\n```", "response": "var fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-contrib-watch\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n loadTask(task);\n }\n grunt.renameTask(\"copy\", \"images\");\n // must load again after a rename\n loadTask(\"grunt-contrib-copy\");\n return grunt.renameTask(\"copy\", \"webfonts\");\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "0d9aa45b5a0bef0726c7ba50262b71204b919486", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0d9aa45b5a0bef0726c7ba50262b71204b919486/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar fs;\n\nfs = require('fs');\n\nmodule.exports = function(grunt) {\n var config, i, len, linemanNpmTasks, loadTask, npmTasks, task;\n config = require(`${process.cwd()}/config/application`);\n linemanNpmTasks = [\"grunt-contrib-clean\", \"grunt-contrib-coffee\", \"grunt-contrib-concat\", \"grunt-contrib-copy\", \"grunt-contrib-handlebars\", \"grunt-contrib-jshint\", \"grunt-contrib-jst\", \"grunt-contrib-less\", \"grunt-contrib-cssmin\", \"grunt-contrib-uglify\", \"grunt-contrib-watch\"];\n loadTask = function(module) {\n if (fs.existsSync(`${process.cwd()}/node_modules/${module}`)) {\n return grunt.loadNpmTasks(module);\n } else {\n return grunt.loadTasks(`${__dirname}/../node_modules/${module}/tasks`);\n }\n };\n npmTasks = grunt.util._(linemanNpmTasks).chain().union(config.enableSass ? \"grunt-contrib-sass\" : void 0).union(config.loadNpmTasks).compact().value();\n for (i = 0, len = npmTasks.length; i < len; i++) {\n task = npmTasks[i];\n loadTask(task);\n }\n grunt.renameTask(\"copy\", \"images\");\n // must load again after a rename\n loadTask(\"grunt-contrib-copy\");\n return grunt.renameTask(\"copy\", \"webfonts\");\n};\n```", "response": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]\n\n loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n\n # must load again after a rename\n loadTask \"grunt-contrib-copy\"\n grunt.renameTask \"copy\", \"webfonts\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "0d9aa45b5a0bef0726c7ba50262b71204b919486", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0d9aa45b5a0bef0726c7ba50262b71204b919486/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "linemanjs/lineman:tasks/load-stuff.coffee:1:completion", "type": "completion", "prompt": "fs = require('fs')\n\nmodule.exports = (grunt) ->\n config = require(\"#{process.cwd()}/config/application\")\n\n linemanNpmTasks = [\n \"grunt-contrib-clean\"\n \"grunt-contrib-coffee\"\n \"grunt-contrib-concat\"\n \"grunt-contrib-copy\"\n \"grunt-contrib-handlebars\"\n \"grunt-contrib-jshint\"\n \"grunt-contrib-jst\"\n \"grunt-contrib-less\"\n \"grunt-contrib-cssmin\"\n \"grunt-contrib-uglify\"\n \"grunt-contrib-watch\"\n ]", "response": "loadTask = (module) ->\n if fs.existsSync(\"#{process.cwd()}/node_modules/#{module}\")\n grunt.loadNpmTasks(module)\n else\n grunt.loadTasks(\"#{__dirname}/../node_modules/#{module}/tasks\")\n\n npmTasks = grunt.util._(linemanNpmTasks).chain().\n union(\"grunt-contrib-sass\" if config.enableSass).\n union(config.loadNpmTasks).\n compact().value()\n\n loadTask task for task in npmTasks\n\n grunt.renameTask \"copy\", \"images\"\n\n # must load again after a rename\n loadTask \"grunt-contrib-copy\"\n grunt.renameTask \"copy\", \"webfonts\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "tasks/load-stuff.coffee", "license": "MIT", "commit": "0d9aa45b5a0bef0726c7ba50262b71204b919486", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/0d9aa45b5a0bef0726c7ba50262b71204b919486/tasks/load-stuff.coffee", "line_start": 1, "line_end": 37} {"id": "nicolaskruchten/pivottable:src/d3_renderers.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\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:src/d3_renderers.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\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )\n```", "response": "var callWithJQuery;\n\ncallWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") { // CommonJS\n return pivotModule(require(\"jquery\"), require(\"d3\"));\n } else if (typeof define === \"function\" && define.amd) { // AMD\n return define([\"jquery\", \"d3\"], pivotModule);\n } else {\n // Plain browser env\n return pivotModule(jQuery, d3);\n }\n};\n\ncallWithJQuery(function($, d3) {\n return $.pivotUtilities.d3_renderers = {\n Treemap: function(pivotData, opts) {\n var addToTree, color, defaults, height, i, len, ref, result, rowKey, tree, treemap, value, width;\n defaults = {\n localeStrings: {},\n d3: {\n width: function() {\n return $(window).width() / 1.4;\n },\n height: function() {\n return $(window).height() / 1.4;\n }\n }\n };\n opts = $.extend(true, {}, defaults, opts);\n result = $(\"
\").css({\n width: \"100%\",\n height: \"100%\"\n });\n tree = {\n name: \"All\",\n children: []\n };\n addToTree = function(tree, path, value) {\n var child, i, len, newChild, ref, x;\n if (path.length === 0) {\n tree.value = value;\n return;\n }\n if (tree.children == null) {\n tree.children = [];\n }\n x = path.shift();\n ref = tree.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (!(child.name === x)) {\n continue;\n }\n addToTree(child, path, value);\n return;\n }\n newChild = {\n name: x\n };\n addToTree(newChild, path, value);\n return tree.children.push(newChild);\n };\n ref = pivotData.getRowKeys();\n for (i = 0, len = ref.length; i < len; i++) {\n rowKey = ref[i];\n value = pivotData.getAggregator(rowKey, []).value();\n if (value != null) {\n addToTree(tree, rowKey, value);\n }\n }\n color = d3.scale.category10();\n width = opts.d3.width();\n height = opts.d3.height();\n return treemap = d3.layout.treemap().size([width, height]).sticky(true).value(function(d) {\n return d.size;\n });\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:src/d3_renderers.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\"), require(\"d3\"));\n } else if (typeof define === \"function\" && define.amd) { // AMD\n return define([\"jquery\", \"d3\"], pivotModule);\n } else {\n // Plain browser env\n return pivotModule(jQuery, d3);\n }\n};\n\ncallWithJQuery(function($, d3) {\n return $.pivotUtilities.d3_renderers = {\n Treemap: function(pivotData, opts) {\n var addToTree, color, defaults, height, i, len, ref, result, rowKey, tree, treemap, value, width;\n defaults = {\n localeStrings: {},\n d3: {\n width: function() {\n return $(window).width() / 1.4;\n },\n height: function() {\n return $(window).height() / 1.4;\n }\n }\n };\n opts = $.extend(true, {}, defaults, opts);\n result = $(\"
\").css({\n width: \"100%\",\n height: \"100%\"\n });\n tree = {\n name: \"All\",\n children: []\n };\n addToTree = function(tree, path, value) {\n var child, i, len, newChild, ref, x;\n if (path.length === 0) {\n tree.value = value;\n return;\n }\n if (tree.children == null) {\n tree.children = [];\n }\n x = path.shift();\n ref = tree.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (!(child.name === x)) {\n continue;\n }\n addToTree(child, path, value);\n return;\n }\n newChild = {\n name: x\n };\n addToTree(newChild, path, value);\n return tree.children.push(newChild);\n };\n ref = pivotData.getRowKeys();\n for (i = 0, len = ref.length; i < len; i++) {\n rowKey = ref[i];\n value = pivotData.getAggregator(rowKey, []).value();\n if (value != null) {\n addToTree(tree, rowKey, value);\n }\n }\n color = d3.scale.category10();\n width = opts.d3.width();\n height = opts.d3.height();\n return treemap = d3.layout.treemap().size([width, height]).sticky(true).value(function(d) {\n return d.size;\n });\n }\n };\n});\n```", "response": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:src/d3_renderers.coffee:1:completion", "type": "completion", "prompt": "callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->", "response": "if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:src/d3_renderers.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 51, "line_end": 70} {"id": "nicolaskruchten/pivottable:src/d3_renderers.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nd3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result\n```", "response": "d3.select(result[0]).append(\"div\").style(\"position\", \"relative\").style(\"width\", width + \"px\").style(\"height\", height + \"px\").datum(tree).selectAll(\".node\").data(treemap.padding([15, 0, 0, 0]).value(function(d) {\n return d.value;\n}).nodes).enter().append(\"div\").attr(\"class\", \"node\").style(\"background\", function(d) {\n if (d.children != null) {\n return \"lightgrey\";\n } else {\n return color(d.name);\n }\n}).text(function(d) {\n return d.name;\n}).call(function() {\n this.style(\"left\", function(d) {\n return d.x + \"px\";\n }).style(\"top\", function(d) {\n return d.y + \"px\";\n }).style(\"width\", function(d) {\n return Math.max(0, d.dx - 1) + \"px\";\n }).style(\"height\", function(d) {\n return Math.max(0, d.dy - 1) + \"px\";\n });\n});\n\nreturn result;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 51, "line_end": 70} {"id": "nicolaskruchten/pivottable:src/d3_renderers.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nd3.select(result[0]).append(\"div\").style(\"position\", \"relative\").style(\"width\", width + \"px\").style(\"height\", height + \"px\").datum(tree).selectAll(\".node\").data(treemap.padding([15, 0, 0, 0]).value(function(d) {\n return d.value;\n}).nodes).enter().append(\"div\").attr(\"class\", \"node\").style(\"background\", function(d) {\n if (d.children != null) {\n return \"lightgrey\";\n } else {\n return color(d.name);\n }\n}).text(function(d) {\n return d.name;\n}).call(function() {\n this.style(\"left\", function(d) {\n return d.x + \"px\";\n }).style(\"top\", function(d) {\n return d.y + \"px\";\n }).style(\"width\", function(d) {\n return Math.max(0, d.dx - 1) + \"px\";\n }).style(\"height\", function(d) {\n return Math.max(0, d.dy - 1) + \"px\";\n });\n});\n\nreturn result;\n```", "response": "d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 51, "line_end": 70} {"id": "nicolaskruchten/pivottable:src/d3_renderers.coffee:2:completion", "type": "completion", "prompt": "d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")", "response": ".style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "src/d3_renderers.coffee", "license": "MIT", "commit": "838ec2fc38747749c28d2fd1cb6c4ace9e9cc520", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/838ec2fc38747749c28d2fd1cb6c4ace9e9cc520/src/d3_renderers.coffee", "line_start": 51, "line_end": 70} {"id": "linemanjs/lineman:config/plugins/coffee.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (lineman) ->\n config:\n coffee:\n compile:\n files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/coffee.coffee", "line_start": 1, "line_end": 8} {"id": "linemanjs/lineman:config/plugins/coffee.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (lineman) ->\n config:\n coffee:\n compile:\n files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"\n```", "response": "module.exports = function(lineman) {\n return {\n config: {\n coffee: {\n compile: {\n files: {\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\",\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\",\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"\n }\n }\n }\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/coffee.coffee", "line_start": 1, "line_end": 8} {"id": "linemanjs/lineman:config/plugins/coffee.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 coffee: {\n compile: {\n files: {\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\",\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\",\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"\n }\n }\n }\n }\n };\n};\n```", "response": "module.exports = (lineman) ->\n config:\n coffee:\n compile:\n files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/coffee.coffee", "line_start": 1, "line_end": 8} {"id": "linemanjs/lineman:config/plugins/coffee.coffee:1:completion", "type": "completion", "prompt": "module.exports = (lineman) ->\n config:\n coffee:\n compile:", "response": "files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "61d681532d9621e578d319c279006bbb728ece4b", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/61d681532d9621e578d319c279006bbb728ece4b/config/plugins/coffee.coffee", "line_start": 1, "line_end": 8} {"id": "linemanjs/lineman:config/plugins/coffee.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = (lineman) ->\n config:\n compile:\n files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/coffee.coffee", "line_start": 1, "line_end": 7} {"id": "linemanjs/lineman:config/plugins/coffee.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = (lineman) ->\n config:\n compile:\n files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"\n```", "response": "module.exports = function(lineman) {\n return {\n config: {\n compile: {\n files: {\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\",\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\",\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"\n }\n }\n }\n };\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/coffee.coffee", "line_start": 1, "line_end": 7} {"id": "linemanjs/lineman:config/plugins/coffee.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 compile: {\n files: {\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\",\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\",\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"\n }\n }\n }\n };\n};\n```", "response": "module.exports = (lineman) ->\n config:\n compile:\n files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/coffee.coffee", "line_start": 1, "line_end": 7} {"id": "linemanjs/lineman:config/plugins/coffee.coffee:1:completion", "type": "completion", "prompt": "module.exports = (lineman) ->\n config:\n compile:", "response": "files:\n \"<%= files.coffee.generated %>\": \"<%= files.coffee.app %>\"\n \"<%= files.coffee.generatedSpec %>\": \"<%= files.coffee.spec %>\"\n \"<%= files.coffee.generatedSpecHelpers %>\": \"<%= files.coffee.specHelpers %>\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "linemanjs/lineman", "path": "config/plugins/coffee.coffee", "license": "MIT", "commit": "94365fc4e4b804de8672585c254895fbd9cb514e", "stars": 1168, "source_url": "https://github.com/linemanjs/lineman/blob/94365fc4e4b804de8672585c254895fbd9cb514e/config/plugins/coffee.coffee", "line_start": 1, "line_end": 7} {"id": "buttercoin/buttercoin:lib/messagehandler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "TransactionLog = require './transactionlog'\nQ = require 'q'\nCurrencyMarket = require 'currency-market'\nOperations = require './operations'\n\n# The MessageHandler class deals with the high level processing flow of each\n# message that the server receives. This includes the interactions with the\n# transaction logs (for replaying transactions), sending the messages to the\n# order engine/processor (datastore), and [eventually] signalling the\n# datastore snapshots\nmodule.exports = class MessageHandler\n constructor: () ->\n @tlog = new TransactionLog\n @currencyMarket = new CurrencyMarket\n currencies: [\n 'EUR'\n 'BTC'\n 'USD'\n ]\n\n start: ->\n # TODO: (qubey) this doesn't current handle the case when we are still\n # replaying the transactions from the log file when our first new\n # message comes in. We need to handle this case more gracefully\n @tlog.start().then =>\n @tlog.replay_log()\n .progress (message) =>\n @process_message message, false\n .fin =>\n console.log 'Done with replay'\n\n process_message: (message, save = true) ->\n # TODO: (qubey) add more validation for the incoming message\n if message[0] == Operations.ADD_DEPOSIT\n if save\n @tlog.record message\n try\n messageBody = message[1]\n account = @currencyMarket.accounts[messageBody.account]\n if typeof account == 'undefined'\n @currencyMarket.register\n id: messageBody.account\n @currencyMarket.deposit\n account: messageBody.account\n currency: messageBody.currency\n amount: messageBody.amount\n if messageBody.callback\n messageBody.callback null, account.balances[messageBody.currency].funds\n catch error\n if messageBody.callback", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/messagehandler.coffee", "license": "MIT", "commit": "b2c40b4f8d590e22f09eb255d4ac56029c2b196a", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/b2c40b4f8d590e22f09eb255d4ac56029c2b196a/lib/messagehandler.coffee", "line_start": 1, "line_end": 50} {"id": "buttercoin/buttercoin:lib/messagehandler.coffee:1:completion", "type": "completion", "prompt": "TransactionLog = require './transactionlog'\nQ = require 'q'\nCurrencyMarket = require 'currency-market'\nOperations = require './operations'\n\n# The MessageHandler class deals with the high level processing flow of each\n# message that the server receives. This includes the interactions with the\n# transaction logs (for replaying transactions), sending the messages to the\n# order engine/processor (datastore), and [eventually] signalling the\n# datastore snapshots\nmodule.exports = class MessageHandler\n constructor: () ->\n @tlog = new TransactionLog\n @currencyMarket = new CurrencyMarket\n currencies: [\n 'EUR'\n 'BTC'\n 'USD'\n ]\n\n start: ->\n # TODO: (qubey) this doesn't current handle the case when we are still\n # replaying the transactions from the log file when our first new\n # message comes in. We need to handle this case more gracefully\n @tlog.start().then =>", "response": "@tlog.replay_log()\n .progress (message) =>\n @process_message message, false\n .fin =>\n console.log 'Done with replay'\n\n process_message: (message, save = true) ->\n # TODO: (qubey) add more validation for the incoming message\n if message[0] == Operations.ADD_DEPOSIT\n if save\n @tlog.record message\n try\n messageBody = message[1]\n account = @currencyMarket.accounts[messageBody.account]\n if typeof account == 'undefined'\n @currencyMarket.register\n id: messageBody.account\n @currencyMarket.deposit\n account: messageBody.account\n currency: messageBody.currency\n amount: messageBody.amount\n if messageBody.callback\n messageBody.callback null, account.balances[messageBody.currency].funds\n catch error\n if messageBody.callback", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/messagehandler.coffee", "license": "MIT", "commit": "b2c40b4f8d590e22f09eb255d4ac56029c2b196a", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/b2c40b4f8d590e22f09eb255d4ac56029c2b196a/lib/messagehandler.coffee", "line_start": 1, "line_end": 50} {"id": "buttercoin/buttercoin:lib/messagehandler.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "TransactionLog = require './transactionlog'\nQ = require 'q'\nDataStore = require './datastore/datastore'\nOperations = require './operations'\n\n# The MessageHandler class deals with the high level processing flow of each\n# message that the server receives. This includes the interactions with the\n# transaction logs (for replaying transactions), sending the messages to the\n# order engine/processor (datastore), and [eventually] signalling the\n# datastore snapshots\nmodule.exports = class MessageHandler\n constructor: () ->\n @tlog = new TransactionLog\n @datastore = new DataStore\n\n start: ->\n # TODO: (qubey) this doesn't current handle the case when we are still\n # replaying the transactions from the log file when our first new\n # message comes in. We need to handle this case more gracefully\n @tlog.start().then =>\n @tlog.replay_log()\n .progress (message) =>\n @process_message message, false\n .fin =>\n console.log 'Done with replay'\n\n process_message: (message, save = true) ->\n # TODO: (qubey) add more validation for the incoming message\n if message[0] == Operations.ADD_DEPOSIT\n if save\n @tlog.record message\n @datastore.add_deposit(message[1])\n else\n throw new Error( \"Unkown operation type: \" + message )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/messagehandler.coffee", "license": "MIT", "commit": "db5e4cf6ff27f1719cbb36c2e726770cdff9b041", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/messagehandler.coffee", "line_start": 1, "line_end": 34} {"id": "buttercoin/buttercoin:lib/messagehandler.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nTransactionLog = require './transactionlog'\nQ = require 'q'\nDataStore = require './datastore/datastore'\nOperations = require './operations'\n\n# The MessageHandler class deals with the high level processing flow of each\n# message that the server receives. This includes the interactions with the\n# transaction logs (for replaying transactions), sending the messages to the\n# order engine/processor (datastore), and [eventually] signalling the\n# datastore snapshots\nmodule.exports = class MessageHandler\n constructor: () ->\n @tlog = new TransactionLog\n @datastore = new DataStore\n\n start: ->\n # TODO: (qubey) this doesn't current handle the case when we are still\n # replaying the transactions from the log file when our first new\n # message comes in. We need to handle this case more gracefully\n @tlog.start().then =>\n @tlog.replay_log()\n .progress (message) =>\n @process_message message, false\n .fin =>\n console.log 'Done with replay'\n\n process_message: (message, save = true) ->\n # TODO: (qubey) add more validation for the incoming message\n if message[0] == Operations.ADD_DEPOSIT\n if save\n @tlog.record message\n @datastore.add_deposit(message[1])\n else\n throw new Error( \"Unkown operation type: \" + message )\n```", "response": "var DataStore, MessageHandler, Operations, Q, TransactionLog;\n\nTransactionLog = require('./transactionlog');\n\nQ = require('q');\n\nDataStore = require('./datastore/datastore');\n\nOperations = require('./operations');\n\n// The MessageHandler class deals with the high level processing flow of each\n// message that the server receives. This includes the interactions with the\n// transaction logs (for replaying transactions), sending the messages to the\n// order engine/processor (datastore), and [eventually] signalling the\n// datastore snapshots\nmodule.exports = MessageHandler = class MessageHandler {\n constructor() {\n this.tlog = new TransactionLog();\n this.datastore = new DataStore();\n }\n\n start() {\n // TODO: (qubey) this doesn't current handle the case when we are still\n // replaying the transactions from the log file when our first new\n // message comes in. We need to handle this case more gracefully\n return this.tlog.start().then(() => {\n return this.tlog.replay_log();\n }).progress((message) => {\n return this.process_message(message, false);\n }).fin(() => {\n return console.log('Done with replay');\n });\n }\n\n process_message(message, save = true) {\n // TODO: (qubey) add more validation for the incoming message\n if (message[0] === Operations.ADD_DEPOSIT) {\n if (save) {\n this.tlog.record(message);\n }\n return this.datastore.add_deposit(message[1]);\n } else {\n throw new Error(\"Unkown operation type: \" + message);\n }\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "buttercoin/buttercoin", "path": "lib/messagehandler.coffee", "license": "MIT", "commit": "db5e4cf6ff27f1719cbb36c2e726770cdff9b041", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/messagehandler.coffee", "line_start": 1, "line_end": 34} {"id": "buttercoin/buttercoin:lib/messagehandler.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar DataStore, MessageHandler, Operations, Q, TransactionLog;\n\nTransactionLog = require('./transactionlog');\n\nQ = require('q');\n\nDataStore = require('./datastore/datastore');\n\nOperations = require('./operations');\n\n// The MessageHandler class deals with the high level processing flow of each\n// message that the server receives. This includes the interactions with the\n// transaction logs (for replaying transactions), sending the messages to the\n// order engine/processor (datastore), and [eventually] signalling the\n// datastore snapshots\nmodule.exports = MessageHandler = class MessageHandler {\n constructor() {\n this.tlog = new TransactionLog();\n this.datastore = new DataStore();\n }\n\n start() {\n // TODO: (qubey) this doesn't current handle the case when we are still\n // replaying the transactions from the log file when our first new\n // message comes in. We need to handle this case more gracefully\n return this.tlog.start().then(() => {\n return this.tlog.replay_log();\n }).progress((message) => {\n return this.process_message(message, false);\n }).fin(() => {\n return console.log('Done with replay');\n });\n }\n\n process_message(message, save = true) {\n // TODO: (qubey) add more validation for the incoming message\n if (message[0] === Operations.ADD_DEPOSIT) {\n if (save) {\n this.tlog.record(message);\n }\n return this.datastore.add_deposit(message[1]);\n } else {\n throw new Error(\"Unkown operation type: \" + message);\n }\n }\n\n};\n```", "response": "TransactionLog = require './transactionlog'\nQ = require 'q'\nDataStore = require './datastore/datastore'\nOperations = require './operations'\n\n# The MessageHandler class deals with the high level processing flow of each\n# message that the server receives. This includes the interactions with the\n# transaction logs (for replaying transactions), sending the messages to the\n# order engine/processor (datastore), and [eventually] signalling the\n# datastore snapshots\nmodule.exports = class MessageHandler\n constructor: () ->\n @tlog = new TransactionLog\n @datastore = new DataStore\n\n start: ->\n # TODO: (qubey) this doesn't current handle the case when we are still\n # replaying the transactions from the log file when our first new\n # message comes in. We need to handle this case more gracefully\n @tlog.start().then =>\n @tlog.replay_log()\n .progress (message) =>\n @process_message message, false\n .fin =>\n console.log 'Done with replay'\n\n process_message: (message, save = true) ->\n # TODO: (qubey) add more validation for the incoming message\n if message[0] == Operations.ADD_DEPOSIT\n if save\n @tlog.record message\n @datastore.add_deposit(message[1])\n else\n throw new Error( \"Unkown operation type: \" + message )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/messagehandler.coffee", "license": "MIT", "commit": "db5e4cf6ff27f1719cbb36c2e726770cdff9b041", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/messagehandler.coffee", "line_start": 1, "line_end": 34} {"id": "buttercoin/buttercoin:lib/messagehandler.coffee:1:completion", "type": "completion", "prompt": "TransactionLog = require './transactionlog'\nQ = require 'q'\nDataStore = require './datastore/datastore'\nOperations = require './operations'\n\n# The MessageHandler class deals with the high level processing flow of each\n# message that the server receives. This includes the interactions with the\n# transaction logs (for replaying transactions), sending the messages to the\n# order engine/processor (datastore), and [eventually] signalling the\n# datastore snapshots\nmodule.exports = class MessageHandler\n constructor: () ->\n @tlog = new TransactionLog\n @datastore = new DataStore\n\n start: ->\n # TODO: (qubey) this doesn't current handle the case when we are still", "response": "# replaying the transactions from the log file when our first new\n # message comes in. We need to handle this case more gracefully\n @tlog.start().then =>\n @tlog.replay_log()\n .progress (message) =>\n @process_message message, false\n .fin =>\n console.log 'Done with replay'\n\n process_message: (message, save = true) ->\n # TODO: (qubey) add more validation for the incoming message\n if message[0] == Operations.ADD_DEPOSIT\n if save\n @tlog.record message\n @datastore.add_deposit(message[1])\n else\n throw new Error( \"Unkown operation type: \" + message )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "buttercoin/buttercoin", "path": "lib/messagehandler.coffee", "license": "MIT", "commit": "db5e4cf6ff27f1719cbb36c2e726770cdff9b041", "stars": 663, "source_url": "https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/messagehandler.coffee", "line_start": 1, "line_end": 34} {"id": "jashkenas/coffeescript:src/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.transpile = (js, options) ->\n try\n babel = require '@babel/core'\n catch\n try\n babel = require 'babel-core'\n catch\n # This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.\n throw new Error 'To use the transpile option, you must have the \\'@babel/core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 9, "line_end": 23} {"id": "jashkenas/coffeescript:src/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.transpile = (js, options) ->\n try\n babel = require '@babel/core'\n catch\n try\n babel = require 'babel-core'\n catch\n # This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.\n throw new Error 'To use the transpile option, you must have the \\'@babel/core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.\n```", "response": "var universalCompile;\n\nCoffeeScript.transpile = function(js, options) {\n var babel;\n try {\n babel = require('@babel/core');\n } catch (error) {\n try {\n babel = require('babel-core');\n } catch (error) {\n // This error is only for Node, as CLI users will see a different error\n // earlier if they don’t have Babel installed.\n throw new Error('To use the transpile option, you must have the \\'@babel/core\\' module installed');\n }\n }\n return babel.transform(js, options);\n};\n\n// The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile;\n\n// The `compile` method particular to the Node API.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 9, "line_end": 23} {"id": "jashkenas/coffeescript:src/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar universalCompile;\n\nCoffeeScript.transpile = function(js, options) {\n var babel;\n try {\n babel = require('@babel/core');\n } catch (error) {\n try {\n babel = require('babel-core');\n } catch (error) {\n // This error is only for Node, as CLI users will see a different error\n // earlier if they don’t have Babel installed.\n throw new Error('To use the transpile option, you must have the \\'@babel/core\\' module installed');\n }\n }\n return babel.transform(js, options);\n};\n\n// The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile;\n\n// The `compile` method particular to the Node API.\n```", "response": "CoffeeScript.transpile = (js, options) ->\n try\n babel = require '@babel/core'\n catch\n try\n babel = require 'babel-core'\n catch\n # This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.\n throw new Error 'To use the transpile option, you must have the \\'@babel/core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 9, "line_end": 23} {"id": "jashkenas/coffeescript:src/index.coffee:1:completion", "type": "completion", "prompt": "CoffeeScript.transpile = (js, options) ->\n try\n babel = require '@babel/core'\n catch\n try\n babel = require 'babel-core'\n catch", "response": "# This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.\n throw new Error 'To use the transpile option, you must have the \\'@babel/core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 9, "line_end": 23} {"id": "jashkenas/coffeescript:src/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.compile = (code, options) ->\n # Pass a reference to Babel into the compiler, so that the transpile option\n # is available in the Node API. We need to do this so that tools like Webpack\n # can `require('coffeescript')` and build correctly, without trying to\n # require Babel.\n if options?.transpile\n options.transpile.transpile = CoffeeScript.transpile\n universalCompile.call CoffeeScript, code, options\n\n# Compile and execute a string of CoffeeScript (on the server), correctly\n# setting `__filename`, `__dirname`, and relative `require()`.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 24, "line_end": 34} {"id": "jashkenas/coffeescript:src/index.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.compile = (code, options) ->\n # Pass a reference to Babel into the compiler, so that the transpile option\n # is available in the Node API. We need to do this so that tools like Webpack\n # can `require('coffeescript')` and build correctly, without trying to\n # require Babel.\n if options?.transpile\n options.transpile.transpile = CoffeeScript.transpile\n universalCompile.call CoffeeScript, code, options\n\n# Compile and execute a string of CoffeeScript (on the server), correctly\n# setting `__filename`, `__dirname`, and relative `require()`.\n```", "response": "CoffeeScript.compile = function(code, options) {\n // Pass a reference to Babel into the compiler, so that the transpile option\n // is available in the Node API. We need to do this so that tools like Webpack\n // can `require('coffeescript')` and build correctly, without trying to\n // require Babel.\n if (options != null ? options.transpile : void 0) {\n options.transpile.transpile = CoffeeScript.transpile;\n }\n return universalCompile.call(CoffeeScript, code, options);\n};\n\n// Compile and execute a string of CoffeeScript (on the server), correctly\n// setting `__filename`, `__dirname`, and relative `require()`.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 24, "line_end": 34} {"id": "jashkenas/coffeescript:src/index.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript.compile = function(code, options) {\n // Pass a reference to Babel into the compiler, so that the transpile option\n // is available in the Node API. We need to do this so that tools like Webpack\n // can `require('coffeescript')` and build correctly, without trying to\n // require Babel.\n if (options != null ? options.transpile : void 0) {\n options.transpile.transpile = CoffeeScript.transpile;\n }\n return universalCompile.call(CoffeeScript, code, options);\n};\n\n// Compile and execute a string of CoffeeScript (on the server), correctly\n// setting `__filename`, `__dirname`, and relative `require()`.\n```", "response": "CoffeeScript.compile = (code, options) ->\n # Pass a reference to Babel into the compiler, so that the transpile option\n # is available in the Node API. We need to do this so that tools like Webpack\n # can `require('coffeescript')` and build correctly, without trying to\n # require Babel.\n if options?.transpile\n options.transpile.transpile = CoffeeScript.transpile\n universalCompile.call CoffeeScript, code, options\n\n# Compile and execute a string of CoffeeScript (on the server), correctly\n# setting `__filename`, `__dirname`, and relative `require()`.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 24, "line_end": 34} {"id": "jashkenas/coffeescript:src/index.coffee:2:completion", "type": "completion", "prompt": "CoffeeScript.compile = (code, options) ->\n # Pass a reference to Babel into the compiler, so that the transpile option\n # is available in the Node API. We need to do this so that tools like Webpack\n # can `require('coffeescript')` and build correctly, without trying to\n # require Babel.", "response": "if options?.transpile\n options.transpile.transpile = CoffeeScript.transpile\n universalCompile.call CoffeeScript, code, options\n\n# Compile and execute a string of CoffeeScript (on the server), correctly\n# setting `__filename`, `__dirname`, and relative `require()`.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 24, "line_end": 34} {"id": "jashkenas/coffeescript:src/index.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else helpers.anonymousFileName()\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n options.filename = mainModule.filename\n options.inlineMap = true\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 35, "line_end": 65} {"id": "jashkenas/coffeescript:src/index.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else helpers.anonymousFileName()\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n options.filename = mainModule.filename\n options.inlineMap = true\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : helpers.anonymousFileName();\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Save the options for compiling child imports.\n mainModule.options = options;\n options.filename = mainModule.filename;\n options.inlineMap = true;\n // Compile.\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 35, "line_end": 65} {"id": "jashkenas/coffeescript:src/index.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : helpers.anonymousFileName();\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Save the options for compiling child imports.\n mainModule.options = options;\n options.filename = mainModule.filename;\n options.inlineMap = true;\n // Compile.\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else helpers.anonymousFileName()\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n options.filename = mainModule.filename\n options.inlineMap = true\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 35, "line_end": 65} {"id": "jashkenas/coffeescript:src/index.coffee:3:completion", "type": "completion", "prompt": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else helpers.anonymousFileName()\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'", "response": "mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n options.filename = mainModule.filename\n options.inlineMap = true\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 35, "line_end": 65} {"id": "jashkenas/coffeescript:src/index.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename\n # define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = CoffeeScript.compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 66, "line_end": 103} {"id": "jashkenas/coffeescript:src/index.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename\n # define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = CoffeeScript.compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox\n```", "response": "var hasProp = {}.hasOwnProperty;\n\nCoffeeScript.eval = function(code, options = {}) {\n var Module, _module, _require, createContext, i, isContext, js, k, len, o, r, ref, ref1, ref2, ref3, sandbox, v;\n if (!(code = code.trim())) {\n return;\n }\n createContext = (ref = vm.Script.createContext) != null ? ref : vm.createContext;\n isContext = (ref1 = vm.isContext) != null ? ref1 : function(ctx) {\n return options.sandbox instanceof createContext().constructor;\n };\n if (createContext) {\n if (options.sandbox != null) {\n if (isContext(options.sandbox)) {\n sandbox = options.sandbox;\n } else {\n sandbox = createContext();\n ref2 = options.sandbox;\n for (k in ref2) {\n if (!hasProp.call(ref2, k)) continue;\n v = ref2[k];\n sandbox[k] = v;\n }\n }\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;\n } else {\n sandbox = global;\n }\n sandbox.__filename = options.filename || 'eval';\n sandbox.__dirname = path.dirname(sandbox.__filename);\n // define module/require only if they chose not to specify their own\n if (!(sandbox !== global || sandbox.module || sandbox.require)) {\n Module = require('module');\n sandbox.module = _module = new Module(options.modulename || 'eval');\n sandbox.require = _require = function(path) {\n return Module._load(path, _module, true);\n };\n _module.filename = sandbox.__filename;\n ref3 = Object.getOwnPropertyNames(require);\n for (i = 0, len = ref3.length; i < len; i++) {\n r = ref3[i];\n if (r !== 'paths' && r !== 'arguments' && r !== 'caller') {\n _require[r] = require[r];\n }\n }\n // use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths(process.cwd());\n _require.resolve = function(request) {\n return Module._resolveFilename(request, _module);\n };\n }\n }\n o = {};\n for (k in options) {\n if (!hasProp.call(options, k)) continue;\n v = options[k];\n o[k] = v;\n }\n o.bare = true; // ensure return value\n js = CoffeeScript.compile(code, o);\n if (sandbox === global) {\n return vm.runInThisContext(js);\n } else {\n return vm.runInContext(js, sandbox);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 66, "line_end": 103} {"id": "jashkenas/coffeescript:src/index.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar hasProp = {}.hasOwnProperty;\n\nCoffeeScript.eval = function(code, options = {}) {\n var Module, _module, _require, createContext, i, isContext, js, k, len, o, r, ref, ref1, ref2, ref3, sandbox, v;\n if (!(code = code.trim())) {\n return;\n }\n createContext = (ref = vm.Script.createContext) != null ? ref : vm.createContext;\n isContext = (ref1 = vm.isContext) != null ? ref1 : function(ctx) {\n return options.sandbox instanceof createContext().constructor;\n };\n if (createContext) {\n if (options.sandbox != null) {\n if (isContext(options.sandbox)) {\n sandbox = options.sandbox;\n } else {\n sandbox = createContext();\n ref2 = options.sandbox;\n for (k in ref2) {\n if (!hasProp.call(ref2, k)) continue;\n v = ref2[k];\n sandbox[k] = v;\n }\n }\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;\n } else {\n sandbox = global;\n }\n sandbox.__filename = options.filename || 'eval';\n sandbox.__dirname = path.dirname(sandbox.__filename);\n // define module/require only if they chose not to specify their own\n if (!(sandbox !== global || sandbox.module || sandbox.require)) {\n Module = require('module');\n sandbox.module = _module = new Module(options.modulename || 'eval');\n sandbox.require = _require = function(path) {\n return Module._load(path, _module, true);\n };\n _module.filename = sandbox.__filename;\n ref3 = Object.getOwnPropertyNames(require);\n for (i = 0, len = ref3.length; i < len; i++) {\n r = ref3[i];\n if (r !== 'paths' && r !== 'arguments' && r !== 'caller') {\n _require[r] = require[r];\n }\n }\n // use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths(process.cwd());\n _require.resolve = function(request) {\n return Module._resolveFilename(request, _module);\n };\n }\n }\n o = {};\n for (k in options) {\n if (!hasProp.call(options, k)) continue;\n v = options[k];\n o[k] = v;\n }\n o.bare = true; // ensure return value\n js = CoffeeScript.compile(code, o);\n if (sandbox === global) {\n return vm.runInThisContext(js);\n } else {\n return vm.runInContext(js, sandbox);\n }\n};\n```", "response": "CoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename\n # define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = CoffeeScript.compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 66, "line_end": 103} {"id": "jashkenas/coffeescript:src/index.coffee:4:completion", "type": "completion", "prompt": "CoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename", "response": "# define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = CoffeeScript.compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 66, "line_end": 103} {"id": "jashkenas/coffeescript:src/index.coffee:5:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.register = -> require './register'\n\n# Throw error with deprecation warning when depending upon implicit `require.extensions` registration\nif require.extensions\n for ext in CoffeeScript.FILE_EXTENSIONS then do (ext) ->\n require.extensions[ext] ?= ->\n throw new Error \"\"\"\n Use CoffeeScript.register() or require the coffeescript/register module to require #{ext} files.\n \"\"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 105, "line_end": 113} {"id": "jashkenas/coffeescript:src/index.coffee:5:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.register = -> require './register'\n\n# Throw error with deprecation warning when depending upon implicit `require.extensions` registration\nif require.extensions\n for ext in CoffeeScript.FILE_EXTENSIONS then do (ext) ->\n require.extensions[ext] ?= ->\n throw new Error \"\"\"\n Use CoffeeScript.register() or require the coffeescript/register module to require #{ext} files.\n \"\"\"\n```", "response": "var ext, i, len, ref;\n\nCoffeeScript.register = function() {\n return require('./register');\n};\n\n// Throw error with deprecation warning when depending upon implicit `require.extensions` registration\nif (require.extensions) {\n ref = CoffeeScript.FILE_EXTENSIONS;\n for (i = 0, len = ref.length; i < len; i++) {\n ext = ref[i];\n (function(ext) {\n var base;\n return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {\n throw new Error(`Use CoffeeScript.register() or require the coffeescript/register module to require ${ext} files.`);\n };\n })(ext);\n }\n}", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 105, "line_end": 113} {"id": "jashkenas/coffeescript:src/index.coffee:5:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar ext, i, len, ref;\n\nCoffeeScript.register = function() {\n return require('./register');\n};\n\n// Throw error with deprecation warning when depending upon implicit `require.extensions` registration\nif (require.extensions) {\n ref = CoffeeScript.FILE_EXTENSIONS;\n for (i = 0, len = ref.length; i < len; i++) {\n ext = ref[i];\n (function(ext) {\n var base;\n return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {\n throw new Error(`Use CoffeeScript.register() or require the coffeescript/register module to require ${ext} files.`);\n };\n })(ext);\n }\n}\n```", "response": "CoffeeScript.register = -> require './register'\n\n# Throw error with deprecation warning when depending upon implicit `require.extensions` registration\nif require.extensions\n for ext in CoffeeScript.FILE_EXTENSIONS then do (ext) ->\n require.extensions[ext] ?= ->\n throw new Error \"\"\"\n Use CoffeeScript.register() or require the coffeescript/register module to require #{ext} files.\n \"\"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 105, "line_end": 113} {"id": "jashkenas/coffeescript:src/index.coffee:5:completion", "type": "completion", "prompt": "CoffeeScript.register = -> require './register'\n\n# Throw error with deprecation warning when depending upon implicit `require.extensions` registration\nif require.extensions", "response": "for ext in CoffeeScript.FILE_EXTENSIONS then do (ext) ->\n require.extensions[ext] ?= ->\n throw new Error \"\"\"\n Use CoffeeScript.register() or require the coffeescript/register module to require #{ext} files.\n \"\"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 105, "line_end": 113} {"id": "jashkenas/coffeescript:src/index.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 115, "line_end": 133} {"id": "jashkenas/coffeescript:src/index.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer\n```", "response": "CoffeeScript._compileRawFileContent = function(raw, filename, options = {}) {\n var answer, err, stripped;\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n options = Object.assign({}, options, {\n filename: filename,\n literate: helpers.isLiterate(filename),\n sourceFiles: [filename]\n });\n try {\n answer = CoffeeScript.compile(stripped, options);\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 115, "line_end": 133} {"id": "jashkenas/coffeescript:src/index.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript._compileRawFileContent = function(raw, filename, options = {}) {\n var answer, err, stripped;\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n options = Object.assign({}, options, {\n filename: filename,\n literate: helpers.isLiterate(filename),\n sourceFiles: [filename]\n });\n try {\n answer = CoffeeScript.compile(stripped, options);\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};\n```", "response": "CoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 115, "line_end": 133} {"id": "jashkenas/coffeescript:src/index.coffee:6:completion", "type": "completion", "prompt": "CoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]", "response": "try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 115, "line_end": 133} {"id": "jashkenas/coffeescript:src/index.coffee:7:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'\n\n CoffeeScript._compileRawFileContent raw, filename, options", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 135, "line_end": 138} {"id": "jashkenas/coffeescript:src/index.coffee:7:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'\n\n CoffeeScript._compileRawFileContent raw, filename, options\n```", "response": "CoffeeScript._compileFile = function(filename, options = {}) {\n var raw;\n raw = fs.readFileSync(filename, 'utf8');\n return CoffeeScript._compileRawFileContent(raw, filename, options);\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 135, "line_end": 138} {"id": "jashkenas/coffeescript:src/index.coffee:7:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript._compileFile = function(filename, options = {}) {\n var raw;\n raw = fs.readFileSync(filename, 'utf8');\n return CoffeeScript._compileRawFileContent(raw, filename, options);\n};\n```", "response": "CoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'\n\n CoffeeScript._compileRawFileContent raw, filename, options", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 135, "line_end": 138} {"id": "jashkenas/coffeescript:src/index.coffee:7:completion", "type": "completion", "prompt": "CoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'", "response": "CoffeeScript._compileRawFileContent raw, filename, options", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 135, "line_end": 138} {"id": "jashkenas/coffeescript:src/index.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports.patchStackTrace = CoffeeScript.patchStackTrace\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 140, "line_end": 160} {"id": "jashkenas/coffeescript:src/index.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports.patchStackTrace = CoffeeScript.patchStackTrace\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile\n```", "response": "module.exports = CoffeeScript;\n\n// Explicitly define all named exports so that Node’s automatic detection of\n// named exports from CommonJS packages finds all of them. This enables consuming\n// packages to write code like `import { compile } from 'coffeescript'`.\n// Don’t simplify this into a loop or similar; the `module.exports.name` part is\n// essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION;\n\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS;\n\nmodule.exports.helpers = CoffeeScript.helpers;\n\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled;\n\nmodule.exports.compile = CoffeeScript.compile;\n\nmodule.exports.tokens = CoffeeScript.tokens;\n\nmodule.exports.nodes = CoffeeScript.nodes;\n\nmodule.exports.register = CoffeeScript.register;\n\nmodule.exports.eval = CoffeeScript.eval;\n\nmodule.exports.run = CoffeeScript.run;\n\nmodule.exports.transpile = CoffeeScript.transpile;\n\nmodule.exports.patchStackTrace = CoffeeScript.patchStackTrace;\n\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent;\n\nmodule.exports._compileFile = CoffeeScript._compileFile;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 140, "line_end": 160} {"id": "jashkenas/coffeescript:src/index.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = CoffeeScript;\n\n// Explicitly define all named exports so that Node’s automatic detection of\n// named exports from CommonJS packages finds all of them. This enables consuming\n// packages to write code like `import { compile } from 'coffeescript'`.\n// Don’t simplify this into a loop or similar; the `module.exports.name` part is\n// essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION;\n\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS;\n\nmodule.exports.helpers = CoffeeScript.helpers;\n\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled;\n\nmodule.exports.compile = CoffeeScript.compile;\n\nmodule.exports.tokens = CoffeeScript.tokens;\n\nmodule.exports.nodes = CoffeeScript.nodes;\n\nmodule.exports.register = CoffeeScript.register;\n\nmodule.exports.eval = CoffeeScript.eval;\n\nmodule.exports.run = CoffeeScript.run;\n\nmodule.exports.transpile = CoffeeScript.transpile;\n\nmodule.exports.patchStackTrace = CoffeeScript.patchStackTrace;\n\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent;\n\nmodule.exports._compileFile = CoffeeScript._compileFile;\n```", "response": "module.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports.patchStackTrace = CoffeeScript.patchStackTrace\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 140, "line_end": 160} {"id": "jashkenas/coffeescript:src/index.coffee:8:completion", "type": "completion", "prompt": "module.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers", "response": "module.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports.patchStackTrace = CoffeeScript.patchStackTrace\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "817c39a13065a900725943c33a79252a69d779e2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/index.coffee", "line_start": 140, "line_end": 160} {"id": "jashkenas/coffeescript:src/index.coffee:8:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8d32c713c590618066b61b2ebe9c030a210a26c8", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8d32c713c590618066b61b2ebe9c030a210a26c8/src/index.coffee", "line_start": 140, "line_end": 159} {"id": "jashkenas/coffeescript:src/index.coffee:8:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile\n```", "response": "module.exports = CoffeeScript;\n\n// Explicitly define all named exports so that Node’s automatic detection of\n// named exports from CommonJS packages finds all of them. This enables consuming\n// packages to write code like `import { compile } from 'coffeescript'`.\n// Don’t simplify this into a loop or similar; the `module.exports.name` part is\n// essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION;\n\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS;\n\nmodule.exports.helpers = CoffeeScript.helpers;\n\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled;\n\nmodule.exports.compile = CoffeeScript.compile;\n\nmodule.exports.tokens = CoffeeScript.tokens;\n\nmodule.exports.nodes = CoffeeScript.nodes;\n\nmodule.exports.register = CoffeeScript.register;\n\nmodule.exports.eval = CoffeeScript.eval;\n\nmodule.exports.run = CoffeeScript.run;\n\nmodule.exports.transpile = CoffeeScript.transpile;\n\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent;\n\nmodule.exports._compileFile = CoffeeScript._compileFile;", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8d32c713c590618066b61b2ebe9c030a210a26c8", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8d32c713c590618066b61b2ebe9c030a210a26c8/src/index.coffee", "line_start": 140, "line_end": 159} {"id": "jashkenas/coffeescript:src/index.coffee:8:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = CoffeeScript;\n\n// Explicitly define all named exports so that Node’s automatic detection of\n// named exports from CommonJS packages finds all of them. This enables consuming\n// packages to write code like `import { compile } from 'coffeescript'`.\n// Don’t simplify this into a loop or similar; the `module.exports.name` part is\n// essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION;\n\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS;\n\nmodule.exports.helpers = CoffeeScript.helpers;\n\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled;\n\nmodule.exports.compile = CoffeeScript.compile;\n\nmodule.exports.tokens = CoffeeScript.tokens;\n\nmodule.exports.nodes = CoffeeScript.nodes;\n\nmodule.exports.register = CoffeeScript.register;\n\nmodule.exports.eval = CoffeeScript.eval;\n\nmodule.exports.run = CoffeeScript.run;\n\nmodule.exports.transpile = CoffeeScript.transpile;\n\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent;\n\nmodule.exports._compileFile = CoffeeScript._compileFile;\n```", "response": "module.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers\nmodule.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8d32c713c590618066b61b2ebe9c030a210a26c8", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8d32c713c590618066b61b2ebe9c030a210a26c8/src/index.coffee", "line_start": 140, "line_end": 159} {"id": "jashkenas/coffeescript:src/index.coffee:8:completion", "type": "completion", "prompt": "module.exports = CoffeeScript\n\n# Explicitly define all named exports so that Node’s automatic detection of\n# named exports from CommonJS packages finds all of them. This enables consuming\n# packages to write code like `import { compile } from 'coffeescript'`.\n# Don’t simplify this into a loop or similar; the `module.exports.name` part is\n# essential for Node’s algorithm to successfully detect the name.\nmodule.exports.VERSION = CoffeeScript.VERSION\nmodule.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS\nmodule.exports.helpers = CoffeeScript.helpers", "response": "module.exports.registerCompiled = CoffeeScript.registerCompiled\nmodule.exports.compile = CoffeeScript.compile\nmodule.exports.tokens = CoffeeScript.tokens\nmodule.exports.nodes = CoffeeScript.nodes\nmodule.exports.register = CoffeeScript.register\nmodule.exports.eval = CoffeeScript.eval\nmodule.exports.run = CoffeeScript.run\nmodule.exports.transpile = CoffeeScript.transpile\nmodule.exports._compileRawFileContent = CoffeeScript._compileRawFileContent\nmodule.exports._compileFile = CoffeeScript._compileFile", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8d32c713c590618066b61b2ebe9c030a210a26c8", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8d32c713c590618066b61b2ebe9c030a210a26c8/src/index.coffee", "line_start": 140, "line_end": 159} {"id": "jashkenas/coffeescript:src/index.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 35, "line_end": 62} {"id": "jashkenas/coffeescript:src/index.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Save the options for compiling child imports.\n mainModule.options = options;\n // Compile.\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 35, "line_end": 62} {"id": "jashkenas/coffeescript:src/index.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Save the options for compiling child imports.\n mainModule.options = options;\n // Compile.\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 35, "line_end": 62} {"id": "jashkenas/coffeescript:src/index.coffee:3:completion", "type": "completion", "prompt": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else", "response": "fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 35, "line_end": 62} {"id": "jashkenas/coffeescript:src/index.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 112, "line_end": 131} {"id": "jashkenas/coffeescript:src/index.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer\n```", "response": "CoffeeScript._compileRawFileContent = function(raw, filename, options = {}) {\n var answer, err, stripped;\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n options = Object.assign({}, options, {\n filename: filename,\n literate: helpers.isLiterate(filename),\n sourceFiles: [filename],\n inlineMap: true // Always generate a source map, so that stack traces line up.\n });\n try {\n answer = CoffeeScript.compile(stripped, options);\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 112, "line_end": 131} {"id": "jashkenas/coffeescript:src/index.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript._compileRawFileContent = function(raw, filename, options = {}) {\n var answer, err, stripped;\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n options = Object.assign({}, options, {\n filename: filename,\n literate: helpers.isLiterate(filename),\n sourceFiles: [filename],\n inlineMap: true // Always generate a source map, so that stack traces line up.\n });\n try {\n answer = CoffeeScript.compile(stripped, options);\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};\n```", "response": "CoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 112, "line_end": 131} {"id": "jashkenas/coffeescript:src/index.coffee:6:completion", "type": "completion", "prompt": "CoffeeScript._compileRawFileContent = (raw, filename, options = {}) ->\n\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.", "response": "try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "44bf59923e8eb37533ab78f185ef40b25e5550d2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/44bf59923e8eb37533ab78f185ef40b25e5550d2/src/index.coffee", "line_start": 112, "line_end": 131} {"id": "jashkenas/coffeescript:src/index.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "e82de9c0f6073751336c8af14b6dbe8e9f673eea", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/e82de9c0f6073751336c8af14b6dbe8e9f673eea/src/index.coffee", "line_start": 35, "line_end": 63} {"id": "jashkenas/coffeescript:src/index.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Save the options for compiling child imports.\n mainModule.options = options;\n // Compile.\n if (!helpers.isCoffee(mainModule.filename) || require.extensions) {\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n }\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "e82de9c0f6073751336c8af14b6dbe8e9f673eea", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/e82de9c0f6073751336c8af14b6dbe8e9f673eea/src/index.coffee", "line_start": 35, "line_end": 63} {"id": "jashkenas/coffeescript:src/index.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Save the options for compiling child imports.\n mainModule.options = options;\n // Compile.\n if (!helpers.isCoffee(mainModule.filename) || require.extensions) {\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n }\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "e82de9c0f6073751336c8af14b6dbe8e9f673eea", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/e82de9c0f6073751336c8af14b6dbe8e9f673eea/src/index.coffee", "line_start": 35, "line_end": 63} {"id": "jashkenas/coffeescript:src/index.coffee:3:completion", "type": "completion", "prompt": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else", "response": "fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Save the options for compiling child imports.\n mainModule.options = options\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "e82de9c0f6073751336c8af14b6dbe8e9f673eea", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/e82de9c0f6073751336c8af14b6dbe8e9f673eea/src/index.coffee", "line_start": 35, "line_end": 63} {"id": "jashkenas/coffeescript:src/index.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "c4245e50c2fda100c258110727ac8e76d2ac1a92", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/c4245e50c2fda100c258110727ac8e76d2ac1a92/src/index.coffee", "line_start": 113, "line_end": 132} {"id": "jashkenas/coffeescript:src/index.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer\n```", "response": "CoffeeScript._compileFile = function(filename, options = {}) {\n var answer, err, raw, stripped;\n raw = fs.readFileSync(filename, 'utf8');\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n options = Object.assign({}, options, {\n filename: filename,\n literate: helpers.isLiterate(filename),\n sourceFiles: [filename],\n inlineMap: true // Always generate a source map, so that stack traces line up.\n });\n try {\n answer = CoffeeScript.compile(stripped, options);\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "c4245e50c2fda100c258110727ac8e76d2ac1a92", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/c4245e50c2fda100c258110727ac8e76d2ac1a92/src/index.coffee", "line_start": 113, "line_end": 132} {"id": "jashkenas/coffeescript:src/index.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript._compileFile = function(filename, options = {}) {\n var answer, err, raw, stripped;\n raw = fs.readFileSync(filename, 'utf8');\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n options = Object.assign({}, options, {\n filename: filename,\n literate: helpers.isLiterate(filename),\n sourceFiles: [filename],\n inlineMap: true // Always generate a source map, so that stack traces line up.\n });\n try {\n answer = CoffeeScript.compile(stripped, options);\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};\n```", "response": "CoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.\n\n try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "c4245e50c2fda100c258110727ac8e76d2ac1a92", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/c4245e50c2fda100c258110727ac8e76d2ac1a92/src/index.coffee", "line_start": 113, "line_end": 132} {"id": "jashkenas/coffeescript:src/index.coffee:6:completion", "type": "completion", "prompt": "CoffeeScript._compileFile = (filename, options = {}) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n options = Object.assign {}, options,\n filename: filename\n literate: helpers.isLiterate filename\n sourceFiles: [filename]\n inlineMap: yes # Always generate a source map, so that stack traces line up.", "response": "try\n answer = CoffeeScript.compile stripped, options\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "c4245e50c2fda100c258110727ac8e76d2ac1a92", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/c4245e50c2fda100c258110727ac8e76d2ac1a92/src/index.coffee", "line_start": 113, "line_end": 132} {"id": "jashkenas/coffeescript:src/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.transpile = (js, options) ->\n try\n babel = require 'babel-core'\n catch\n # This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.\n throw new Error 'To use the transpile option, you must have the \\'babel-core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7/src/index.coffee", "line_start": 9, "line_end": 20} {"id": "jashkenas/coffeescript:src/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.transpile = (js, options) ->\n try\n babel = require 'babel-core'\n catch\n # This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.\n throw new Error 'To use the transpile option, you must have the \\'babel-core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.\n```", "response": "var universalCompile;\n\nCoffeeScript.transpile = function(js, options) {\n var babel;\n try {\n babel = require('babel-core');\n } catch (error) {\n // This error is only for Node, as CLI users will see a different error\n // earlier if they don’t have Babel installed.\n throw new Error('To use the transpile option, you must have the \\'babel-core\\' module installed');\n }\n return babel.transform(js, options);\n};\n\n// The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile;\n\n// The `compile` method particular to the Node API.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7/src/index.coffee", "line_start": 9, "line_end": 20} {"id": "jashkenas/coffeescript:src/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar universalCompile;\n\nCoffeeScript.transpile = function(js, options) {\n var babel;\n try {\n babel = require('babel-core');\n } catch (error) {\n // This error is only for Node, as CLI users will see a different error\n // earlier if they don’t have Babel installed.\n throw new Error('To use the transpile option, you must have the \\'babel-core\\' module installed');\n }\n return babel.transform(js, options);\n};\n\n// The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile;\n\n// The `compile` method particular to the Node API.\n```", "response": "CoffeeScript.transpile = (js, options) ->\n try\n babel = require 'babel-core'\n catch\n # This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.\n throw new Error 'To use the transpile option, you must have the \\'babel-core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7/src/index.coffee", "line_start": 9, "line_end": 20} {"id": "jashkenas/coffeescript:src/index.coffee:1:completion", "type": "completion", "prompt": "CoffeeScript.transpile = (js, options) ->\n try\n babel = require 'babel-core'\n catch\n # This error is only for Node, as CLI users will see a different error\n # earlier if they don’t have Babel installed.", "response": "throw new Error 'To use the transpile option, you must have the \\'babel-core\\' module installed'\n babel.transform js, options\n\n# The `compile` method shared by the CLI, Node and browser APIs.\nuniversalCompile = CoffeeScript.compile\n# The `compile` method particular to the Node API.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/a2037e799f3e38fb83c2fa06daad4a8f5f8d2ce7/src/index.coffee", "line_start": 9, "line_end": 20} {"id": "jashkenas/coffeescript:src/index.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 32, "line_end": 57} {"id": "jashkenas/coffeescript:src/index.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Compile.\n if (!helpers.isCoffee(mainModule.filename) || require.extensions) {\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n }\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 32, "line_end": 57} {"id": "jashkenas/coffeescript:src/index.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Compile.\n if (!helpers.isCoffee(mainModule.filename) || require.extensions) {\n answer = CoffeeScript.compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n }\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 32, "line_end": 57} {"id": "jashkenas/coffeescript:src/index.coffee:3:completion", "type": "completion", "prompt": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename", "response": "else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = CoffeeScript.compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 32, "line_end": 57} {"id": "jashkenas/coffeescript:src/index.coffee:6:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = CoffeeScript.compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]\n literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 107, "line_end": 124} {"id": "jashkenas/coffeescript:src/index.coffee:6:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = CoffeeScript.compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]\n literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer\n```", "response": "CoffeeScript._compileFile = function(filename, sourceMap = false, inlineMap = false) {\n var answer, err, raw, stripped;\n raw = fs.readFileSync(filename, 'utf8');\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n try {\n answer = CoffeeScript.compile(stripped, {\n filename,\n sourceMap,\n inlineMap,\n sourceFiles: [filename],\n literate: helpers.isLiterate(filename)\n });\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 107, "line_end": 124} {"id": "jashkenas/coffeescript:src/index.coffee:6:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript._compileFile = function(filename, sourceMap = false, inlineMap = false) {\n var answer, err, raw, stripped;\n raw = fs.readFileSync(filename, 'utf8');\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n try {\n answer = CoffeeScript.compile(stripped, {\n filename,\n sourceMap,\n inlineMap,\n sourceFiles: [filename],\n literate: helpers.isLiterate(filename)\n });\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};\n```", "response": "CoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = CoffeeScript.compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]\n literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 107, "line_end": 124} {"id": "jashkenas/coffeescript:src/index.coffee:6:completion", "type": "completion", "prompt": "CoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = CoffeeScript.compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]", "response": "literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "f51c1a150b89796f3d956d6cbe782a7093985fbf", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/f51c1a150b89796f3d956d6cbe782a7093985fbf/src/index.coffee", "line_start": 107, "line_end": 124} {"id": "jashkenas/coffeescript:src/index.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 12, "line_end": 37} {"id": "jashkenas/coffeescript:src/index.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Compile.\n if (!helpers.isCoffee(mainModule.filename) || require.extensions) {\n answer = compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n }\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 12, "line_end": 37} {"id": "jashkenas/coffeescript:src/index.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript.run = function(code, options = {}) {\n var answer, dir, mainModule, ref;\n mainModule = require.main;\n // Set the filename.\n mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '';\n // Clear the module cache.\n mainModule.moduleCache && (mainModule.moduleCache = {});\n // Assign paths for node_modules loading\n dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');\n mainModule.paths = require('module')._nodeModulePaths(dir);\n // Compile.\n if (!helpers.isCoffee(mainModule.filename) || require.extensions) {\n answer = compile(code, options);\n code = (ref = answer.js) != null ? ref : answer;\n }\n return mainModule._compile(code, mainModule.filename);\n};\n\n// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n// The CoffeeScript REPL uses this to run the input.\n```", "response": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename\n else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 12, "line_end": 37} {"id": "jashkenas/coffeescript:src/index.coffee:1:completion", "type": "completion", "prompt": "CoffeeScript.run = (code, options = {}) ->\n mainModule = require.main\n\n # Set the filename.\n mainModule.filename = process.argv[1] =\n if options.filename then fs.realpathSync(options.filename) else ''\n\n # Clear the module cache.\n mainModule.moduleCache and= {}\n\n # Assign paths for node_modules loading\n dir = if options.filename?\n path.dirname fs.realpathSync options.filename", "response": "else\n fs.realpathSync '.'\n mainModule.paths = require('module')._nodeModulePaths dir\n\n # Compile.\n if not helpers.isCoffee(mainModule.filename) or require.extensions\n answer = compile code, options\n code = answer.js ? answer\n\n mainModule._compile code, mainModule.filename\n\n# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).\n# The CoffeeScript REPL uses this to run the input.", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 12, "line_end": 37} {"id": "jashkenas/coffeescript:src/index.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename\n # define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 38, "line_end": 75} {"id": "jashkenas/coffeescript:src/index.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename\n # define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox\n```", "response": "var hasProp = {}.hasOwnProperty;\n\nCoffeeScript.eval = function(code, options = {}) {\n var Module, _module, _require, createContext, i, isContext, js, k, len, o, r, ref, ref1, ref2, ref3, sandbox, v;\n if (!(code = code.trim())) {\n return;\n }\n createContext = (ref = vm.Script.createContext) != null ? ref : vm.createContext;\n isContext = (ref1 = vm.isContext) != null ? ref1 : function(ctx) {\n return options.sandbox instanceof createContext().constructor;\n };\n if (createContext) {\n if (options.sandbox != null) {\n if (isContext(options.sandbox)) {\n sandbox = options.sandbox;\n } else {\n sandbox = createContext();\n ref2 = options.sandbox;\n for (k in ref2) {\n if (!hasProp.call(ref2, k)) continue;\n v = ref2[k];\n sandbox[k] = v;\n }\n }\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;\n } else {\n sandbox = global;\n }\n sandbox.__filename = options.filename || 'eval';\n sandbox.__dirname = path.dirname(sandbox.__filename);\n // define module/require only if they chose not to specify their own\n if (!(sandbox !== global || sandbox.module || sandbox.require)) {\n Module = require('module');\n sandbox.module = _module = new Module(options.modulename || 'eval');\n sandbox.require = _require = function(path) {\n return Module._load(path, _module, true);\n };\n _module.filename = sandbox.__filename;\n ref3 = Object.getOwnPropertyNames(require);\n for (i = 0, len = ref3.length; i < len; i++) {\n r = ref3[i];\n if (r !== 'paths' && r !== 'arguments' && r !== 'caller') {\n _require[r] = require[r];\n }\n }\n // use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths(process.cwd());\n _require.resolve = function(request) {\n return Module._resolveFilename(request, _module);\n };\n }\n }\n o = {};\n for (k in options) {\n if (!hasProp.call(options, k)) continue;\n v = options[k];\n o[k] = v;\n }\n o.bare = true; // ensure return value\n js = compile(code, o);\n if (sandbox === global) {\n return vm.runInThisContext(js);\n } else {\n return vm.runInContext(js, sandbox);\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 38, "line_end": 75} {"id": "jashkenas/coffeescript:src/index.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar hasProp = {}.hasOwnProperty;\n\nCoffeeScript.eval = function(code, options = {}) {\n var Module, _module, _require, createContext, i, isContext, js, k, len, o, r, ref, ref1, ref2, ref3, sandbox, v;\n if (!(code = code.trim())) {\n return;\n }\n createContext = (ref = vm.Script.createContext) != null ? ref : vm.createContext;\n isContext = (ref1 = vm.isContext) != null ? ref1 : function(ctx) {\n return options.sandbox instanceof createContext().constructor;\n };\n if (createContext) {\n if (options.sandbox != null) {\n if (isContext(options.sandbox)) {\n sandbox = options.sandbox;\n } else {\n sandbox = createContext();\n ref2 = options.sandbox;\n for (k in ref2) {\n if (!hasProp.call(ref2, k)) continue;\n v = ref2[k];\n sandbox[k] = v;\n }\n }\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;\n } else {\n sandbox = global;\n }\n sandbox.__filename = options.filename || 'eval';\n sandbox.__dirname = path.dirname(sandbox.__filename);\n // define module/require only if they chose not to specify their own\n if (!(sandbox !== global || sandbox.module || sandbox.require)) {\n Module = require('module');\n sandbox.module = _module = new Module(options.modulename || 'eval');\n sandbox.require = _require = function(path) {\n return Module._load(path, _module, true);\n };\n _module.filename = sandbox.__filename;\n ref3 = Object.getOwnPropertyNames(require);\n for (i = 0, len = ref3.length; i < len; i++) {\n r = ref3[i];\n if (r !== 'paths' && r !== 'arguments' && r !== 'caller') {\n _require[r] = require[r];\n }\n }\n // use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths(process.cwd());\n _require.resolve = function(request) {\n return Module._resolveFilename(request, _module);\n };\n }\n }\n o = {};\n for (k in options) {\n if (!hasProp.call(options, k)) continue;\n v = options[k];\n o[k] = v;\n }\n o.bare = true; // ensure return value\n js = compile(code, o);\n if (sandbox === global) {\n return vm.runInThisContext(js);\n } else {\n return vm.runInContext(js, sandbox);\n }\n};\n```", "response": "CoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename\n # define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 38, "line_end": 75} {"id": "jashkenas/coffeescript:src/index.coffee:2:completion", "type": "completion", "prompt": "CoffeeScript.eval = (code, options = {}) ->\n return unless code = code.trim()\n createContext = vm.Script.createContext ? vm.createContext\n\n isContext = vm.isContext ? (ctx) ->\n options.sandbox instanceof createContext().constructor\n\n if createContext\n if options.sandbox?\n if isContext options.sandbox\n sandbox = options.sandbox\n else\n sandbox = createContext()\n sandbox[k] = v for own k, v of options.sandbox\n sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox\n else\n sandbox = global\n sandbox.__filename = options.filename || 'eval'\n sandbox.__dirname = path.dirname sandbox.__filename", "response": "# define module/require only if they chose not to specify their own\n unless sandbox isnt global or sandbox.module or sandbox.require\n Module = require 'module'\n sandbox.module = _module = new Module(options.modulename || 'eval')\n sandbox.require = _require = (path) -> Module._load path, _module, true\n _module.filename = sandbox.__filename\n for r in Object.getOwnPropertyNames require when r not in ['paths', 'arguments', 'caller']\n _require[r] = require[r]\n # use the same hack node currently uses for their own REPL\n _require.paths = _module.paths = Module._nodeModulePaths process.cwd()\n _require.resolve = (request) -> Module._resolveFilename request, _module\n o = {}\n o[k] = v for own k, v of options\n o.bare = on # ensure return value\n js = compile code, o\n if sandbox is global\n vm.runInThisContext js\n else\n vm.runInContext js, sandbox", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 38, "line_end": 75} {"id": "jashkenas/coffeescript:src/index.coffee:4:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "CoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]\n literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 87, "line_end": 104} {"id": "jashkenas/coffeescript:src/index.coffee:4:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nCoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]\n literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer\n```", "response": "CoffeeScript._compileFile = function(filename, sourceMap = false, inlineMap = false) {\n var answer, err, raw, stripped;\n raw = fs.readFileSync(filename, 'utf8');\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n try {\n answer = compile(stripped, {\n filename,\n sourceMap,\n inlineMap,\n sourceFiles: [filename],\n literate: helpers.isLiterate(filename)\n });\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 87, "line_end": 104} {"id": "jashkenas/coffeescript:src/index.coffee:4:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nCoffeeScript._compileFile = function(filename, sourceMap = false, inlineMap = false) {\n var answer, err, raw, stripped;\n raw = fs.readFileSync(filename, 'utf8');\n // Strip the Unicode byte order mark, if this file begins with one.\n stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;\n try {\n answer = compile(stripped, {\n filename,\n sourceMap,\n inlineMap,\n sourceFiles: [filename],\n literate: helpers.isLiterate(filename)\n });\n } catch (error) {\n err = error;\n // As the filename and code of a dynamically loaded file will be different\n // from the original file compiled with CoffeeScript.run, add that\n // information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError(err, stripped, filename);\n }\n return answer;\n};\n```", "response": "CoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]\n literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 87, "line_end": 104} {"id": "jashkenas/coffeescript:src/index.coffee:4:completion", "type": "completion", "prompt": "CoffeeScript._compileFile = (filename, sourceMap = no, inlineMap = no) ->\n raw = fs.readFileSync filename, 'utf8'\n # Strip the Unicode byte order mark, if this file begins with one.\n stripped = if raw.charCodeAt(0) is 0xFEFF then raw.substring 1 else raw\n\n try\n answer = compile stripped, {\n filename, sourceMap, inlineMap\n sourceFiles: [filename]", "response": "literate: helpers.isLiterate filename\n }\n catch err\n # As the filename and code of a dynamically loaded file will be different\n # from the original file compiled with CoffeeScript.run, add that\n # information to error so it can be pretty-printed later.\n throw helpers.updateSyntaxError err, stripped, filename\n\n answer", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jashkenas/coffeescript", "path": "src/index.coffee", "license": "MIT", "commit": "8407dd885a2de4b9b061177f67e41f3df84f53b2", "stars": 16577, "source_url": "https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/index.coffee", "line_start": 87, "line_end": 104} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class BaseMailer\n\n from: '简聊 '\n\n delay: 0\n\n action: 'delay'\n\n constructor: ->\n @_getTemplate()\n\n _sendByRender: (email) ->\n self = this\n\n if email.html\n return self._send email\n\n @_render email\n .then (email) ->\n\n self._send email\n\n .catch (err) -> logger.warn err.stack\n\n _send: (email) ->\n # @osv\n return email\n _email =\n from: @from\n to: email.to\n subject: email.subject\n html: email.html\n action: @action\n delay: @delay\n id: email.id\n\n mailguy.send _email\n\n _render: (email) ->\n options =\n cache: true\n filename: path.join __dirname, \"../../views/mailers/#{@template}.html\"\n delimiter: '?'\n\n self = this\n template = @_getTemplate()\n Promise.resolve()\n .then ->\n email.html = ejs.render template, email, options\n email", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 15, "line_end": 64} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass BaseMailer\n\n from: '简聊 '\n\n delay: 0\n\n action: 'delay'\n\n constructor: ->\n @_getTemplate()\n\n _sendByRender: (email) ->\n self = this\n\n if email.html\n return self._send email\n\n @_render email\n .then (email) ->\n\n self._send email\n\n .catch (err) -> logger.warn err.stack\n\n _send: (email) ->\n # @osv\n return email\n _email =\n from: @from\n to: email.to\n subject: email.subject\n html: email.html\n action: @action\n delay: @delay\n id: email.id\n\n mailguy.send _email\n\n _render: (email) ->\n options =\n cache: true\n filename: path.join __dirname, \"../../views/mailers/#{@template}.html\"\n delimiter: '?'\n\n self = this\n template = @_getTemplate()\n Promise.resolve()\n .then ->\n email.html = ejs.render template, email, options\n email\n```", "response": "var BaseMailer;\n\nBaseMailer = (function() {\n class BaseMailer {\n constructor() {\n this._getTemplate();\n }\n\n _sendByRender(email) {\n var self;\n self = this;\n if (email.html) {\n return self._send(email);\n }\n return this._render(email).then(function(email) {\n return self._send(email);\n }).catch(function(err) {\n return logger.warn(err.stack);\n });\n }\n\n _send(email) {\n var _email;\n // @osv\n return email;\n _email = {\n from: this.from,\n to: email.to,\n subject: email.subject,\n html: email.html,\n action: this.action,\n delay: this.delay,\n id: email.id\n };\n return mailguy.send(_email);\n }\n\n _render(email) {\n var options, self, template;\n options = {\n cache: true,\n filename: path.join(__dirname, `../../views/mailers/${this.template}.html`),\n delimiter: '?'\n };\n self = this;\n template = this._getTemplate();\n return Promise.resolve().then(function() {\n email.html = ejs.render(template, email, options);\n return email;\n });\n }\n\n };\n\n BaseMailer.prototype.from = '简聊 ';\n\n BaseMailer.prototype.delay = 0;\n\n BaseMailer.prototype.action = 'delay';\n\n return BaseMailer;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 15, "line_end": 64} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar BaseMailer;\n\nBaseMailer = (function() {\n class BaseMailer {\n constructor() {\n this._getTemplate();\n }\n\n _sendByRender(email) {\n var self;\n self = this;\n if (email.html) {\n return self._send(email);\n }\n return this._render(email).then(function(email) {\n return self._send(email);\n }).catch(function(err) {\n return logger.warn(err.stack);\n });\n }\n\n _send(email) {\n var _email;\n // @osv\n return email;\n _email = {\n from: this.from,\n to: email.to,\n subject: email.subject,\n html: email.html,\n action: this.action,\n delay: this.delay,\n id: email.id\n };\n return mailguy.send(_email);\n }\n\n _render(email) {\n var options, self, template;\n options = {\n cache: true,\n filename: path.join(__dirname, `../../views/mailers/${this.template}.html`),\n delimiter: '?'\n };\n self = this;\n template = this._getTemplate();\n return Promise.resolve().then(function() {\n email.html = ejs.render(template, email, options);\n return email;\n });\n }\n\n };\n\n BaseMailer.prototype.from = '简聊 ';\n\n BaseMailer.prototype.delay = 0;\n\n BaseMailer.prototype.action = 'delay';\n\n return BaseMailer;\n\n}).call(this);\n```", "response": "class BaseMailer\n\n from: '简聊 '\n\n delay: 0\n\n action: 'delay'\n\n constructor: ->\n @_getTemplate()\n\n _sendByRender: (email) ->\n self = this\n\n if email.html\n return self._send email\n\n @_render email\n .then (email) ->\n\n self._send email\n\n .catch (err) -> logger.warn err.stack\n\n _send: (email) ->\n # @osv\n return email\n _email =\n from: @from\n to: email.to\n subject: email.subject\n html: email.html\n action: @action\n delay: @delay\n id: email.id\n\n mailguy.send _email\n\n _render: (email) ->\n options =\n cache: true\n filename: path.join __dirname, \"../../views/mailers/#{@template}.html\"\n delimiter: '?'\n\n self = this\n template = @_getTemplate()\n Promise.resolve()\n .then ->\n email.html = ejs.render template, email, options\n email", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 15, "line_end": 64} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:1:completion", "type": "completion", "prompt": "class BaseMailer\n\n from: '简聊 '\n\n delay: 0\n\n action: 'delay'\n\n constructor: ->\n @_getTemplate()\n\n _sendByRender: (email) ->\n self = this\n\n if email.html\n return self._send email\n\n @_render email\n .then (email) ->\n\n self._send email\n\n .catch (err) -> logger.warn err.stack\n\n _send: (email) ->", "response": "# @osv\n return email\n _email =\n from: @from\n to: email.to\n subject: email.subject\n html: email.html\n action: @action\n delay: @delay\n id: email.id\n\n mailguy.send _email\n\n _render: (email) ->\n options =\n cache: true\n filename: path.join __dirname, \"../../views/mailers/#{@template}.html\"\n delimiter: '?'\n\n self = this\n template = @_getTemplate()\n Promise.resolve()\n .then ->\n email.html = ejs.render template, email, options\n email", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 15, "line_end": 64} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_cancel: (id) ->\n # @osv\n return id\n mailguy.send action: 'cancel', id: id\n\n _getTemplate: ->\n unless @_template\n templateFile = path.join __dirname, \"../../views/mailers/#{@template}.html\"\n template = fs.readFileSync templateFile, encoding: 'utf-8'\n juiceOptions =\n url: \"file://\" + path.join __dirname, \"../../views/mailers\"\n preserveMediaQueries: true\n html = ejs.render template, filename: templateFile\n html = juice html, juiceOptions\n html = html.replace /class=[\\\"|\\'].*?[\\\"\\']/ig, ''\n @_template = html\n @_template", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 65, "line_end": 82} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_cancel: (id) ->\n # @osv\n return id\n mailguy.send action: 'cancel', id: id\n\n _getTemplate: ->\n unless @_template\n templateFile = path.join __dirname, \"../../views/mailers/#{@template}.html\"\n template = fs.readFileSync templateFile, encoding: 'utf-8'\n juiceOptions =\n url: \"file://\" + path.join __dirname, \"../../views/mailers\"\n preserveMediaQueries: true\n html = ejs.render template, filename: templateFile\n html = juice html, juiceOptions\n html = html.replace /class=[\\\"|\\'].*?[\\\"\\']/ig, ''\n @_template = html\n @_template\n```", "response": "({\n _cancel: function(id) {\n // @osv\n return id;\n return mailguy.send({\n action: 'cancel',\n id: id\n });\n },\n _getTemplate: function() {\n var html, juiceOptions, template, templateFile;\n if (!this._template) {\n templateFile = path.join(__dirname, `../../views/mailers/${this.template}.html`);\n template = fs.readFileSync(templateFile, {\n encoding: 'utf-8'\n });\n juiceOptions = {\n url: \"file://\" + path.join(__dirname, \"../../views/mailers\"),\n preserveMediaQueries: true\n };\n html = ejs.render(template, {\n filename: templateFile\n });\n html = juice(html, juiceOptions);\n html = html.replace(/class=[\\\"|\\'].*?[\\\"\\']/ig, '');\n this._template = html;\n }\n return this._template;\n }\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 65, "line_end": 82} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n _cancel: function(id) {\n // @osv\n return id;\n return mailguy.send({\n action: 'cancel',\n id: id\n });\n },\n _getTemplate: function() {\n var html, juiceOptions, template, templateFile;\n if (!this._template) {\n templateFile = path.join(__dirname, `../../views/mailers/${this.template}.html`);\n template = fs.readFileSync(templateFile, {\n encoding: 'utf-8'\n });\n juiceOptions = {\n url: \"file://\" + path.join(__dirname, \"../../views/mailers\"),\n preserveMediaQueries: true\n };\n html = ejs.render(template, {\n filename: templateFile\n });\n html = juice(html, juiceOptions);\n html = html.replace(/class=[\\\"|\\'].*?[\\\"\\']/ig, '');\n this._template = html;\n }\n return this._template;\n }\n});\n```", "response": "_cancel: (id) ->\n # @osv\n return id\n mailguy.send action: 'cancel', id: id\n\n _getTemplate: ->\n unless @_template\n templateFile = path.join __dirname, \"../../views/mailers/#{@template}.html\"\n template = fs.readFileSync templateFile, encoding: 'utf-8'\n juiceOptions =\n url: \"file://\" + path.join __dirname, \"../../views/mailers\"\n preserveMediaQueries: true\n html = ejs.render template, filename: templateFile\n html = juice html, juiceOptions\n html = html.replace /class=[\\\"|\\'].*?[\\\"\\']/ig, ''\n @_template = html\n @_template", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 65, "line_end": 82} {"id": "jianliaoim/talk-os:talk-api2x/server/mailers/base.coffee:2:completion", "type": "completion", "prompt": "_cancel: (id) ->\n # @osv\n return id\n mailguy.send action: 'cancel', id: id\n\n _getTemplate: ->\n unless @_template\n templateFile = path.join __dirname, \"../../views/mailers/#{@template}.html\"", "response": "template = fs.readFileSync templateFile, encoding: 'utf-8'\n juiceOptions =\n url: \"file://\" + path.join __dirname, \"../../views/mailers\"\n preserveMediaQueries: true\n html = ejs.render template, filename: templateFile\n html = juice html, juiceOptions\n html = html.replace /class=[\\\"|\\'].*?[\\\"\\']/ig, ''\n @_template = html\n @_template", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/server/mailers/base.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/mailers/base.coffee", "line_start": 65, "line_end": 82} {"id": "oozcitak/xmlbuilder-js:test/dom/level3.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "suite 'DOM Level 3:', ->\n test 'DOMImplementation', ->\n ok( builder.implementation.hasFeature \"XML\", \"3.0\" )\n\n test 'Document', ->\n node = xml('root', { version: '1.1', encoding: 'UTF-8', standalone: true })\n\n eq( node.doc().xmlEncoding, 'UTF-8' )\n eq( node.doc().xmlVersion, '1.1' )\n eq( node.doc().xmlStandalone, true )\n\n test 'Node', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.textContent, 'text1text2' )\n\n test 'Text', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.children[0].wholeText, 'text1text2' )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/dom/level3.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/dom/level3.coffee", "line_start": 1, "line_end": 20} {"id": "oozcitak/xmlbuilder-js:test/dom/level3.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nsuite 'DOM Level 3:', ->\n test 'DOMImplementation', ->\n ok( builder.implementation.hasFeature \"XML\", \"3.0\" )\n\n test 'Document', ->\n node = xml('root', { version: '1.1', encoding: 'UTF-8', standalone: true })\n\n eq( node.doc().xmlEncoding, 'UTF-8' )\n eq( node.doc().xmlVersion, '1.1' )\n eq( node.doc().xmlStandalone, true )\n\n test 'Node', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.textContent, 'text1text2' )\n\n test 'Text', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.children[0].wholeText, 'text1text2' )\n```", "response": "suite('DOM Level 3:', function() {\n test('DOMImplementation', function() {\n return ok(builder.implementation.hasFeature(\"XML\", \"3.0\"));\n });\n test('Document', function() {\n var node;\n node = xml('root', {\n version: '1.1',\n encoding: 'UTF-8',\n standalone: true\n });\n eq(node.doc().xmlEncoding, 'UTF-8');\n eq(node.doc().xmlVersion, '1.1');\n return eq(node.doc().xmlStandalone, true);\n });\n test('Node', function() {\n var node;\n node = xml('root').ele('node').txt('text1').txt('text2');\n return eq(node.textContent, 'text1text2');\n });\n return test('Text', function() {\n var node;\n node = xml('root').ele('node').txt('text1').txt('text2');\n return eq(node.children[0].wholeText, 'text1text2');\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/dom/level3.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/dom/level3.coffee", "line_start": 1, "line_end": 20} {"id": "oozcitak/xmlbuilder-js:test/dom/level3.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nsuite('DOM Level 3:', function() {\n test('DOMImplementation', function() {\n return ok(builder.implementation.hasFeature(\"XML\", \"3.0\"));\n });\n test('Document', function() {\n var node;\n node = xml('root', {\n version: '1.1',\n encoding: 'UTF-8',\n standalone: true\n });\n eq(node.doc().xmlEncoding, 'UTF-8');\n eq(node.doc().xmlVersion, '1.1');\n return eq(node.doc().xmlStandalone, true);\n });\n test('Node', function() {\n var node;\n node = xml('root').ele('node').txt('text1').txt('text2');\n return eq(node.textContent, 'text1text2');\n });\n return test('Text', function() {\n var node;\n node = xml('root').ele('node').txt('text1').txt('text2');\n return eq(node.children[0].wholeText, 'text1text2');\n });\n});\n```", "response": "suite 'DOM Level 3:', ->\n test 'DOMImplementation', ->\n ok( builder.implementation.hasFeature \"XML\", \"3.0\" )\n\n test 'Document', ->\n node = xml('root', { version: '1.1', encoding: 'UTF-8', standalone: true })\n\n eq( node.doc().xmlEncoding, 'UTF-8' )\n eq( node.doc().xmlVersion, '1.1' )\n eq( node.doc().xmlStandalone, true )\n\n test 'Node', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.textContent, 'text1text2' )\n\n test 'Text', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.children[0].wholeText, 'text1text2' )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/dom/level3.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/dom/level3.coffee", "line_start": 1, "line_end": 20} {"id": "oozcitak/xmlbuilder-js:test/dom/level3.coffee:1:completion", "type": "completion", "prompt": "suite 'DOM Level 3:', ->\n test 'DOMImplementation', ->\n ok( builder.implementation.hasFeature \"XML\", \"3.0\" )\n\n test 'Document', ->\n node = xml('root', { version: '1.1', encoding: 'UTF-8', standalone: true })\n\n eq( node.doc().xmlEncoding, 'UTF-8' )\n eq( node.doc().xmlVersion, '1.1' )\n eq( node.doc().xmlStandalone, true )", "response": "test 'Node', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.textContent, 'text1text2' )\n\n test 'Text', ->\n node = xml('root').ele('node').txt('text1').txt('text2')\n\n eq( node.children[0].wholeText, 'text1text2' )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "oozcitak/xmlbuilder-js", "path": "test/dom/level3.coffee", "license": "MIT", "commit": "ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1", "stars": 926, "source_url": "https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/dom/level3.coffee", "line_start": 1, "line_end": 20} {"id": "twilson63/express-coffee:src/controllers/private.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports =\n\n # Lists all posts\n index: (req, res) ->\n res.send 'This is a private page.'\n\n # Create a session\n create: (req, res) ->\n req.session.authorized = 'test'\n res.redirect '/private'\n\n # Destroy a session\n destroy: (req, res) ->\n delete req.session.authorized\n res.redirect '/private'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "src/controllers/private.coffee", "license": "MIT", "commit": "baedde8ee076605eeaf56dd50eb72fe6d5621f8e", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/src/controllers/private.coffee", "line_start": 1, "line_end": 15} {"id": "twilson63/express-coffee:src/controllers/private.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports =\n\n # Lists all posts\n index: (req, res) ->\n res.send 'This is a private page.'\n\n # Create a session\n create: (req, res) ->\n req.session.authorized = 'test'\n res.redirect '/private'\n\n # Destroy a session\n destroy: (req, res) ->\n delete req.session.authorized\n res.redirect '/private'\n```", "response": "module.exports = {\n // Lists all posts\n index: function(req, res) {\n return res.send('This is a private page.');\n },\n // Create a session\n create: function(req, res) {\n req.session.authorized = 'test';\n return res.redirect('/private');\n },\n // Destroy a session\n destroy: function(req, res) {\n delete req.session.authorized;\n return res.redirect('/private');\n }\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "twilson63/express-coffee", "path": "src/controllers/private.coffee", "license": "MIT", "commit": "baedde8ee076605eeaf56dd50eb72fe6d5621f8e", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/src/controllers/private.coffee", "line_start": 1, "line_end": 15} {"id": "twilson63/express-coffee:src/controllers/private.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = {\n // Lists all posts\n index: function(req, res) {\n return res.send('This is a private page.');\n },\n // Create a session\n create: function(req, res) {\n req.session.authorized = 'test';\n return res.redirect('/private');\n },\n // Destroy a session\n destroy: function(req, res) {\n delete req.session.authorized;\n return res.redirect('/private');\n }\n};\n```", "response": "module.exports =\n\n # Lists all posts\n index: (req, res) ->\n res.send 'This is a private page.'\n\n # Create a session\n create: (req, res) ->\n req.session.authorized = 'test'\n res.redirect '/private'\n\n # Destroy a session\n destroy: (req, res) ->\n delete req.session.authorized\n res.redirect '/private'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "src/controllers/private.coffee", "license": "MIT", "commit": "baedde8ee076605eeaf56dd50eb72fe6d5621f8e", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/src/controllers/private.coffee", "line_start": 1, "line_end": 15} {"id": "twilson63/express-coffee:src/controllers/private.coffee:1:completion", "type": "completion", "prompt": "module.exports =\n\n # Lists all posts\n index: (req, res) ->\n res.send 'This is a private page.'\n\n # Create a session", "response": "create: (req, res) ->\n req.session.authorized = 'test'\n res.redirect '/private'\n\n # Destroy a session\n destroy: (req, res) ->\n delete req.session.authorized\n res.redirect '/private'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "twilson63/express-coffee", "path": "src/controllers/private.coffee", "license": "MIT", "commit": "baedde8ee076605eeaf56dd50eb72fe6d5621f8e", "stars": 622, "source_url": "https://github.com/twilson63/express-coffee/blob/baedde8ee076605eeaf56dd50eb72fe6d5621f8e/src/controllers/private.coffee", "line_start": 1, "line_end": 15} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n isPreInstalled: false\n\n options:\n PHP: false\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 31} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n isPreInstalled: false\n\n options:\n PHP: false\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )\n```", "response": "/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)], {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then(function(output) {\n // hh_format can exit with status 0 and no output for some files which\n // it doesn't format. In that case we just return original text.\n if (output.trim()) {\n return output;\n } else {\n return this.Promise.resolve(new Error(\"hh_format returned an empty output.\"));\n }\n });\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.isPreInstalled = false;\n\n HhFormat.prototype.options = {\n PHP: false\n };\n\n return HhFormat;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 31} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)], {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then(function(output) {\n // hh_format can exit with status 0 and no output for some files which\n // it doesn't format. In that case we just return original text.\n if (output.trim()) {\n return output;\n } else {\n return this.Promise.resolve(new Error(\"hh_format returned an empty output.\"));\n }\n });\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.isPreInstalled = false;\n\n HhFormat.prototype.options = {\n PHP: false\n };\n\n return HhFormat;\n\n}).call(this);\n```", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n isPreInstalled: false\n\n options:\n PHP: false\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 31} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:completion", "type": "completion", "prompt": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n isPreInstalled: false\n\n options:\n PHP: false", "response": "beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "41d5051b399f7fe11efd149504a232df16179d60", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 31} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: false\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "4b1a1a8292e3d767d6119c222efbc9b9c6127900", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/4b1a1a8292e3d767d6119c222efbc9b9c6127900/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 30} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: false\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )\n```", "response": "/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)], {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then(function(output) {\n // hh_format can exit with status 0 and no output for some files which\n // it doesn't format. In that case we just return original text.\n if (output.trim()) {\n return output;\n } else {\n return this.Promise.resolve(new Error(\"hh_format returned an empty output.\"));\n }\n });\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: false\n };\n\n return HhFormat;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "4b1a1a8292e3d767d6119c222efbc9b9c6127900", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/4b1a1a8292e3d767d6119c222efbc9b9c6127900/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 30} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)], {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then(function(output) {\n // hh_format can exit with status 0 and no output for some files which\n // it doesn't format. In that case we just return original text.\n if (output.trim()) {\n return output;\n } else {\n return this.Promise.resolve(new Error(\"hh_format returned an empty output.\"));\n }\n });\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: false\n };\n\n return HhFormat;\n\n}).call(this);\n```", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: false\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "4b1a1a8292e3d767d6119c222efbc9b9c6127900", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/4b1a1a8292e3d767d6119c222efbc9b9c6127900/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 30} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:completion", "type": "completion", "prompt": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: false\n\n beautify: (text, language, options) ->", "response": "@run(\"hh_format\", [\n @tempFile(\"input\", text)\n ],\n {\n help: {\n link: \"http://hhvm.com/\"\n }\n }).then((output) ->\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim()\n output\n else\n @Promise.resolve(new Error(\"hh_format returned an empty output.\"))\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "4b1a1a8292e3d767d6119c222efbc9b9c6127900", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/4b1a1a8292e3d767d6119c222efbc9b9c6127900/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 30} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ]).then((output) =>\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim() then output else text\n )", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "d4506b844ab9f7fd178930a258098ce25c5f232b", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d4506b844ab9f7fd178930a258098ce25c5f232b/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 22} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ]).then((output) =>\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim() then output else text\n )\n```", "response": "/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)]).then((output) => {\n // hh_format can exit with status 0 and no output for some files which\n // it doesn't format. In that case we just return original text.\n if (output.trim()) {\n return output;\n } else {\n return text;\n }\n });\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: true\n };\n\n return HhFormat;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "d4506b844ab9f7fd178930a258098ce25c5f232b", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d4506b844ab9f7fd178930a258098ce25c5f232b/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 22} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)]).then((output) => {\n // hh_format can exit with status 0 and no output for some files which\n // it doesn't format. In that case we just return original text.\n if (output.trim()) {\n return output;\n } else {\n return text;\n }\n });\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: true\n };\n\n return HhFormat;\n\n}).call(this);\n```", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ]).then((output) =>\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim() then output else text\n )", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "d4506b844ab9f7fd178930a258098ce25c5f232b", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d4506b844ab9f7fd178930a258098ce25c5f232b/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 22} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:completion", "type": "completion", "prompt": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"", "response": "options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ]).then((output) =>\n # hh_format can exit with status 0 and no output for some files which\n # it doesn't format. In that case we just return original text.\n if output.trim() then output else text\n )", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "d4506b844ab9f7fd178930a258098ce25c5f232b", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/d4506b844ab9f7fd178930a258098ce25c5f232b/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 22} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ])", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "3be57b6c56e03a0726334d2dda6203aad76591c4", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/3be57b6c56e03a0726334d2dda6203aad76591c4/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 18} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ])\n```", "response": "/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)]);\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: true\n };\n\n return HhFormat;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "3be57b6c56e03a0726334d2dda6203aad76591c4", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/3be57b6c56e03a0726334d2dda6203aad76591c4/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 18} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [this.tempFile(\"input\", text)]);\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: true\n };\n\n return HhFormat;\n\n}).call(this);\n```", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ])", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "3be57b6c56e03a0726334d2dda6203aad76591c4", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/3be57b6c56e03a0726334d2dda6203aad76591c4/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 18} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:completion", "type": "completion", "prompt": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"", "response": "link: \"http://hhvm.com/\"\n\n options:\n PHP: true\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n @tempFile(\"input\", text)\n ])", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "3be57b6c56e03a0726334d2dda6203aad76591c4", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/3be57b6c56e03a0726334d2dda6203aad76591c4/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 18} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options: {\n PHP: true\n }\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n \"-i\",\n @tempFile(\"input\", text)\n ])", "source_lang": "", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "afc0919252fd5592854e1fb5e0fa0a066374ffd2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/afc0919252fd5592854e1fb5e0fa0a066374ffd2/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 20} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options: {\n PHP: true\n }\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n \"-i\",\n @tempFile(\"input\", text)\n ])\n```", "response": "/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [\"-i\", this.tempFile(\"input\", text)]);\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: true\n };\n\n return HhFormat;\n\n}).call(this);", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "afc0919252fd5592854e1fb5e0fa0a066374ffd2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/afc0919252fd5592854e1fb5e0fa0a066374ffd2/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 20} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n/*\nRequires http://hhvm.com/\n*/\n\"use strict\";\nvar Beautifier, HhFormat;\n\nBeautifier = require('./beautifier');\n\nmodule.exports = HhFormat = (function() {\n class HhFormat extends Beautifier {\n beautify(text, language, options) {\n return this.run(\"hh_format\", [\"-i\", this.tempFile(\"input\", text)]);\n }\n\n };\n\n HhFormat.prototype.name = \"hh_format\";\n\n HhFormat.prototype.link = \"http://hhvm.com/\";\n\n HhFormat.prototype.options = {\n PHP: true\n };\n\n return HhFormat;\n\n}).call(this);\n```", "response": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"\n\n options: {\n PHP: true\n }\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n \"-i\",\n @tempFile(\"input\", text)\n ])", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "afc0919252fd5592854e1fb5e0fa0a066374ffd2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/afc0919252fd5592854e1fb5e0fa0a066374ffd2/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 20} {"id": "Glavin001/atom-beautify:src/beautifiers/hh_format.coffee:1:completion", "type": "completion", "prompt": "###\nRequires http://hhvm.com/\n###\n\n\"use strict\"\nBeautifier = require('./beautifier')\n\nmodule.exports = class HhFormat extends Beautifier\n name: \"hh_format\"\n link: \"http://hhvm.com/\"", "response": "options: {\n PHP: true\n }\n\n beautify: (text, language, options) ->\n @run(\"hh_format\", [\n \"-i\",\n @tempFile(\"input\", text)\n ])", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "Glavin001/atom-beautify", "path": "src/beautifiers/hh_format.coffee", "license": "MIT", "commit": "afc0919252fd5592854e1fb5e0fa0a066374ffd2", "stars": 1503, "source_url": "https://github.com/Glavin001/atom-beautify/blob/afc0919252fd5592854e1fb5e0fa0a066374ffd2/src/beautifiers/hh_format.coffee", "line_start": 1, "line_end": 20} {"id": "jianliaoim/talk-os:talk-api2x/mshells/migrate-activities.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "_startId = ObjectId(Math.round(ISODate(\"2016-02-29T16:00:00.000Z\") / 1000).toString(16) + new Array(17).join('0'))\n\nrooms = db.rooms.find\n _id: $gt: _startId\n isGeneral: false\n isArchived: false\n\nrooms.forEach (room) ->\n activity = db.activities.findOne target: room._id\n return if activity\n activity =\n team: room.team\n target: room._id\n type: 'room'\n creator: room.creator\n text: \"{{__info-create-room}}\"\n createdAt: room.createdAt\n updatedAt: room.createdAt\n\n if room.isPrivate\n activity.isPublic = false\n roomMembers = db.members.find\n room: room._id\n isQuit: false\n ,\n user: 1\n activity.members = roomMembers.map (member) ->\n member.user\n .filter (memberId) -> memberId\n else\n activity.isPublic = true\n\n print '保存动态', room._id\n db.activities.save(activity)\n\nstories = db.stories.find\n _id: $gt: _startId\n\nstories.forEach (story) ->\n activity = db.activities.findOne target: story._id\n return if activity\n\n activity =\n team: story.team\n target: story._id\n type: 'story'\n creator: story.creator\n isPublic: story.isPublic\n createdAt: story.createdAt\n updatedAt: story.createdAt", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/migrate-activities.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/migrate-activities.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-api2x/mshells/migrate-activities.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n_startId = ObjectId(Math.round(ISODate(\"2016-02-29T16:00:00.000Z\") / 1000).toString(16) + new Array(17).join('0'))\n\nrooms = db.rooms.find\n _id: $gt: _startId\n isGeneral: false\n isArchived: false\n\nrooms.forEach (room) ->\n activity = db.activities.findOne target: room._id\n return if activity\n activity =\n team: room.team\n target: room._id\n type: 'room'\n creator: room.creator\n text: \"{{__info-create-room}}\"\n createdAt: room.createdAt\n updatedAt: room.createdAt\n\n if room.isPrivate\n activity.isPublic = false\n roomMembers = db.members.find\n room: room._id\n isQuit: false\n ,\n user: 1\n activity.members = roomMembers.map (member) ->\n member.user\n .filter (memberId) -> memberId\n else\n activity.isPublic = true\n\n print '保存动态', room._id\n db.activities.save(activity)\n\nstories = db.stories.find\n _id: $gt: _startId\n\nstories.forEach (story) ->\n activity = db.activities.findOne target: story._id\n return if activity\n\n activity =\n team: story.team\n target: story._id\n type: 'story'\n creator: story.creator\n isPublic: story.isPublic\n createdAt: story.createdAt\n updatedAt: story.createdAt\n```", "response": "var _startId, rooms, stories;\n\n_startId = ObjectId(Math.round(ISODate(\"2016-02-29T16:00:00.000Z\") / 1000).toString(16) + new Array(17).join('0'));\n\nrooms = db.rooms.find({\n _id: {\n $gt: _startId\n },\n isGeneral: false,\n isArchived: false\n});\n\nrooms.forEach(function(room) {\n var activity, roomMembers;\n activity = db.activities.findOne({\n target: room._id\n });\n if (activity) {\n return;\n }\n activity = {\n team: room.team,\n target: room._id,\n type: 'room',\n creator: room.creator,\n text: \"{{__info-create-room}}\",\n createdAt: room.createdAt,\n updatedAt: room.createdAt\n };\n if (room.isPrivate) {\n activity.isPublic = false;\n roomMembers = db.members.find({\n room: room._id,\n isQuit: false\n }, {\n user: 1\n });\n activity.members = roomMembers.map(function(member) {\n return member.user;\n }).filter(function(memberId) {\n return memberId;\n });\n } else {\n activity.isPublic = true;\n }\n print('保存动态', room._id);\n return db.activities.save(activity);\n});\n\nstories = db.stories.find({\n _id: {\n $gt: _startId\n }\n});\n\nstories.forEach(function(story) {\n var activity;\n activity = db.activities.findOne({\n target: story._id\n });\n if (activity) {\n return;\n }\n return activity = {\n team: story.team,\n target: story._id,\n type: 'story',\n creator: story.creator,\n isPublic: story.isPublic,\n createdAt: story.createdAt,\n updatedAt: story.createdAt\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/migrate-activities.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/migrate-activities.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-api2x/mshells/migrate-activities.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar _startId, rooms, stories;\n\n_startId = ObjectId(Math.round(ISODate(\"2016-02-29T16:00:00.000Z\") / 1000).toString(16) + new Array(17).join('0'));\n\nrooms = db.rooms.find({\n _id: {\n $gt: _startId\n },\n isGeneral: false,\n isArchived: false\n});\n\nrooms.forEach(function(room) {\n var activity, roomMembers;\n activity = db.activities.findOne({\n target: room._id\n });\n if (activity) {\n return;\n }\n activity = {\n team: room.team,\n target: room._id,\n type: 'room',\n creator: room.creator,\n text: \"{{__info-create-room}}\",\n createdAt: room.createdAt,\n updatedAt: room.createdAt\n };\n if (room.isPrivate) {\n activity.isPublic = false;\n roomMembers = db.members.find({\n room: room._id,\n isQuit: false\n }, {\n user: 1\n });\n activity.members = roomMembers.map(function(member) {\n return member.user;\n }).filter(function(memberId) {\n return memberId;\n });\n } else {\n activity.isPublic = true;\n }\n print('保存动态', room._id);\n return db.activities.save(activity);\n});\n\nstories = db.stories.find({\n _id: {\n $gt: _startId\n }\n});\n\nstories.forEach(function(story) {\n var activity;\n activity = db.activities.findOne({\n target: story._id\n });\n if (activity) {\n return;\n }\n return activity = {\n team: story.team,\n target: story._id,\n type: 'story',\n creator: story.creator,\n isPublic: story.isPublic,\n createdAt: story.createdAt,\n updatedAt: story.createdAt\n };\n});\n```", "response": "_startId = ObjectId(Math.round(ISODate(\"2016-02-29T16:00:00.000Z\") / 1000).toString(16) + new Array(17).join('0'))\n\nrooms = db.rooms.find\n _id: $gt: _startId\n isGeneral: false\n isArchived: false\n\nrooms.forEach (room) ->\n activity = db.activities.findOne target: room._id\n return if activity\n activity =\n team: room.team\n target: room._id\n type: 'room'\n creator: room.creator\n text: \"{{__info-create-room}}\"\n createdAt: room.createdAt\n updatedAt: room.createdAt\n\n if room.isPrivate\n activity.isPublic = false\n roomMembers = db.members.find\n room: room._id\n isQuit: false\n ,\n user: 1\n activity.members = roomMembers.map (member) ->\n member.user\n .filter (memberId) -> memberId\n else\n activity.isPublic = true\n\n print '保存动态', room._id\n db.activities.save(activity)\n\nstories = db.stories.find\n _id: $gt: _startId\n\nstories.forEach (story) ->\n activity = db.activities.findOne target: story._id\n return if activity\n\n activity =\n team: story.team\n target: story._id\n type: 'story'\n creator: story.creator\n isPublic: story.isPublic\n createdAt: story.createdAt\n updatedAt: story.createdAt", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/migrate-activities.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/migrate-activities.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-api2x/mshells/migrate-activities.coffee:1:completion", "type": "completion", "prompt": "_startId = ObjectId(Math.round(ISODate(\"2016-02-29T16:00:00.000Z\") / 1000).toString(16) + new Array(17).join('0'))\n\nrooms = db.rooms.find\n _id: $gt: _startId\n isGeneral: false\n isArchived: false\n\nrooms.forEach (room) ->\n activity = db.activities.findOne target: room._id\n return if activity\n activity =\n team: room.team\n target: room._id\n type: 'room'\n creator: room.creator\n text: \"{{__info-create-room}}\"\n createdAt: room.createdAt\n updatedAt: room.createdAt\n\n if room.isPrivate\n activity.isPublic = false\n roomMembers = db.members.find\n room: room._id\n isQuit: false\n ,", "response": "user: 1\n activity.members = roomMembers.map (member) ->\n member.user\n .filter (memberId) -> memberId\n else\n activity.isPublic = true\n\n print '保存动态', room._id\n db.activities.save(activity)\n\nstories = db.stories.find\n _id: $gt: _startId\n\nstories.forEach (story) ->\n activity = db.activities.findOne target: story._id\n return if activity\n\n activity =\n team: story.team\n target: story._id\n type: 'story'\n creator: story.creator\n isPublic: story.isPublic\n createdAt: story.createdAt\n updatedAt: story.createdAt", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/migrate-activities.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/migrate-activities.coffee", "line_start": 1, "line_end": 50} {"id": "jianliaoim/talk-os:talk-api2x/mshells/migrate-activities.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "activity.members = story.members if story.members?.length\n\n switch story.category\n when 'topic' then activity.text = '{{__info-create-topic-story}}'\n when 'file' then activity.text = '{{__info-create-file-story}}'\n when 'link' then activity.text = '{{__info-create-link-story}}'\n else return\n\n print '保存动态', story._id\n db.activities.save(activity)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/migrate-activities.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/migrate-activities.coffee", "line_start": 51, "line_end": 61} {"id": "jianliaoim/talk-os:talk-api2x/mshells/migrate-activities.coffee:2:completion", "type": "completion", "prompt": "activity.members = story.members if story.members?.length\n\n switch story.category\n when 'topic' then activity.text = '{{__info-create-topic-story}}'\n when 'file' then activity.text = '{{__info-create-file-story}}'", "response": "when 'link' then activity.text = '{{__info-create-link-story}}'\n else return\n\n print '保存动态', story._id\n db.activities.save(activity)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "jianliaoim/talk-os", "path": "talk-api2x/mshells/migrate-activities.coffee", "license": "MIT", "commit": "2545c4497865779a55762e03963a39237df9046b", "stars": 2703, "source_url": "https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/mshells/migrate-activities.coffee", "line_start": 51, "line_end": 61} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "[VariableParser, countLines] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n VariableParser ?= require './variable-parser'\n\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n\n countLines ?= require('./utils').countLines\n\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/variable-scanner.coffee", "line_start": 1, "line_end": 49} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n[VariableParser, countLines] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n VariableParser ?= require './variable-parser'\n\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n\n countLines ?= require('./utils').countLines\n\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined\n```", "response": "var VariableParser, VariableScanner, countLines;\n\n[VariableParser, countLines] = [];\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n if (VariableParser == null) {\n VariableParser = require('./variable-parser');\n }\n ({parser: this.parser, registry: this.registry, scope: this.scope} = params);\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return new RegExp(this.registry.getRegExpForScope(this.scope), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n if (this.registry.getExpressionsForScope(this.scope).length === 0) {\n return;\n }\n if (countLines == null) {\n countLines = require('./utils').countLines;\n }\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/variable-scanner.coffee", "line_start": 1, "line_end": 49} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar VariableParser, VariableScanner, countLines;\n\n[VariableParser, countLines] = [];\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n if (VariableParser == null) {\n VariableParser = require('./variable-parser');\n }\n ({parser: this.parser, registry: this.registry, scope: this.scope} = params);\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return new RegExp(this.registry.getRegExpForScope(this.scope), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n if (this.registry.getExpressionsForScope(this.scope).length === 0) {\n return;\n }\n if (countLines == null) {\n countLines = require('./utils').countLines;\n }\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};\n```", "response": "[VariableParser, countLines] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n VariableParser ?= require './variable-parser'\n\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n\n countLines ?= require('./utils').countLines\n\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/variable-scanner.coffee", "line_start": 1, "line_end": 49} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:completion", "type": "completion", "prompt": "[VariableParser, countLines] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n VariableParser ?= require './variable-parser'\n\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n\n countLines ?= require('./utils').countLines\n\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match", "response": "{lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/variable-scanner.coffee", "line_start": 1, "line_end": 49} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "36f562cc2c51fe076f776f2e84d707d978a9e906", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined\n```", "response": "var VariableParser, VariableScanner, countLines;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry, scope: this.scope} = params);\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return new RegExp(this.registry.getRegExpForScope(this.scope), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n if (this.registry.getExpressionsForScope(this.scope).length === 0) {\n return;\n }\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "36f562cc2c51fe076f776f2e84d707d978a9e906", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar VariableParser, VariableScanner, countLines;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry, scope: this.scope} = params);\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return new RegExp(this.registry.getRegExpForScope(this.scope), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n if (this.registry.getExpressionsForScope(this.scope).length === 0) {\n return;\n }\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};\n```", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "36f562cc2c51fe076f776f2e84d707d978a9e906", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:completion", "type": "completion", "prompt": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry, @scope} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n new RegExp(@registry.getRegExpForScope(@scope), 'gm')\n\n search: (text, start=0) ->\n return if @registry.getExpressionsForScope(@scope).length is 0\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp", "response": "result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "36f562cc2c51fe076f776f2e84d707d978a9e906", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/36f562cc2c51fe076f776f2e84d707d978a9e906/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "5de42ccee66d85444fe32c70d7dd5dae7725fa6d", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/variable-scanner.coffee", "line_start": 1, "line_end": 44} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined\n```", "response": "var VariableParser, VariableScanner, countLines;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry} = params);\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return this.regexp != null ? this.regexp : this.regexp = new RegExp(this.registry.getRegExp(), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "5de42ccee66d85444fe32c70d7dd5dae7725fa6d", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/variable-scanner.coffee", "line_start": 1, "line_end": 44} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar VariableParser, VariableScanner, countLines;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry} = params);\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return this.regexp != null ? this.regexp : this.regexp = new RegExp(this.registry.getRegExp(), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};\n```", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "5de42ccee66d85444fe32c70d7dd5dae7725fa6d", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/variable-scanner.coffee", "line_start": 1, "line_end": 44} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:completion", "type": "completion", "prompt": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)", "response": "if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "5de42ccee66d85444fe32c70d7dd5dae7725fa6d", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/5de42ccee66d85444fe32c70d7dd5dae7725fa6d/lib/variable-scanner.coffee", "line_start": 1, "line_end": 44} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @registry ?= require './variable-expressions'\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "f3b332c5f1a3d6ef9346083614f49897fb9e7359", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/f3b332c5f1a3d6ef9346083614f49897fb9e7359/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @registry ?= require './variable-expressions'\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined\n```", "response": "var VariableParser, VariableScanner, countLines;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry} = params);\n if (this.registry == null) {\n this.registry = require('./variable-expressions');\n }\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return this.regexp != null ? this.regexp : this.regexp = new RegExp(this.registry.getRegExp(), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "f3b332c5f1a3d6ef9346083614f49897fb9e7359", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/f3b332c5f1a3d6ef9346083614f49897fb9e7359/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar VariableParser, VariableScanner, countLines;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry} = params);\n if (this.registry == null) {\n this.registry = require('./variable-expressions');\n }\n if (this.parser == null) {\n this.parser = new VariableParser(this.registry);\n }\n }\n\n getRegExp() {\n return this.regexp != null ? this.regexp : this.regexp = new RegExp(this.registry.getRegExp(), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};\n```", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @registry ?= require './variable-expressions'\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "f3b332c5f1a3d6ef9346083614f49897fb9e7359", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/f3b332c5f1a3d6ef9346083614f49897fb9e7359/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:completion", "type": "completion", "prompt": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @registry ?= require './variable-expressions'\n @parser ?= new VariableParser(@registry)\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp", "response": "result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "f3b332c5f1a3d6ef9346083614f49897fb9e7359", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/f3b332c5f1a3d6ef9346083614f49897fb9e7359/lib/variable-scanner.coffee", "line_start": 1, "line_end": 45} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser\n @registry ?= require './variable-expressions'\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "c62a322078c417a780cdeee1d99caf703843873e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c62a322078c417a780cdeee1d99caf703843873e/lib/variable-scanner.coffee", "line_start": 1, "line_end": 46} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser\n @registry ?= require './variable-expressions'\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined\n```", "response": "var VariableParser, VariableScanner, countLines, registry;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\n[registry] = [];\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry} = params);\n if (this.parser == null) {\n this.parser = new VariableParser();\n }\n if (this.registry == null) {\n this.registry = require('./variable-expressions');\n }\n }\n\n getRegExp() {\n return this.regexp != null ? this.regexp : this.regexp = new RegExp(this.registry.getRegExp(), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "c62a322078c417a780cdeee1d99caf703843873e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c62a322078c417a780cdeee1d99caf703843873e/lib/variable-scanner.coffee", "line_start": 1, "line_end": 46} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar VariableParser, VariableScanner, countLines, registry;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\n[registry] = [];\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser, registry: this.registry} = params);\n if (this.parser == null) {\n this.parser = new VariableParser();\n }\n if (this.registry == null) {\n this.registry = require('./variable-expressions');\n }\n }\n\n getRegExp() {\n return this.regexp != null ? this.regexp : this.regexp = new RegExp(this.registry.getRegExp(), 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, regexp, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};\n```", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser\n @registry ?= require './variable-expressions'\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "c62a322078c417a780cdeee1d99caf703843873e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c62a322078c417a780cdeee1d99caf703843873e/lib/variable-scanner.coffee", "line_start": 1, "line_end": 46} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:completion", "type": "completion", "prompt": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser, @registry} = params\n @parser ?= new VariableParser\n @registry ?= require './variable-expressions'\n\n getRegExp: ->\n @regexp ?= new RegExp(@registry.getRegExp(), 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp", "response": "result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "c62a322078c417a780cdeee1d99caf703843873e", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/c62a322078c417a780cdeee1d99caf703843873e/lib/variable-scanner.coffee", "line_start": 1, "line_end": 46} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry, regexpString, regexp] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser} = params\n @parser ?= new VariableParser\n\n getRegExp: ->\n registry ?= require './variable-expressions'\n regexpString ?= registry.getRegExp()\n\n regexp ?= new RegExp(regexpString, 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/variable-scanner.coffee", "line_start": 1, "line_end": 48} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry, regexpString, regexp] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser} = params\n @parser ?= new VariableParser\n\n getRegExp: ->\n registry ?= require './variable-expressions'\n regexpString ?= registry.getRegExp()\n\n regexp ?= new RegExp(regexpString, 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined\n```", "response": "var VariableParser, VariableScanner, countLines, regexp, regexpString, registry;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\n[registry, regexpString, regexp] = [];\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser} = params);\n if (this.parser == null) {\n this.parser = new VariableParser();\n }\n }\n\n getRegExp() {\n if (registry == null) {\n registry = require('./variable-expressions');\n }\n if (regexpString == null) {\n regexpString = registry.getRegExp();\n }\n return regexp != null ? regexp : regexp = new RegExp(regexpString, 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/variable-scanner.coffee", "line_start": 1, "line_end": 48} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar VariableParser, VariableScanner, countLines, regexp, regexpString, registry;\n\n({countLines} = require('./utils'));\n\nVariableParser = require('./variable-parser');\n\n[registry, regexpString, regexp] = [];\n\nmodule.exports = VariableScanner = class VariableScanner {\n constructor(params = {}) {\n ({parser: this.parser} = params);\n if (this.parser == null) {\n this.parser = new VariableParser();\n }\n }\n\n getRegExp() {\n if (registry == null) {\n registry = require('./variable-expressions');\n }\n if (regexpString == null) {\n regexpString = registry.getRegExp();\n }\n return regexp != null ? regexp : regexp = new RegExp(regexpString, 'gm');\n }\n\n search(text, start = 0) {\n var i, index, lastIndex, len, line, lineCountIndex, match, matchText, result, v;\n regexp = this.getRegExp();\n regexp.lastIndex = start;\n while (match = regexp.exec(text)) {\n [matchText] = match;\n ({index} = match);\n ({lastIndex} = regexp);\n result = this.parser.parse(matchText);\n if (result != null) {\n result.lastIndex += index;\n if (result.length > 0) {\n result.range[0] += index;\n result.range[1] += index;\n line = -1;\n lineCountIndex = 0;\n for (i = 0, len = result.length; i < len; i++) {\n v = result[i];\n v.range[0] += index;\n v.range[1] += index;\n line = v.line = line + countLines(text.slice(lineCountIndex, +v.range[0] + 1 || 9e9));\n lineCountIndex = v.range[0];\n }\n return result;\n } else {\n regexp.lastIndex = result.lastIndex;\n }\n }\n }\n return void 0;\n }\n\n};\n```", "response": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry, regexpString, regexp] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser} = params\n @parser ?= new VariableParser\n\n getRegExp: ->\n registry ?= require './variable-expressions'\n regexpString ?= registry.getRegExp()\n\n regexp ?= new RegExp(regexpString, 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp\n\n result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/variable-scanner.coffee", "line_start": 1, "line_end": 48} {"id": "abe33/atom-pigments:lib/variable-scanner.coffee:1:completion", "type": "completion", "prompt": "{countLines} = require './utils'\nVariableParser = require './variable-parser'\n[registry, regexpString, regexp] = []\n\nmodule.exports =\nclass VariableScanner\n constructor: (params={}) ->\n {@parser} = params\n @parser ?= new VariableParser\n\n getRegExp: ->\n registry ?= require './variable-expressions'\n regexpString ?= registry.getRegExp()\n\n regexp ?= new RegExp(regexpString, 'gm')\n\n search: (text, start=0) ->\n regexp = @getRegExp()\n regexp.lastIndex = start\n\n while match = regexp.exec(text)\n [matchText] = match\n {index} = match\n {lastIndex} = regexp", "response": "result = @parser.parse(matchText)\n\n if result?\n result.lastIndex += index\n\n if result.length > 0\n result.range[0] += index\n result.range[1] += index\n\n line = -1\n lineCountIndex = 0\n\n for v in result\n v.range[0] += index\n v.range[1] += index\n line = v.line = line + countLines(text[lineCountIndex..v.range[0]])\n lineCountIndex = v.range[0]\n\n return result\n else\n regexp.lastIndex = result.lastIndex\n\n return undefined", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "abe33/atom-pigments", "path": "lib/variable-scanner.coffee", "license": "MIT", "commit": "6b9b5368e8a617bbb73ccdb1da96350aba9fd444", "stars": 518, "source_url": "https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/variable-scanner.coffee", "line_start": 1, "line_end": 48} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add:Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add:Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'\n```", "response": "// some unused icons/actions\n// {icon:'icon-user-add', action:'adduser'}\n// {icon:'icon-pencil', action:'renameconv'}\n// {icon:'icon-videocam', action:'videocall'}\n// {icon:'icon-phone', action:'voicecall'}\nvar onclickaction;\n\nonclickaction = function(a) {\n return function(ev) {\n return action(a);\n };\n};\n\nmodule.exports = view(function(models) {\n var c, conv, viewstate;\n ({conv, viewstate} = models);\n c = conv[viewstate.selectedConv];\n return div({\n class: 'controls'\n }, function() {\n return div({\n class: 'button',\n title: i18n.__('conversation.add:Add new conversation')\n }, {\n onclick: onclickaction('addconversation')\n }, function() {\n return span({\n class: 'material-icons'\n }, 'add');\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// some unused icons/actions\n// {icon:'icon-user-add', action:'adduser'}\n// {icon:'icon-pencil', action:'renameconv'}\n// {icon:'icon-videocam', action:'videocall'}\n// {icon:'icon-phone', action:'voicecall'}\nvar onclickaction;\n\nonclickaction = function(a) {\n return function(ev) {\n return action(a);\n };\n};\n\nmodule.exports = view(function(models) {\n var c, conv, viewstate;\n ({conv, viewstate} = models);\n c = conv[viewstate.selectedConv];\n return div({\n class: 'controls'\n }, function() {\n return div({\n class: 'button',\n title: i18n.__('conversation.add:Add new conversation')\n }, {\n onclick: onclickaction('addconversation')\n }, function() {\n return span({\n class: 'material-icons'\n }, 'add');\n });\n });\n});\n```", "response": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add:Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:completion", "type": "completion", "prompt": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a", "response": "module.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add:Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "9d5ec987bb380d1b6e2f588f509f15fd287300c3", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'\n```", "response": "// some unused icons/actions\n// {icon:'icon-user-add', action:'adduser'}\n// {icon:'icon-pencil', action:'renameconv'}\n// {icon:'icon-videocam', action:'videocall'}\n// {icon:'icon-phone', action:'voicecall'}\nvar onclickaction;\n\nonclickaction = function(a) {\n return function(ev) {\n return action(a);\n };\n};\n\nmodule.exports = view(function(models) {\n var c, conv, viewstate;\n ({conv, viewstate} = models);\n c = conv[viewstate.selectedConv];\n return div({\n class: 'controls'\n }, function() {\n return div({\n class: 'button',\n title: i18n.__('conversation.add')\n }, {\n onclick: onclickaction('addconversation')\n }, function() {\n return span({\n class: 'material-icons'\n }, 'add');\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "9d5ec987bb380d1b6e2f588f509f15fd287300c3", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// some unused icons/actions\n// {icon:'icon-user-add', action:'adduser'}\n// {icon:'icon-pencil', action:'renameconv'}\n// {icon:'icon-videocam', action:'videocall'}\n// {icon:'icon-phone', action:'voicecall'}\nvar onclickaction;\n\nonclickaction = function(a) {\n return function(ev) {\n return action(a);\n };\n};\n\nmodule.exports = view(function(models) {\n var c, conv, viewstate;\n ({conv, viewstate} = models);\n c = conv[viewstate.selectedConv];\n return div({\n class: 'controls'\n }, function() {\n return div({\n class: 'button',\n title: i18n.__('conversation.add')\n }, {\n onclick: onclickaction('addconversation')\n }, function() {\n return span({\n class: 'material-icons'\n }, 'add');\n });\n });\n});\n```", "response": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "9d5ec987bb380d1b6e2f588f509f15fd287300c3", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:completion", "type": "completion", "prompt": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a", "response": "module.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('conversation.add'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "9d5ec987bb380d1b6e2f588f509f15fd287300c3", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/9d5ec987bb380d1b6e2f588f509f15fd287300c3/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "a39f0e9e0ff32ba2f891b57d033961c3161b801e", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/a39f0e9e0ff32ba2f891b57d033961c3161b801e/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\n# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'\n```", "response": "// some unused icons/actions\n// {icon:'icon-user-add', action:'adduser'}\n// {icon:'icon-pencil', action:'renameconv'}\n// {icon:'icon-videocam', action:'videocall'}\n// {icon:'icon-phone', action:'voicecall'}\nvar onclickaction;\n\nonclickaction = function(a) {\n return function(ev) {\n return action(a);\n };\n};\n\nmodule.exports = view(function(models) {\n var c, conv, viewstate;\n ({conv, viewstate} = models);\n c = conv[viewstate.selectedConv];\n return div({\n class: 'controls'\n }, function() {\n return div({\n class: 'button',\n title: i18n.__('Add new conversation')\n }, {\n onclick: onclickaction('addconversation')\n }, function() {\n return span({\n class: 'material-icons'\n }, 'add');\n });\n });\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "a39f0e9e0ff32ba2f891b57d033961c3161b801e", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/a39f0e9e0ff32ba2f891b57d033961c3161b801e/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n// some unused icons/actions\n// {icon:'icon-user-add', action:'adduser'}\n// {icon:'icon-pencil', action:'renameconv'}\n// {icon:'icon-videocam', action:'videocall'}\n// {icon:'icon-phone', action:'voicecall'}\nvar onclickaction;\n\nonclickaction = function(a) {\n return function(ev) {\n return action(a);\n };\n};\n\nmodule.exports = view(function(models) {\n var c, conv, viewstate;\n ({conv, viewstate} = models);\n c = conv[viewstate.selectedConv];\n return div({\n class: 'controls'\n }, function() {\n return div({\n class: 'button',\n title: i18n.__('Add new conversation')\n }, {\n onclick: onclickaction('addconversation')\n }, function() {\n return span({\n class: 'material-icons'\n }, 'add');\n });\n });\n});\n```", "response": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a\n\nmodule.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "a39f0e9e0ff32ba2f891b57d033961c3161b801e", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/a39f0e9e0ff32ba2f891b57d033961c3161b801e/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "yakyak/yakyak:src/ui/views/controls.coffee:1:completion", "type": "completion", "prompt": "# some unused icons/actions\n# {icon:'icon-user-add', action:'adduser'}\n# {icon:'icon-pencil', action:'renameconv'}\n# {icon:'icon-videocam', action:'videocall'}\n# {icon:'icon-phone', action:'voicecall'}\n\nonclickaction = (a) -> (ev) -> action a", "response": "module.exports = view (models) ->\n {conv, viewstate} = models\n c = conv[viewstate.selectedConv]\n div class:'controls', ->\n div class:'button', title: i18n.__('Add new conversation'),\n onclick:onclickaction('addconversation'), -> span class:'material-icons', 'add'", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "yakyak/yakyak", "path": "src/ui/views/controls.coffee", "license": "MIT", "commit": "a39f0e9e0ff32ba2f891b57d033961c3161b801e", "stars": 3762, "source_url": "https://github.com/yakyak/yakyak/blob/a39f0e9e0ff32ba2f891b57d033961c3161b801e/src/ui/views/controls.coffee", "line_start": 1, "line_end": 14} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(subscope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(subscope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n```", "response": "module.exports = class extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(subscope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n if (this.options.compat) {\n return this.escapeJs(node, {\n parenthesized: true\n });\n } else {\n this.warn(node, \"Named function expressions are not supported in CoffeeScript\");\n return node;\n }\n } else {\n return node;\n }\n }\n\n};\n\n/*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = class extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(subscope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n if (this.options.compat) {\n return this.escapeJs(node, {\n parenthesized: true\n });\n } else {\n this.warn(node, \"Named function expressions are not supported in CoffeeScript\");\n return node;\n }\n } else {\n return node;\n }\n }\n\n};\n\n/*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */\n```", "response": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(subscope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:completion", "type": "completion", "prompt": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(subscope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()", "response": "LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 65, "line_end": 97} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmoveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###\n```", "response": "({\n moveFunctionComments: function(node, parent) {\n var isFn, next;\n if (!parent.body) {\n return;\n }\n next = nextNonComment(parent.body, node);\n if (!next) {\n return;\n }\n isFn = next.type === 'FunctionExpression' && next.id;\n isFn || (isFn = next.type === 'FunctionDeclaration');\n if (isFn) {\n this.ctx.prebody.push(node);\n return this.remove();\n }\n },\n /*\n * Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n */\n buildFunctionDeclaration: function(node) {\n return replace(node, {\n type: 'VariableDeclaration',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: node.id,\n init: {\n type: 'FunctionExpression',\n params: node.params,\n defaults: node.defaults,\n body: node.body\n }\n }\n ]\n });\n }\n});\n\n/*\n * Looks up the first non-variable-declaration in a body\n */", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 65, "line_end": 97} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\n({\n moveFunctionComments: function(node, parent) {\n var isFn, next;\n if (!parent.body) {\n return;\n }\n next = nextNonComment(parent.body, node);\n if (!next) {\n return;\n }\n isFn = next.type === 'FunctionExpression' && next.id;\n isFn || (isFn = next.type === 'FunctionDeclaration');\n if (isFn) {\n this.ctx.prebody.push(node);\n return this.remove();\n }\n },\n /*\n * Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n */\n buildFunctionDeclaration: function(node) {\n return replace(node, {\n type: 'VariableDeclaration',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: node.id,\n init: {\n type: 'FunctionExpression',\n params: node.params,\n defaults: node.defaults,\n body: node.body\n }\n }\n ]\n });\n }\n});\n\n/*\n * Looks up the first non-variable-declaration in a body\n */\n```", "response": "moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 65, "line_end": 97} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:completion", "type": "completion", "prompt": "moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###", "response": "buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 65, "line_end": 97} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "firstNonVar = (body) ->\n i = 0\n for node, i in body\n if node.type isnt 'VariableDeclaration' and ! isComment(node)\n return i\n i", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 99, "line_end": 104} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nfirstNonVar = (body) ->\n i = 0\n for node, i in body\n if node.type isnt 'VariableDeclaration' and ! isComment(node)\n return i\n i\n```", "response": "var firstNonVar;\n\nfirstNonVar = function(body) {\n var i, j, len, node;\n i = 0;\n for (i = j = 0, len = body.length; j < len; i = ++j) {\n node = body[i];\n if (node.type !== 'VariableDeclaration' && !isComment(node)) {\n return i;\n }\n }\n return i;\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 99, "line_end": 104} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar firstNonVar;\n\nfirstNonVar = function(body) {\n var i, j, len, node;\n i = 0;\n for (i = j = 0, len = body.length; j < len; i = ++j) {\n node = body[i];\n if (node.type !== 'VariableDeclaration' && !isComment(node)) {\n return i;\n }\n }\n return i;\n};\n```", "response": "firstNonVar = (body) ->\n i = 0\n for node, i in body\n if node.type isnt 'VariableDeclaration' and ! isComment(node)\n return i\n i", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 99, "line_end": 104} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:completion", "type": "completion", "prompt": "firstNonVar = (body) ->\n i = 0\n for node, i in body", "response": "if node.type isnt 'VariableDeclaration' and ! isComment(node)\n return i\n i", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "47d3159aba94ffd4377138f7837717d8628eef9f", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/lib/transforms/functions.coffee", "line_start": 99, "line_end": 104} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n```", "response": "module.exports = class extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(scope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n if (this.options.compat) {\n return this.escapeJs(node, {\n parenthesized: true\n });\n } else {\n this.warn(node, \"Named function expressions are not supported in CoffeeScript\");\n return node;\n }\n } else {\n return node;\n }\n }\n\n};\n\n/*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = class extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(scope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n if (this.options.compat) {\n return this.escapeJs(node, {\n parenthesized: true\n });\n } else {\n this.warn(node, \"Named function expressions are not supported in CoffeeScript\");\n return node;\n }\n } else {\n return node;\n }\n }\n\n};\n\n/*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */\n```", "response": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:completion", "type": "completion", "prompt": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()", "response": "LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n if @options.compat\n @escapeJs node, parenthesized: true\n else\n @warn node, \"Named function expressions are not supported in CoffeeScript\"\n node\n else\n node\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/a331e4380b0a4470e1dc0f90ea6ac04ca1bb9fae/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nmodule.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n```", "response": "module.exports = class extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(scope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n if (node.id) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n }\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n return {\n type: 'Identifier',\n name: node.id.name\n };\n }\n }\n\n /*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */\n moveFunctionComments(node, parent) {\n var next;\n if (!parent.body) {\n return;\n }\n return next = nextNonComment(parent.body, node);\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nmodule.exports = class extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(scope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n if (node.id) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n }\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n return {\n type: 'Identifier',\n name: node.id.name\n };\n }\n }\n\n /*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */\n moveFunctionComments(node, parent) {\n var next;\n if (!parent.body) {\n return;\n }\n return next = nextNonComment(parent.body, node);\n }\n\n};\n```", "response": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:1:completion", "type": "completion", "prompt": "module.exports = class extends TransformerBase\n\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()", "response": "LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 15, "line_end": 64} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 65, "line_end": 93} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nreturn unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###\n```", "response": "var isFn;\n\nif (!next) {\n isFn = next.type === 'FunctionExpression' && next.id;\n isFn || (isFn = next.type === 'FunctionDeclaration');\n if (isFn) {\n this.ctx.prebody.push(node);\n return this.remove();\n }\n}\n\n({\n /*\n * Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n */\n buildFunctionDeclaration: function(node) {\n return replace(node, {\n type: 'VariableDeclaration',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: node.id,\n init: {\n type: 'FunctionExpression',\n params: node.params,\n defaults: node.defaults,\n body: node.body\n }\n }\n ]\n });\n }\n});\n\n/*\n * Looks up the first non-variable-declaration in a body\n */", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 65, "line_end": 93} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar isFn;\n\nif (!next) {\n isFn = next.type === 'FunctionExpression' && next.id;\n isFn || (isFn = next.type === 'FunctionDeclaration');\n if (isFn) {\n this.ctx.prebody.push(node);\n return this.remove();\n }\n}\n\n({\n /*\n * Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n */\n buildFunctionDeclaration: function(node) {\n return replace(node, {\n type: 'VariableDeclaration',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: node.id,\n init: {\n type: 'FunctionExpression',\n params: node.params,\n defaults: node.defaults,\n body: node.body\n }\n }\n ]\n });\n }\n});\n\n/*\n * Looks up the first non-variable-declaration in a body\n */\n```", "response": "return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 65, "line_end": 93} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:completion", "type": "completion", "prompt": "return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->", "response": "replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "8e7a0aec522dada8e85f93b3fff99cf85a51480b", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/8e7a0aec522dada8e85f93b3fff99cf85a51480b/lib/transforms/functions.coffee", "line_start": 65, "line_end": 93} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "67cfde4953557971408faef86bbbcdf4d3b8b5ad", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/67cfde4953557971408faef86bbbcdf4d3b8b5ad/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:coffee_to_js", "type": "coffee_to_js", "prompt": "Convert this CoffeeScript to JavaScript.\n```coffeescript\nclass FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n```", "response": "var FunctionTransforms;\n\nFunctionTransforms = class FunctionTransforms extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(scope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n if (node.id) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n }\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n return {\n type: 'Identifier',\n name: node.id.name\n };\n }\n }\n\n /*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */\n moveFunctionComments(node, parent) {\n var next;\n if (!parent.body) {\n return;\n }\n next = nextNonComment(parent.body, node);\n if (!next) {\n\n }\n }\n\n};", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "67cfde4953557971408faef86bbbcdf4d3b8b5ad", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/67cfde4953557971408faef86bbbcdf4d3b8b5ad/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:js_to_coffee", "type": "js_to_coffee", "prompt": "Convert this JavaScript to CoffeeScript.\n```javascript\nvar FunctionTransforms;\n\nFunctionTransforms = class FunctionTransforms extends TransformerBase {\n onScopeEnter(scope, ctx) {\n // Keep a list of things to be prepended before the body\n return ctx.prebody = [];\n }\n\n onScopeExit(scope, ctx, subscope, subctx) {\n if (subctx.prebody.length) {\n return this.prependIntoBody(scope.body, subctx.prebody);\n }\n }\n\n // prepend the functions back into the body.\n // be sure to place them after variable declarations.\n prependIntoBody(body, prebody) {\n var idx;\n idx = firstNonVar(body);\n return body.splice(idx, 0, ...prebody);\n }\n\n FunctionDeclaration(node) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n this.pushStack(node.body);\n }\n\n FunctionDeclarationExit(node) {\n this.popStack(node);\n return this.remove();\n }\n\n LineComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n BlockComment(node, parent) {\n return this.moveFunctionComments(node, parent);\n }\n\n FunctionExpression(node) {\n if (node.id) {\n this.ctx.prebody.push(this.buildFunctionDeclaration(node));\n }\n this.pushStack(node.body);\n }\n\n FunctionExpressionExit(node) {\n this.popStack();\n if (node.id) {\n return {\n type: 'Identifier',\n name: node.id.name\n };\n }\n }\n\n /*\n * If a comment is adjacent to a function,\n * move them up as well together with the function.\n */\n moveFunctionComments(node, parent) {\n var next;\n if (!parent.body) {\n return;\n }\n next = nextNonComment(parent.body, node);\n if (!next) {\n\n }\n }\n\n};\n```", "response": "class FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "67cfde4953557971408faef86bbbcdf4d3b8b5ad", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/67cfde4953557971408faef86bbbcdf4d3b8b5ad/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:completion", "type": "completion", "prompt": "class FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n if subctx.prebody.length\n @prependIntoBody(scope.body, subctx.prebody)\n\n # prepend the functions back into the body.\n # be sure to place them after variable declarations.\n prependIntoBody: (body, prebody) ->\n idx = firstNonVar(body)\n body.splice(idx, 0, prebody...)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->", "response": "@moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "67cfde4953557971408faef86bbbcdf4d3b8b5ad", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/67cfde4953557971408faef86bbbcdf4d3b8b5ad/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "67cfde4953557971408faef86bbbcdf4d3b8b5ad", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/67cfde4953557971408faef86bbbcdf4d3b8b5ad/lib/transforms/functions.coffee", "line_start": 66, "line_end": 93} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:completion", "type": "completion", "prompt": "isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn\n @ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,", "response": "type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]\n\n###\n# Looks up the first non-variable-declaration in a body\n###", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "67cfde4953557971408faef86bbbcdf4d3b8b5ad", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/67cfde4953557971408faef86bbbcdf4d3b8b5ad/lib/transforms/functions.coffee", "line_start": 66, "line_end": 93} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n # prepend the functions back into the body\n if subctx.prebody.length\n scope.body = subctx.prebody.concat(scope.body)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "085cc197114978c97a7befa5460555c857f94e30", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/085cc197114978c97a7befa5460555c857f94e30/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:completion", "type": "completion", "prompt": "class FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n # prepend the functions back into the body\n if subctx.prebody.length\n scope.body = subctx.prebody.concat(scope.body)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n @remove()\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)", "response": "FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "085cc197114978c97a7befa5460555c857f94e30", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/085cc197114978c97a7befa5460555c857f94e30/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "085cc197114978c97a7befa5460555c857f94e30", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/085cc197114978c97a7befa5460555c857f94e30/lib/transforms/functions.coffee", "line_start": 66, "line_end": 84} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:completion", "type": "completion", "prompt": "@ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,", "response": "type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n defaults: node.defaults\n body: node.body\n ]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "085cc197114978c97a7befa5460555c857f94e30", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/085cc197114978c97a7befa5460555c857f94e30/lib/transforms/functions.coffee", "line_start": 66, "line_end": 84} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n body: node.body\n ]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "72e89689822683b9d5a930e6b7ef02186fdb56cf", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/72e89689822683b9d5a930e6b7ef02186fdb56cf/lib/transforms/functions.coffee", "line_start": 66, "line_end": 83} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:completion", "type": "completion", "prompt": "@ctx.prebody.push node\n @remove()\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,", "response": "type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n body: node.body\n ]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "72e89689822683b9d5a930e6b7ef02186fdb56cf", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/72e89689822683b9d5a930e6b7ef02186fdb56cf/lib/transforms/functions.coffee", "line_start": 66, "line_end": 83} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "class FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n # prepend the functions back into the body\n if subctx.prebody.length\n scope.body = subctx.prebody.concat(scope.body)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n { type: 'EmptyStatement' }\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:2:completion", "type": "completion", "prompt": "class FunctionTransforms extends TransformerBase\n onScopeEnter: (scope, ctx) ->\n # Keep a list of things to be prepended before the body\n ctx.prebody = []\n\n onScopeExit: (scope, ctx, subscope, subctx) ->\n # prepend the functions back into the body\n if subctx.prebody.length\n scope.body = subctx.prebody.concat(scope.body)\n\n FunctionDeclaration: (node) ->\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionDeclarationExit: (node) ->\n @popStack(node)\n { type: 'EmptyStatement' }\n\n LineComment: (node, parent) ->\n @moveFunctionComments(node, parent)\n\n BlockComment: (node, parent) ->\n @moveFunctionComments(node, parent)", "response": "FunctionExpression: (node) ->\n if node.id\n @ctx.prebody.push @buildFunctionDeclaration(node)\n @pushStack(node.body)\n return\n\n FunctionExpressionExit: (node) ->\n @popStack()\n if node.id\n { type: 'Identifier', name: node.id.name }\n\n ###\n # If a comment is adjacent to a function,\n # move them up as well together with the function.\n ###\n\n moveFunctionComments: (node, parent) ->\n return unless parent.body\n next = nextNonComment(parent.body, node)\n return unless next\n\n isFn = (next.type is 'FunctionExpression' and next.id)\n isFn ||= (next.type is 'FunctionDeclaration')\n\n if isFn", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4/lib/transforms/functions.coffee", "line_start": 16, "line_end": 65} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "@ctx.prebody.push node\n { type: 'EmptyStatement' }\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,\n type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n body: node.body\n ]", "source_lang": "", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4/lib/transforms/functions.coffee", "line_start": 66, "line_end": 83} {"id": "js2coffee/js2coffee:lib/transforms/functions.coffee:3:completion", "type": "completion", "prompt": "@ctx.prebody.push node\n { type: 'EmptyStatement' }\n\n ###\n # Returns a `a = -> ...` statement out of a FunctionDeclaration node.\n ###\n\n buildFunctionDeclaration: (node) ->\n replace node,", "response": "type: 'VariableDeclaration'\n declarations: [\n type: 'VariableDeclarator'\n id: node.id\n init:\n type: 'FunctionExpression'\n params: node.params\n body: node.body\n ]", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "js2coffee/js2coffee", "path": "lib/transforms/functions.coffee", "license": "MIT", "commit": "aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4", "stars": 2082, "source_url": "https://github.com/js2coffee/js2coffee/blob/aeaa3cbb7c6c0f43c9bfc3f62b7eea4a0c1acfe4/lib/transforms/functions.coffee", "line_start": 66, "line_end": 83} {"id": "nicolaskruchten/pivottable:export_renderers.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\n $.pivotUtilities.export_renderers = \"TSV Export\": (pivotData, opts) ->\n defaults =\n localeStrings: {}\n\n opts = $.extend defaults, opts\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n rowAttrs = pivotData.rowAttrs\n colAttrs = pivotData.colAttrs\n\n result = []\n\n row = []\n for rowAttr in rowAttrs\n row.push rowAttr\n if colKeys.length == 1 and colKeys[0].length == 0\n row.push pivotData.aggregatorName\n else\n for colKey in colKeys\n row.push colKey.join(\"-\")\n\n result.push row\n\n for rowKey in rowKeys\n row = []\n for r in rowKey\n row.push r\n\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n row.push agg.value()\n else\n row.push \"\"\n result.push row\n text = \"\"", "source_lang": "", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "export_renderers.coffee", "license": "MIT", "commit": "8b612144a1b76edbe3eb6df1a420d4d589393c50", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/export_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:export_renderers.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\n $.pivotUtilities.export_renderers = \"TSV Export\": (pivotData, opts) ->\n defaults =\n localeStrings: {}\n\n opts = $.extend defaults, opts\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n rowAttrs = pivotData.rowAttrs\n colAttrs = pivotData.colAttrs\n\n result = []\n\n row = []\n for rowAttr in rowAttrs\n row.push rowAttr\n if colKeys.length == 1 and colKeys[0].length == 0\n row.push pivotData.aggregatorName\n else\n for colKey in colKeys\n row.push colKey.join(\"-\")\n\n result.push row\n\n for rowKey in rowKeys\n row = []\n for r in rowKey\n row.push r\n\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n row.push agg.value()\n else\n row.push \"\"\n result.push row\n text = \"\"\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 return $.pivotUtilities.export_renderers = {\n \"TSV Export\": function(pivotData, opts) {\n var agg, colAttrs, colKey, colKeys, defaults, i, j, k, l, len, len1, len2, len3, len4, m, r, result, row, rowAttr, rowAttrs, rowKey, rowKeys, text;\n defaults = {\n localeStrings: {}\n };\n opts = $.extend(defaults, opts);\n rowKeys = pivotData.getRowKeys();\n if (rowKeys.length === 0) {\n rowKeys.push([]);\n }\n colKeys = pivotData.getColKeys();\n if (colKeys.length === 0) {\n colKeys.push([]);\n }\n rowAttrs = pivotData.rowAttrs;\n colAttrs = pivotData.colAttrs;\n result = [];\n row = [];\n for (i = 0, len = rowAttrs.length; i < len; i++) {\n rowAttr = rowAttrs[i];\n row.push(rowAttr);\n }\n if (colKeys.length === 1 && colKeys[0].length === 0) {\n row.push(pivotData.aggregatorName);\n } else {\n for (j = 0, len1 = colKeys.length; j < len1; j++) {\n colKey = colKeys[j];\n row.push(colKey.join(\"-\"));\n }\n }\n result.push(row);\n for (k = 0, len2 = rowKeys.length; k < len2; k++) {\n rowKey = rowKeys[k];\n row = [];\n for (l = 0, len3 = rowKey.length; l < len3; l++) {\n r = rowKey[l];\n row.push(r);\n }\n for (m = 0, len4 = colKeys.length; m < len4; m++) {\n colKey = colKeys[m];\n agg = pivotData.getAggregator(rowKey, colKey);\n if (agg.value() != null) {\n row.push(agg.value());\n } else {\n row.push(\"\");\n }\n }\n result.push(row);\n }\n return text = \"\";\n }\n };\n});", "source_lang": "CoffeeScript", "target_lang": "JavaScript", "repo": "nicolaskruchten/pivottable", "path": "export_renderers.coffee", "license": "MIT", "commit": "8b612144a1b76edbe3eb6df1a420d4d589393c50", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/export_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:export_renderers.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 return $.pivotUtilities.export_renderers = {\n \"TSV Export\": function(pivotData, opts) {\n var agg, colAttrs, colKey, colKeys, defaults, i, j, k, l, len, len1, len2, len3, len4, m, r, result, row, rowAttr, rowAttrs, rowKey, rowKeys, text;\n defaults = {\n localeStrings: {}\n };\n opts = $.extend(defaults, opts);\n rowKeys = pivotData.getRowKeys();\n if (rowKeys.length === 0) {\n rowKeys.push([]);\n }\n colKeys = pivotData.getColKeys();\n if (colKeys.length === 0) {\n colKeys.push([]);\n }\n rowAttrs = pivotData.rowAttrs;\n colAttrs = pivotData.colAttrs;\n result = [];\n row = [];\n for (i = 0, len = rowAttrs.length; i < len; i++) {\n rowAttr = rowAttrs[i];\n row.push(rowAttr);\n }\n if (colKeys.length === 1 && colKeys[0].length === 0) {\n row.push(pivotData.aggregatorName);\n } else {\n for (j = 0, len1 = colKeys.length; j < len1; j++) {\n colKey = colKeys[j];\n row.push(colKey.join(\"-\"));\n }\n }\n result.push(row);\n for (k = 0, len2 = rowKeys.length; k < len2; k++) {\n rowKey = rowKeys[k];\n row = [];\n for (l = 0, len3 = rowKey.length; l < len3; l++) {\n r = rowKey[l];\n row.push(r);\n }\n for (m = 0, len4 = colKeys.length; m < len4; m++) {\n colKey = colKeys[m];\n agg = pivotData.getAggregator(rowKey, colKey);\n if (agg.value() != null) {\n row.push(agg.value());\n } else {\n row.push(\"\");\n }\n }\n result.push(row);\n }\n return text = \"\";\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\n $.pivotUtilities.export_renderers = \"TSV Export\": (pivotData, opts) ->\n defaults =\n localeStrings: {}\n\n opts = $.extend defaults, opts\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n rowAttrs = pivotData.rowAttrs\n colAttrs = pivotData.colAttrs\n\n result = []\n\n row = []\n for rowAttr in rowAttrs\n row.push rowAttr\n if colKeys.length == 1 and colKeys[0].length == 0\n row.push pivotData.aggregatorName\n else\n for colKey in colKeys\n row.push colKey.join(\"-\")\n\n result.push row\n\n for rowKey in rowKeys\n row = []\n for r in rowKey\n row.push r\n\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n row.push agg.value()\n else\n row.push \"\"\n result.push row\n text = \"\"", "source_lang": "JavaScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "export_renderers.coffee", "license": "MIT", "commit": "8b612144a1b76edbe3eb6df1a420d4d589393c50", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/export_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:export_renderers.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\n $.pivotUtilities.export_renderers = \"TSV Export\": (pivotData, opts) ->\n defaults =\n localeStrings: {}\n\n opts = $.extend defaults, opts\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n rowAttrs = pivotData.rowAttrs\n colAttrs = pivotData.colAttrs\n\n result = []", "response": "row = []\n for rowAttr in rowAttrs\n row.push rowAttr\n if colKeys.length == 1 and colKeys[0].length == 0\n row.push pivotData.aggregatorName\n else\n for colKey in colKeys\n row.push colKey.join(\"-\")\n\n result.push row\n\n for rowKey in rowKeys\n row = []\n for r in rowKey\n row.push r\n\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n row.push agg.value()\n else\n row.push \"\"\n result.push row\n text = \"\"", "source_lang": "CoffeeScript", "target_lang": "CoffeeScript", "repo": "nicolaskruchten/pivottable", "path": "export_renderers.coffee", "license": "MIT", "commit": "8b612144a1b76edbe3eb6df1a420d4d589393c50", "stars": 4440, "source_url": "https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/export_renderers.coffee", "line_start": 1, "line_end": 50} {"id": "nicolaskruchten/pivottable:export_renderers.coffee:2:raw_corpus", "type": "raw_corpus", "prompt": "", "response": "for r in result\n text += r.join(\"\\t\")+\"\\n\"\n\n return $(\"