conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add checkbox value form field tests\n" }, { "from": "gpt", "value": "describe('GGRC.Components.checkboxValueFormField', function () {\n 'use strict';\n var viewModel;\n\n beforeEach(function () {\n viewModel = GGRC.Components\n .getViewModel('checkboxValue...
javascript
chosen
[ { "from": "human", "value": "Use Redux selectors to store minimal possible state\n" }, { "from": "gpt", "value": "import { createSelector } from 'reselect'\nimport events from '../../core/events'\n\nconst documentCaptures = state => state.documentCaptures\nconst faceCaptures = state => state.fac...
javascript
chosen
[ { "from": "human", "value": "Add js to resize portfolio grid captions based on max height\n" }, { "from": "gpt", "value": "$(document).ready(function(){\n var heights = $(\".portfolio-caption\").map(function() {\n return $(this).height();\n })\n\n maxHeight = Math.max.apply(null, heights);...
javascript
chosen
[ { "from": "human", "value": "Add migration about song datas." }, { "from": "gpt", "value": "exports.shorthands = undefined;\n\nexports.up = (pgm) => {\n pgm.addColumns('laundry_songs', {\n japan_only: { type: 'boolean', notNull: true, default: false },\n version: { type: 'real', notNull: ...
javascript
chosen
[ { "from": "human", "value": "Add hasRole function to user model\n" }, { "from": "gpt", "value": "import { Meteor } from 'meteor/meteor';\n\n// Add Transform to user's Collection\nMeteor.users._transform = function(user) {\n user.hasRole = function(role) {\n return this.roles.indexOf(role) >=...
javascript
chosen
[ { "from": "human", "value": "Add supported browser versions list\n" }, { "from": "gpt", "value": "TC.Cfg.acceptedBrowserVersions = [\n {\n \"name\": \"Chrome\",\n \"version\": 63\n },\n {\n \"name\": \"Firefox\",\n \"version\": 57\n },\n {\n \"name\": \"IE\",\n \"version\...
javascript
chosen
[ { "from": "human", "value": "Add main source js file\n" }, { "from": "gpt", "value": "#!/usr/bin/env node\n\nvar https = require('https');\nvar fs = require('fs');\nvar argv = require('argv');\n\nargv.option([\n {\n\tname: 'apikey',\n\tshort: 'a',\n\ttype: 'string',\n\tdescription: '[Mondator...
javascript
chosen
[ { "from": "human", "value": "Add console-shim for crippled browsers\n" }, { "from": "gpt", "value": "/*\n console-shim 1.0.0\n https://github.com/kayahr/console-shim\n Copyright (C) 2011 Klaus Reimer <k@ailis.de>\n Licensed under the MIT license\n (See http://www.opensource.org/licenses/mit-lice...
javascript
chosen
[ { "from": "human", "value": "Add an untested controller for the PKCS7 validator app\n" }, { "from": "gpt", "value": "'use strict';\n\nconst CP = require('child_process');\nconst Path = require('path');\n\nclass Server {\n constructor(port, path, options) {\n options = options || {};\n\n t...
javascript
chosen
[ { "from": "human", "value": "Test for all available methods\n" }, { "from": "gpt", "value": "var expect = require('chai').expect;\n\nvar Api = require('./../src/Api');\n\n\ndescribe('Create new instance for API', function() {\n\tit('should have methods', function(){\n\t\tvar api = new Api({hostn...
javascript
chosen
[ { "from": "human", "value": "Add unit tests for multi-model, needs documentation.\n" }, { "from": "gpt", "value": "import {\n moduleForComponent,\n test\n } from 'ember-qunit';\nimport Ember from 'ember';\n\nmoduleForComponent('em-form', 'em-form multi models', {\n // Specify the other units...
javascript
chosen
[ { "from": "human", "value": "Add theme storage for saving and retrieving the current theme\n" }, { "from": "gpt", "value": "window.ThemeStorage = {\n\n defaultTheme: 'vibrantink',\n\n save: function(themeName) {\n localStorage.setItem('github_theme', themeName);\n },\n\n getCurrent: funct...
javascript
chosen
[ { "from": "system", "value": "Fix position of sidebar in Safari\n\nFixes #29\n\nSee twbs/bootstrap#12126\n" }, { "from": "human", "value": "$(document).ready(function() {\r\n // make sidebar sticky when it hits the top of the viewport\r\n var $sidebar = $(\"#sidebar\");\r\n $sidebar.aff...
javascript
chosen
[ { "from": "human", "value": "Add directive for rendering latex equations.\n" }, { "from": "gpt", "value": "Application.Directives.directive(\"mathjaxBind\", mathjaxBindDirective);\n\nfunction mathjaxBindDirective() {\n return {\n restrict: \"A\",\n controller: [\"$scope\", \"$el...
javascript
chosen
[ { "from": "human", "value": "Test suite for util module\n" }, { "from": "gpt", "value": "\nvar util = require('util');\n\nexports.test = {\n\t\n\ttestToStringWithArray : function(){\n\t\tassert.deepEquals(['1', '2', '3'], util.toStringWithArray([1, 2, 3]));\n\t\tassert.equals('{\"s\":2}', util.t...
javascript
chosen
[ { "from": "human", "value": "Set up AJAX script to update preview\n" }, { "from": "gpt", "value": "/**\n * The AJAX setup for the Markdown Preview meta box.\n */\n\n(function($, d, w){\n\n $.fn.getParsedContent = function(){\n return this.each(function(){\n\n // Set refs to this contain...
javascript
chosen
[ { "from": "human", "value": "Add test case for SparseJoin misbehavior with getters\n\nBUG=v8:3621\nLOG=N\nR=mstarzinger@chromium.org\n\nReview URL: https://codereview.chromium.org/645703003\n\ngit-svn-id: f98b9d40cb02301bc76fa9e1b46ee668158567fd@24535 ce2b1a6d-e550-0410-aec6-3dcde31c8c00\n" }, { "fr...
javascript
chosen
[ { "from": "human", "value": "Add a benchmark for loading a db\n" }, { "from": "gpt", "value": "'use strict'\n\nconst IPFS = require('ipfs')\nconst IPFSRepo = require('ipfs-repo')\nconst DatastoreLevel = require('datastore-level')\nconst OrbitDB = require('../src/OrbitDB')\n\nconsole.log(\"Starti...
javascript
chosen
[ { "from": "human", "value": "Add fail test for query\n" }, { "from": "gpt", "value": "import '../../src/';\nimport Avatar from '../samples/components/avatar';\nimport List from '../samples/components/list';\n\ndescribe('query', () => {\n const body = document.querySelector('body');\n\n bef...
javascript
chosen
[ { "from": "human", "value": "Introduce health checks row scheme\n" }, { "from": "gpt", "value": "var HealthCheckProtocols = require(\"../constants/HealthCheckProtocols\");\n\nconst healthChecksRowScheme = {\n protocol: HealthCheckProtocols.COMMAND,\n command: null,\n path: null,\n portIndex:...
javascript
chosen
[ { "from": "human", "value": "Add solution for \"You're a square\"\n" }, { "from": "gpt", "value": "// https://www.codewars.com/kata/youre-a-square\n\nconst isSquare = n => (\n n >= 0 ?\n Math.pow(Math.round(Math.sqrt(n)), 2) === n :\n false\n);\n" } ]
javascript
chosen
[ { "from": "human", "value": "Rename presentational into presentation folder.\n" }, { "from": "gpt", "value": "import React, {PropTypes} from 'react';\n\n\nclass HelpForm extends React.Component{\n\n constructor(props, context) {\n super(props, context);\n\n this.state = {\n help: { m...
javascript
chosen
[ { "from": "system", "value": "Fix Ambient Sleeping Pill connector\n" }, { "from": "human", "value": "'use strict';\n\n/* global Connector */\n\nconst DEFAULT_TRACK_ART = 'nocover.png';\n\nConnector.playerSelector = '#player';\n\nConnector.artistSelector = '#trackartist';\n\nConnector.trackSelect...
javascript
chosen
[ { "from": "system", "value": "Remove /about route since there's no content for it yet\n" }, { "from": "human", "value": "var express = require('express');\nvar router = express.Router();\nvar windspeed = require('../middleware/windspeed')\n\nrouter.use(windspeed)\n\n\nvar statusValues = {\n\t1: ...
javascript
chosen
[ { "from": "human", "value": "Add unit tests for setting then getting skin size\n" }, { "from": "gpt", "value": "/* global render, ImageData */\nconst {chromium} = require('playwright-chromium');\nconst test = require('tap').test;\nconst path = require('path');\n\nconst indexHTML = path.resolve(_...
javascript
chosen
[ { "from": "human", "value": "Add login authentication and unit testing\n" }, { "from": "gpt", "value": "// Karma configuration\n// Generated on Sat Feb 20 2016 09:40:08 GMT+0800 (Malay Peninsula Standard Time)\n\nmodule.exports = function(config) {\n config.set({\n\n basePath: '../',\n\n ...
javascript
chosen
[ { "from": "human", "value": "Create and insert the canvas on page load\n" }, { "from": "gpt", "value": "$(document).ready(function() {\n initCanvas($(window).width(), $(window).height());\n});\n\nvar initCanvas = function(width, height) {\n // Create the canvas\n var canvas = document.c...
javascript
chosen
[ { "from": "system", "value": "Fix bug of incorrect touch event name\n\nBeginning of touch event is called `touchstart`, not `gesturestart` as referenced [1] here.\n\n[1] https://developer.mozilla.org/en/docs/Web/API/Touch_events\n" }, { "from": "human", "value": "var metas = document.getElements...
javascript
chosen
[ { "from": "human", "value": "Add ServiceTemplate object without associations\n" }, { "from": "gpt", "value": "const { DataTypes, Model } = require('sequelize');\n\n/**\n * This class represents a template for a list of services for a week.\n */\nclass ServiceTemplate extends Model {\n\n /**\n...
javascript
chosen
[ { "from": "human", "value": "Write tests for stats table\n" }, { "from": "gpt", "value": "var index = require('../../../index.js')();\nvar expect = require('chai').expect;\n\nvar React = require('react');\nvar ReactDOM = require('react-dom');\nvar TestUtils = require('react-addons-test-utils');\...
javascript
chosen
[ { "from": "human", "value": "Add a minimal fixed size queue.\n" }, { "from": "gpt", "value": "/* Fixed size queue implemented as a circular array */\n\nfunction Ring(size) {\n this.length = size;\n this.maxIndex = this.length - 1;\n this.start = 0;\n this.buffer = new Float32Array(thi...
javascript
chosen
[ { "from": "human", "value": "Add script to change URLs\n\nRef #31\n" }, { "from": "gpt", "value": "document.addEventListener('DOMContentLoaded',function() {\n document.querySelector('select[name=\"selectUrl\"]').onchange=changeEventHandler;\n},false);\nfunction changeEventHandler(event) {\n ...
javascript
chosen
[ { "from": "human", "value": "Add division by zero testcase\n\nUseful for manually exercising -fsanitize=undefined.\n" }, { "from": "gpt", "value": "/*\n * Floating point division by zero is undefined behavior (in C99+)\n * so the internal implementation must work around it by implementing\n * ...
javascript
chosen
[ { "from": "system", "value": "Handle undefined info before full options are found\n" }, { "from": "human", "value": "import React from 'react';\nimport _Story from './components/Story';\nexport const Story = _Story;\n\nconst defaultOptions = {\n inline: false,\n header: true,\n source: true,\...
javascript
chosen
[ { "from": "human", "value": "Add utility for working with document fragments and single nodes using a single function.\n" }, { "from": "gpt", "value": "// Does something for a single node or a DocumentFragment. This is useful when\n// working with arguments that are passed to DOM methods that wo...
javascript
chosen
[ { "from": "human", "value": "Put JS stuff in a dedicated lib\n" }, { "from": "gpt", "value": "/*\n\nbma_gis.js\n\ncarto helpers \n\n*/\n\n\nwindow.BG = {\n // MUST be called first to setup everything\n init: function(wms, pg_bridge, layer, title)\n {\n this.wms_url_ = wms;\n ...
javascript
chosen
[ { "from": "human", "value": "Implement an update server spec file\n" }, { "from": "gpt", "value": "import chai from 'chai';\nimport fetch from 'node-fetch';\nimport https from 'https';\n\nchai.should();\n\ndescribe('Update Server', () => {\n it('should be online', (done) => {\n https.get('ht...
javascript
chosen
[ { "from": "human", "value": "Add Testcase for Showing Logs JSON\n" }, { "from": "gpt", "value": "'use strict'\nvar request = require('request')\nvar fs = require('fs')\nvar os = require('os')\nvar should = require('should')\nvar utility = require('../public/utility')\nlet path = require('path')\...
javascript
chosen
[ { "from": "human", "value": "Add test for N^2 behavior.\n" }, { "from": "gpt", "value": "/**\n * @license\n * Copyright (c) 2017 Google Inc. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * Code distributed by G...
javascript
chosen
[ { "from": "human", "value": "Add boilerplate to simplify starting challenges\n" }, { "from": "gpt", "value": "// Node 11.2.0\n\nfs = require('fs');\n\n\nconst input = fs.readFileSync('input.txt', 'utf-8').trim().split('\\n');\n\nconst start = process.hrtime.bigint();\n\n\n// Code here\n\n\nconso...
javascript
chosen
[ { "from": "human", "value": "Set up controller for createNewRecipe to submit form when we get endpoint.\n" }, { "from": "gpt", "value": ";(function(){//IFEE\n\nangular.module('brewKeeper')\n .controller('createNewRecipe', function($scope, $http){\n $scope.recipe = { }//Might need to prep...
javascript
chosen
[ { "from": "human", "value": "Add helper for adding classes/styles to elements\n" }, { "from": "gpt", "value": "let CLASSES = {\n hidden: \"hidden\",\n};\n\nclass Styler {\n addClass(elem, klass) {\n elem.classList.add(klass);\n }\n\n get classes() {\n return CLASSES;\n };\n\n hide(el...
javascript
chosen
[ { "from": "system", "value": "Tweak the description of id-map\n" }, { "from": "human", "value": "Package.describe({\n summary: \"Dictionary data structure: a wrapper for a raw object\",\n internal: true\n});\n\nPackage.on_use(function (api) {\n api.export('IdMap');\n api.use(['underscore', '...
javascript
chosen
[ { "from": "human", "value": "Move loadScript into separate file\n\nNot sure if I'll be needing this\n" }, { "from": "gpt", "value": "// Load a javascript file from the given url, and call the given callback when\n// it's done loading.\nfunction loadScript(url, callback){\n var script = document...
javascript
chosen
[ { "from": "human", "value": "Add a with database higher order component\n" }, { "from": "gpt", "value": "import { lifecycle } from 'recompose'\n\nimport database from '../database'\n\nexport const withDatabaseSubscribe = (trigger, getRefPath, getOnTrigger) => (\n lifecycle({\n componentWillM...
javascript
chosen
[ { "from": "human", "value": "Add api load test for transactions without filters\n\nTo test the openhim api\n\nOHM-574\n" }, { "from": "gpt", "value": "import http from 'k6/http'\nimport { check } from 'k6'\nconst auth = require('./auth.js')\n\nconst BASE_URL = __ENV.BASE_URL || 'https://127.0.0....
javascript
chosen
[ { "from": "human", "value": "Add test to mobilizations store\n" }, { "from": "gpt", "value": "import mobilizations from './../../stores/mobilizations'\nimport { EDIT_COLUMN_CONTENT } from './../../constants/ActionTypes';\n\ndescribe('mobilizations', function(){\n describe('#editColumnContent', ...
javascript
chosen
[ { "from": "system", "value": "CRM-1974: Introduce transport settings - fixed flush of selected value\n" }, { "from": "human", "value": "/*global define*/\ndefine(['jquery', 'underscore', 'backbone'\n ], function ($, _, Backbone) {\n 'use strict';\n\n /**\n * @export oroemail/js/ema...
javascript
chosen
[ { "from": "human", "value": "Fix deselected row in grid after insert in bound form\n\nwhen creating record with uuid idGenerator we can set the internalId to the id\nwhich it will get after saving\n" }, { "from": "gpt", "value": "Ext4.define('Densa.overrides.DataModel', {\n override: 'Ext.dat...
javascript
chosen
[ { "from": "human", "value": "Add test cases for GOFManager class\n" }, { "from": "gpt", "value": "/**\n * @author adoankim <adoankim@alumnos.uvigo.es>\n * @copyright 2014 adoankim\n * @license {@link https://github.com/adoankim/PhaserGoF/blob/master/LICENSE|MIT License}\n * \n * te...
javascript
chosen
[ { "from": "human", "value": "Add solution to question 215\n" }, { "from": "gpt", "value": "/**\n * @param {number[]} nums\n * @param {number} k\n * @return {number}\n */\nvar findKthLargest = function(nums, k) {\n var sorted = nums.sort(function(a, b) { return a - b; });\n return sorted[so...
javascript
chosen
[ { "from": "human", "value": "Add solution for stream-adventure: \"Lines\"\n" }, { "from": "gpt", "value": "var os = require('os');\nvar tmap = require('through2-map');\nvar split = require('split');\n\n// Convert even-numbered lines to uppercase, odd-numbered lines to lowercase.\n// Line number ...
javascript
chosen
[ { "from": "system", "value": "Replace skip with skipAll in tests\n" }, { "from": "human", "value": "var path = require('path'),\n assert = require('yeoman-generator').assert,\n helpers = require('yeoman-generator').test,\n os = require('os');\n\ndescribe('sails-rest-api:app', function (...
javascript
chosen
[ { "from": "human", "value": "Add first test theme to widget app\n" }, { "from": "gpt", "value": "qx.Class.define(\"widgets.Theme\", {\n extend: unify.ui.widget.styling.Theme,\n \n construct : function() {\n var styles = {\n test : {\n backgroundColor: \"yellow\",\n borde...
javascript
chosen
[ { "from": "system", "value": "Fix boolean type in model options\n" }, { "from": "human", "value": "/**\n * Exports object that contains names of options as a key and their configuration objects as a value\n *\n * @example\n * export default {\n * optionName: {\n * desc: 'Description for th...
javascript
chosen
[ { "from": "human", "value": "Make the schema available to store user records in the database.\n" }, { "from": "gpt", "value": "module.exports = {\n up: (queryInterface, Sequelize) => {\n queryInterface.createTable('Users', {\n id: {\n allowNull: false,\n autoIncrement: tru...
javascript
chosen
[ { "from": "human", "value": "Add story for QuoteBanner component\n" }, { "from": "gpt", "value": "import React from 'react';\nimport { storiesOf } from '@storybook/react';\n\nimport QuoteBanner from 'shared/components/quoteBanner/quoteBanner';\n\nstoriesOf('shared/components/quoteBanner', module...
javascript
chosen
[ { "from": "human", "value": "Add tests for queryManager macro + decorator\n" }, { "from": "gpt", "value": "import EmberObject from '@ember/object';\nimport { queryManager, QueryManager } from 'ember-apollo-client';\nimport { module, test } from 'qunit';\nimport { setupTest } from 'ember-qunit';\...
javascript
chosen
[ { "from": "human", "value": "Add test for attempting to invalidly define signals.\n\nsvn path=/trunk/; revision=227\n" }, { "from": "gpt", "value": "#!/usr/bin/env seed\n// Returns: 0\n// STDIN:\n// STDOUT:Signal definition needs name property\\nSignal definition needs name property\n// STDERR:\...
javascript
chosen
[ { "from": "system", "value": "Fix typo in test script\n" }, { "from": "human", "value": "var fs = require('fs');\nvar http = require('http');\nvar https = require('https');\nvar cgi = require('cgi');\n\n// The HTTPS SSL options\nvar options = {\n key: fs.readFileSync(__dirname + '/ssl.key'),\n ...
javascript
chosen
[ { "from": "human", "value": "Add simple test case for organismDetails helper\n" }, { "from": "gpt", "value": "// chai is an assertion library\nlet chai = require('chai');\n\n// @see http://chaijs.com/api/assert/\nlet assert = chai.assert;\n\n// register alternative styles\n// @see http://chaijs....
javascript
chosen
[ { "from": "human", "value": "Add a maintenance script for counting the total number of entries\n" }, { "from": "gpt", "value": "/*jslint node: true */\n\n/*\n * Count all of the entries. Each Response object holds an array of one or more entries.\n *\n * Usage:\n * $ envrun -e my-deployment.en...
javascript
chosen
[ { "from": "human", "value": "Update project layzr.js to 1.2.2\n" }, { "from": "gpt", "value": "!function(t,i){\"function\"==typeof define&&define.amd?define([],i):\"object\"==typeof exports?module.exports=i():t.Layzr=i()}(this,function(){\"use strict\";function t(t){this._lastScroll=0,this._tick...
javascript
chosen
[ { "from": "human", "value": "Create script to automatically create the list for Recommended Family Constellations.\n" }, { "from": "gpt", "value": "exports.create = {\n\t'Recommended Family Constellation': [{\n\t\tfamilyConstellation: '2-parent (male and female)'\n\t}, {\t\n\t\tfamilyConstellati...
javascript
chosen
[ { "from": "human", "value": "Add database migration to add an index to event dateTime field,\nto speed up reporting queries that generate CSV files.\n" }, { "from": "gpt", "value": "'use strict';\n\nmodule.exports = {\n up: async queryInterface => {\n await queryInterface.sequelize.query(\n ...
javascript
chosen
[ { "from": "human", "value": "Add grunt file containing a lint task.\n" }, { "from": "gpt", "value": "'use strict';\n\nmodule.exports = function (grunt) {\n\n // Load external grunt task config.\n grunt.loadTasks('./grunt');\n\n grunt.loadNpmTasks('grunt-contrib-jshint');\n grunt.load...
javascript
chosen
[ { "from": "human", "value": "Create modal that opens on keyboard shortcut \"Alt-S\".\n" }, { "from": "gpt", "value": "define(function () {\n var show_running_jobs = function() {\n\n var element = 'fffffffff';\n \n var modal = Jupyter.dialog.modal({\n title: \"R...
javascript
chosen
[ { "from": "system", "value": "Use location.href to extract hash\n\nThere is a bug in firefox which means that location.hash contains the decoded URL. e.g\r\n\r\nif the url is \r\n\r\nxxx.com/#link/http%3A%2Fwhy.com\r\n\r\nThen:\r\n\r\nlocation.hash will be: #link/http://why.com\r\nand\r\nlocation.href will ...
javascript
chosen
[ { "from": "human", "value": "Add Queue, and rename files\n" }, { "from": "gpt", "value": "function Queue() {\n this._oldestIndex = 1;\n this._newestIndex = 1;\n this._storage = {};\n}\n\nQueue.prototype.size = function() {\n return this._newestIndex - this._oldestIndex;\n};\n\nQueue.prototyp...
javascript
chosen
[ { "from": "human", "value": "Fix existing dataset with reversed temporal coverage (migration)\n" }, { "from": "gpt", "value": "/**\n * Swap reversed DateRange values\n */\n\nvar updated = 0;\n\n// Match all Dataset having temporal_coverage.start > temporal_coverage.end\nconst pipeline = [\n {...
javascript
chosen
[ { "from": "human", "value": "Add file watcher that spawns a new process.\n\nAdd a file watcher process that spawns an operating system process,\ncaptures its output and pipes that output to the standard output of the\nnode process running the file watcher script.\n" }, { "from": "gpt", "value": ...
javascript
chosen
[ { "from": "human", "value": "Add example that prints the error from a child process\n" }, { "from": "gpt", "value": "/*\n\nIf the child process fails, print the error.\n\n*/\n\nconst {exec} = require('child_process')\n\nproc = exec('python count.py abc', (error, stdout, stderr) => {\n if (error...
javascript
chosen
[ { "from": "human", "value": "Add variables objects solution to match test code\n" }, { "from": "gpt", "value": "// JavaScript Variables and Objects\n\n// I paired [by myself] on this challenge.\n\n// __________________________________________\n// Write your code below.\n\nvar secretNumber = 7;\n...
javascript
chosen
[ { "from": "human", "value": "Add tests for SpreadSheet eval\n" }, { "from": "gpt", "value": "import { SpreadSheet } from './SpreadSheet';\nimport { Row, Cell } from './models';\nimport { parseCommand } from './models';\n\ndescribe('SpreadSheet', () => {\n const cells = [\n new Cell(0, 'A', 0...
javascript
chosen
[ { "from": "human", "value": "Create utility helper for camel casing text with hyphens\n\nThis helper will be used when converting CSS styles to JS objects.\nThen the `style` object will be consistent in the React props.\n" }, { "from": "gpt", "value": "'use strict';\n\n/**\n * Convert a string t...
javascript
chosen
[ { "from": "human", "value": "Add simple module for concatting code.\n" }, { "from": "gpt", "value": "var FileType = require('../file').type;\r\n\r\n/**\r\n * @param {Array<Object>} files\r\n * @param {string} fileType\r\n */\r\nfunction concat(files, fileType) {\r\n\r\n var code = [];\r\n\r\n...
javascript
chosen
[ { "from": "human", "value": "Implement task for loading model files\n" }, { "from": "gpt", "value": "var path = require('path'),\n vow = require('vow'),\n inherit = require('inherit'),\n fsExtra = require('fs-extra'),\n Base = require('./base');\n\nmodule.exports = inherit(Base, {\n\...
javascript
chosen
[ { "from": "human", "value": "Add script to process all records again\n" }, { "from": "gpt", "value": "var jobs = require('../server/kue').jobs;\nvar mongoose = require('../server/mongoose');\n\nvar Record = mongoose.model('Record');\n\nvar count = 0;\n\nRecord\n .find()\n .select({ identif...
javascript
chosen
[ { "from": "human", "value": "Add stability test for iOS keyboard\n" }, { "from": "gpt", "value": "\"use strict\";\n\nvar setup = require(\"../../common/setup-base\")\n , desired = require('./desired')\n , _ = require('underscore');\n\n\ndescribe(\"testapp - keyboard stability @skip-ci\", funct...
javascript
chosen
[ { "from": "human", "value": "Add random team select script\n\nThis script will randomly select a team from the current season's,\nweek's set of matches.\n\nNot sure if the XML will get updated as the\nseason goes along. Will update if changes are needed.\n" }, { "from": "gpt", "value": "const ht...
javascript
chosen
[ { "from": "human", "value": "Create a dist file with browserify\n" }, { "from": "gpt", "value": "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw ...
javascript
chosen
[ { "from": "human", "value": "Read tap output from stdin, to test parsing\n" }, { "from": "gpt", "value": "#!/usr/bin/env node\n\n// read a tap stream from stdin.\n\nvar TapConsumer = require(\"../lib/tap-consumer\")\n , TapStream = require(\"../lib/tap-stream\")\n\nvar tc = new TapConsumer\n ,...
javascript
chosen
[ { "from": "human", "value": "Add test file for stack trace functions.\n" }, { "from": "gpt", "value": "/*globals suite, test, setup, teardown */\n\nvar sutil = require('sake/util');\n\nsuite('sake.util', function () {\n \n test('fileFromStackTrace', function () {\n sutil.fileFromSta...
javascript
chosen
[ { "from": "human", "value": "ADD script for swapping coordinates in entities collection\n" }, { "from": "gpt", "value": "/*\n # Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U\n #\n # This file is part of Orion Context Broker.\n #\n # Orion Context Broker is free software: you can re...
javascript
chosen
[ { "from": "human", "value": "Resolve import for modules in ‘scripts’ directory\n" }, { "from": "gpt", "value": "const path = require('path');\n\nmodule.exports = {\n\tresolve: {\n\t\tmodules: [\n\t\t\t__dirname + '/scripts',\n\t\t\tpath.resolve(__dirname, \"./node_modules\")\n\t\t]\n\t}\n};" }...
javascript
chosen
[ { "from": "human", "value": "Add tests around the new updated editor actions" }, { "from": "gpt", "value": "import { expect, isFSA, isFSAName } from '../spec_helper'\nimport * as subject from '../../src/actions/editor'\n\ndescribe('editor actions', () => {\n context('#setIsCompleterActive', () ...
javascript
chosen
[ { "from": "human", "value": "Add simple test for gravatar directive\n" }, { "from": "gpt", "value": "var chai = require('chai');\nvar sinon = require('sinon');\nvar sinonChai = require(\"sinon-chai\");\n\nvar ngGravatar = require('../../src/ngGravatar');\n\nchai.should();\nchai.use(sinonChai);\n...
javascript
chosen
[ { "from": "human", "value": "Set up initial bibtex misc style formatter\n" }, { "from": "gpt", "value": "'use strict';\nrequire('../../../utils/array');\n\n/**\n * @module bibTex Misc Entry Formatter\n * Module for formatting source data into a bibTeX misc type entry\n */\n\nmodule.exports = {\n...
javascript
chosen
[ { "from": "human", "value": "Add IO monad from monet.js\n\nbut make it more es6-like\n" }, { "from": "gpt", "value": "/* IO monad taken from monet.js */\n/*\nThe MIT License (MIT)\n\nCopyright (c) 2016 Chris Myers\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\no...
javascript
chosen
[ { "from": "human", "value": "Add missing properties module (required by Hook and PubHook)\n" }, { "from": "gpt", "value": "/**\n * @license\n * Copyright 2016 Google Inc. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file ...
javascript
chosen
[ { "from": "human", "value": "Add document helper file for document controller\n" }, { "from": "gpt", "value": "const docHelper = {\n checkDocDetails: (req, res) => {\n let document = req.body;\n if (!(document.title && document.content && document.access)) {\n res.status(400)\n ...
javascript
chosen
[ { "from": "human", "value": "Add Object Compare Check and Element Change Position in Array\n" }, { "from": "gpt", "value": "module.exports = {\n move: function(arr, old_index, new_index)\n {\n while (old_index < 0)\n old_index += arr.length;\n while (new_index < 0)\n new_index += a...
javascript
chosen
[ { "from": "human", "value": "Update project bootstrap-hover-dropdown to v2.1.3\n" }, { "from": "gpt", "value": "/**\n * @preserve\n * Project: Bootstrap Hover Dropdown\n * Author: Cameron Spear\n * Version: v2.1.3\n * Contributors: Mattia Larentis\n * Dependencies: Bootstrap's Dropdown plugin, j...
javascript
chosen
[ { "from": "system", "value": "Fix a bug in getScript utility.\n\n- Should not extract script from deploy section.\n" }, { "from": "human", "value": "import fs from 'fs';\nimport path from 'path';\nimport yaml from 'js-yaml';\n\nconst scriptCache = {};\n\nfunction getCacheOrFile(key, fn) {\n if ...
javascript
chosen
[ { "from": "human", "value": "Add monkey patch for _dedupe.\n" }, { "from": "gpt", "value": "var through = require(\"through2\");\n\nexports.patch = function (Browserify) {\n Browserify.prototype._dedupe = function () {\n return through.obj(function (row, enc, next) {\n if (!...
javascript
chosen
[ { "from": "human", "value": "Add 7.8 JS Telephone file\n" }, { "from": "gpt", "value": "// PERSON 5 \n\n// Refactored code:\n\n// Simplified variable names and sum.\nfunction sum(array){\n // This works thanks to ECMAScript 6!\n var total = array.reduce((a, b) => a + b, 0); \n return total;\n...
javascript
chosen
[ { "from": "human", "value": "Test to catch compile issues\n" }, { "from": "gpt", "value": "import { shallow, createLocalVue } from '@vue/test-utils';\nimport Vuex from 'vuex';\n\nimport Detail from './Detail.vue';\n\nconst localVue = createLocalVue();\nlocalVue.use(Vuex);\n\ndescribe('Event Deta...
javascript
chosen
[ { "from": "human", "value": "Add migration to remove invalid subscriptions\n" }, { "from": "gpt", "value": "RocketChat.Migrations.add({\n\tversion: 60,\n\tup: function() {\n\t\tlet subscriptions = RocketChat.models.Subscriptions.find({ $or: [ { name: { $exists: 0 } }, { name: { $not: { $type: 2 ...
javascript
chosen
[ { "from": "human", "value": "Rename of the area model\n" }, { "from": "gpt", "value": "'use strict';\n\nmodule.exports = (sequelize, DataTypes) => {\n const county = sequelize.define('county', {\n name: DataTypes.STRING(64) // eslint-disable-line no-magic-numbers\n }, {\n timestamps: fal...
javascript
chosen
[ { "from": "human", "value": "Add separate clickable image for paths\n" }, { "from": "gpt", "value": "import React, { Component } from 'react';\nimport { TouchableOpacity, Image, View } from 'react-native';\nimport styles from './styles/ClickablePathStyle';\nimport PropTypes from 'prop-types';\ni...
javascript
chosen