conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix basic test from starter kit\n" }, { "from": "human", "value": "import chai from 'chai';\nimport Library from '../lib/library.js';\n\nchai.expect();\n\nconst expect = chai.expect;\n\nlet lib;\n\ndescribe('Given an instance of my library', function () {\n before(...
javascript
chosen
[ { "from": "system", "value": "Test case for package exports.\n" }, { "from": "human", "value": "/* global describe, it, expect */\n\nvar pkg = require('..');\n\ndescribe('antenna', function() {\n \n it('should export object', function() {\n expect(pkg).to.be.an('object');\n });\n \n});\n"...
javascript
chosen
[ { "from": "system", "value": "Fix Content-Security-Policy in dummy app.\n" }, { "from": "human", "value": "/* jshint node: true */\n\nvar fs = require('fs');\nvar path = require('path');\n\nmodule.exports = function(environment) {\n var ENV = {\n modulePrefix: 'dummy',\n environment: envi...
javascript
chosen
[ { "from": "system", "value": "Clean url and fix path.\n" }, { "from": "human", "value": "export const setUrl = (router, country, filters) => {\n const { pre, suf, inf, lin, mod, reg } = filters;\n router.push({\n query: {\n country,\n v: '0.1', // url version\n p: btoa(unesca...
javascript
chosen
[ { "from": "system", "value": "Fix bug with older man\n" }, { "from": "human", "value": "import Entity, { printMessage, action, time, state } from \"Entity\";\nimport { isInInventory, removeItem } from \"inventory\";\n\nexport class OlderMan extends Entity {\n name() {\n return 'eldery man';\...
javascript
chosen
[ { "from": "system", "value": "Add file header to new Storybook file.\n" }, { "from": "human", "value": "/**\n * External dependencies\n */\nimport { storiesOf } from '@storybook/react';\n\n/**\n * Internal dependencies\n */\nimport SettingsNotice, { TYPE_WARNING, TYPE_INFO, TYPE_SUGGESTION } fro...
javascript
chosen
[ { "from": "system", "value": "Reduce number of supported file types for highlighting\n" }, { "from": "human", "value": "\n/**\n * Configuration settings.\n */\nclientApp.config(function ($analyticsProvider) {\n\t$analyticsProvider.virtualPageviews(false);\n});\n" }, { "from": "gpt", ...
javascript
chosen
[ { "from": "system", "value": "Fix typo in sending protocol\n" }, { "from": "human", "value": "var messenger = require('../lib/messenger');\nvar database = require('../lib/database');\n\nmodule.exports = function (server) {\n \n server.post('/messages', function (req, res, next) {\n var phon...
javascript
chosen
[ { "from": "system", "value": "Add else to search listener function in Search Service for readability.\n" }, { "from": "human", "value": "'use strict';\n\nmodule.exports = function(app) {\n app.factory('SearchService', ['$rootScope', function($rs) {\n\n let searchResults = [];\n\n let sear...
javascript
chosen
[ { "from": "system", "value": "build(Main): Patch issues with native node module resolution\n" }, { "from": "human", "value": "module.exports = {\n /**\n * This is the main entry point for your application, it's the first file\n * that runs in the main process.\n */\n entry: './src/index....
javascript
chosen
[ { "from": "system", "value": "Support user defined root directory for templates\n" }, { "from": "human", "value": "\nconst path = require('path');\nconst url = require('url');\nconst jade = require('jade');\n\nmodule.exports = function(route, data, options, err) {\n\n try {\n\n options...
javascript
chosen
[ { "from": "system", "value": "Fix test for determining whether we're on a system object page\n" }, { "from": "human", "value": "//= require can.jquery-all\n\n(function(can, $) {\n\nif(!/^\\/systems/.test(window.location.pathname))\n return;\n\nvar system_id = /^\\/systems\\/(\\d+)/.exec(window.l...
javascript
chosen
[ { "from": "system", "value": "Fix typo in shared providers feature name [WAL-2354]\n" }, { "from": "human", "value": "import { checkPermission } from '@waldur/issues/routes';\n\n// @ngInject\nexport default function routes($stateProvider) {\n $stateProvider\n .state('support.resources', {\n ...
javascript
chosen
[ { "from": "system", "value": "fix: Add config for no use before define for ts\n" }, { "from": "human", "value": "module.exports = {\n plugins: ['typescript'],\n rules: {\n 'no-unused-vars': 0,\n 'typescript/no-unused-vars': 2,\n\n 'typescript/no-explicit-any': 2,\n },\n};\n" }, {...
javascript
chosen
[ { "from": "system", "value": "Fix Plex track title detection\n\nThe previous class wasn't sufficiently specific, so it would pull in\nextra info and make a match impossible. With this change, the title is\nnow accurately selected every time.\n" }, { "from": "human", "value": "'use strict';\n\n/*...
javascript
chosen
[ { "from": "system", "value": "Use a light version of parent to instance in proto.\n" }, { "from": "human", "value": "/*\n * InheritJS\n * https://github.com/Techniv/inheritjs\n *\n * Released under the MIT License.\n * https://github.com/Techniv/inheritjs/blob/master/LICENSE\n */\n\n\n\n\n(funct...
javascript
chosen
[ { "from": "system", "value": "Update the return statement to not have redundant r variable\n" }, { "from": "human", "value": "var _ = require('lodash');\n\nfunction formatDateString(date){\n if (date == null){\n return null;\n }\n return date.substr(0,4) + '-' + date.substr(4,2) ...
javascript
chosen
[ { "from": "system", "value": "Use typeof so that new-able objects still work\n" }, { "from": "human", "value": "module.exports = {\n safe: function (thing, path, otherwise) {\n thing = (thing instanceof Object) ? thing : {};\n var props = path.split('.');\n if (props.length === 1) {\n ...
javascript
chosen
[ { "from": "system", "value": "Disable auto reset state feature by default\n" }, { "from": "human", "value": "class PromiseMessagesConfig {\n constructor(autoResetAfter) {\n this.autoResetAfter = autoResetAfter;\n }\n\n getAutoResetAfter() {\n return this.autoResetAfter;\n ...
javascript
chosen
[ { "from": "system", "value": "Rename `error` message to `panic`.\n" }, { "from": "human", "value": "module.exports = function (finale) {\n if (typeof finale == 'function') {\n return finale\n } else {\n return function (error) {\n finale.error('uncaught', { stack: ...
javascript
chosen
[ { "from": "system", "value": "Make use of validValue in toObject\n" }, { "from": "human", "value": "// Converts argument to a value of type Object\n// http://es5.github.com/#x9.9\n\n'use strict';\n\nmodule.exports = function (value) {\n\tif (value == null) {\n\t\tthrow new TypeError(\"Cannot con...
javascript
chosen
[ { "from": "system", "value": "Fix path for module-native example\n" }, { "from": "human", "value": "var dockerLambda = require('..')\n\nvar match = dockerLambda({event: {password: 'lambda-docker'}})\n\nconsole.log(match == 'Matches!' ? 'Match Passed' : 'Match Failed: ' + match)\n\n\nvar nonMatch...
javascript
chosen
[ { "from": "system", "value": "Convert arrow function to regular function\n" }, { "from": "human", "value": "var expect = require('expect.js')\nvar Treasure = require('../lib/treasure')\nvar GlobalID = require('../lib/plugins/globalid')\nvar cookie = require('cookies-js')\n\ndescribe('Treasure Gl...
javascript
chosen
[ { "from": "system", "value": "Fix error showing up in search\n" }, { "from": "human", "value": "import { Resource } from '../api-resource';\n\nexport default new Resource({\n name: 'contentnode',\n fetchDescendantsCollection(id, getParams = {}) {\n return this.fetchDetailCollection('descend...
javascript
chosen
[ { "from": "system", "value": "Allow the gulp instance to be optionally provided\n" }, { "from": "human", "value": "var gulp = require('gulp');\n\nvar tslint = require('gulp-tslint');\n\nfunction lint(source) {\n\tgulp.src(['./' + source + '/**/*.ts', '!./source/typings/*.d.ts'])\n\t\t.pipe(tslin...
javascript
chosen
[ { "from": "system", "value": "Use explore view by default\n" }, { "from": "human", "value": "\nvar AppController = Controller.createComponent(\"AppController\");\n\nAppController.defineMethod(\"initView\", function () {\n if (!this.view) return;\n\n this.explore = new Explore();\n new Explore...
javascript
chosen
[ { "from": "system", "value": "Fix bug navbar-side dropdown doesn't work when the page load \n\n" }, { "from": "human", "value": "//= require jquery\n//= require jquery_ujs\n//= require materialize-sprockets\n//= require turbolinks\n\n$(document).on('turbolinks:load', function (){\n $(\".butto...
javascript
chosen
[ { "from": "system", "value": "Check for known file extensions" }, { "from": "human", "value": "\nrequire(['ByteSource', 'AppleVolume'], function(ByteSource, AppleVolume) {\n \n 'use strict';\n \n function makeFileDrop(el, callback) {\n if (typeof el === 'string') {\n el = document.ge...
javascript
chosen
[ { "from": "system", "value": "Remove commented developer tools code\n" }, { "from": "human", "value": "const electron = require('electron');\n// Module to control application life.\nconst app = electron.app;\n// Module to create native browser window.\nconst BrowserWindow = electron.BrowserWindo...
javascript
chosen
[ { "from": "system", "value": "Add path field to PkgInfo.\n" }, { "from": "human", "value": "\"use strict\";\n\nclass PkgInfo {\n constructor() {\n this.cache = Object.create(null);\n this.cachePath = null;\n this.config = null;\n this.range = null;\n }\n};\n\nObject.setPrototypeOf(...
javascript
chosen
[ { "from": "system", "value": "Fix an issue when a Sentry DSN isn't set\n\nWe can still set it up without a DSN, it'll just disable error reporting. Without running config(), calling raven.captureException() will throw its own exception." }, { "from": "human", "value": "require('dotenv').config()...
javascript
chosen
[ { "from": "system", "value": "Add full date to tooltip\n" }, { "from": "human", "value": "(function() {\n $(\"[data-iso-date]\").each(function(i, elem) {\n var elem = $(elem);\n var isoDate = elem.data(\"iso-date\");\n var relDate = moment(isoDate).fromNow();\n ele...
javascript
chosen
[ { "from": "system", "value": "Change anonymous response transformation function to a reusable named function\n\n- This function always does the same, but was implemented twice (duplicate\n code is eeevil!).\n- In addition, fixed a bug causing the function to fail when the server\n response is not successf...
javascript
chosen
[ { "from": "system", "value": "Return error results as individual objects.\n" }, { "from": "human", "value": "var page = require('webpage').create(),\n system = require('system'),\n url;\n\nif (system.args.length !== 2) {\n console.log('Usage: phantomjs auditor.js URL');\n phantom.exit();...
javascript
chosen
[ { "from": "system", "value": "Sort procedures in a more efficient way.\n" }, { "from": "human", "value": "import Ember from 'ember';\n\nexport default Ember.Controller.extend({\n procedures: function() {\n return this.get('model').sortBy('lastModified').reverse();\n }.property('mode...
javascript
chosen
[ { "from": "system", "value": "Fix spec for 0.10 compliance\n" }, { "from": "human", "value": "var banner = require('./');\nlet chai = require('chai');\nlet expect = chai.expect;\n\ndescribe('banner', () => {\n\n let filepath = 'test-target.js';\n\n context('without options (using defaults)', (...
javascript
chosen
[ { "from": "system", "value": "Use The Lounge's timestamp format\n" }, { "from": "human", "value": "\"use strict\";\nconst fs = require(\"fs\");\n\nconst prettyDate = function(date) {\n\tconst months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n\t\t\"Jul\", \"Aug\", \"Sep\", \"Oct\",...
javascript
chosen
[ { "from": "system", "value": "Fix a bug in the clock runner\n" }, { "from": "human", "value": "pull.component('clockRunKiller', function () {\n\n var s = this\n var g = s.generic\n var ls = s.localStorageAdapter\n\n return [\n kickOff\n , toggleRun\n ]\n\n /* Initializes a new counter ...
javascript
chosen
[ { "from": "system", "value": "Add comments and remove second test\n" }, { "from": "human", "value": "describe('Member', function() {\n it('should create a new member', function() {\n browser.get('#/member-list');\n\n $('.btn-primary').click();\n\n element(by.model('item.name')).sendKey...
javascript
chosen
[ { "from": "system", "value": "Update label on generic viewmodel\n" }, { "from": "human", "value": "var data = {};\n\n$(function(){\n data = ko.mapping.fromJS(harpData);\n ko.applyBindings(data); \n});" }, { "from": "gpt", "value": "// Define the Knockout View Model\nvar viewModel =...
javascript
chosen
[ { "from": "system", "value": "Fix typo in delivery server.\n" }, { "from": "human", "value": "// Continuous delivery server\nconst { spawn } = require('child_process')\nconst { resolve } = require('path')\nconst { createServer } = require('http')\nconst { urlencoded } = require('body-parser')\n\...
javascript
chosen
[ { "from": "system", "value": "Change example vars & comments\n" }, { "from": "human", "value": "// Sample GENE_STRUCTURE\nvar chromosomeStructre = {\n\tweight1: 0,\n\tweight2: 0,\n\tweight3: 0,\n\tweight4: 0,\n\tweight5: 0\n};\n\n// Sample fitness function\nvar myFitnessFunction = function (chro...
javascript
chosen
[ { "from": "system", "value": "Add generating to specific folder\n" }, { "from": "human", "value": "#! /usr/bin/env node\nvar cliConfig = require('../cli-config.json');\nvar semver = require('semver');\nvar execSync = require('child_process').execSync;\nvar installPackage = function (packageName)...
javascript
chosen
[ { "from": "system", "value": "Replace hardcoded v0.5.4 with latest\n" }, { "from": "human", "value": "function DocsModule(settings) {\n this.settings = settings;\n this.routes = [\n [/doc link ([a-z]+)#([a-zA-Z]+)( (v[0-9]+\\.[0-9]+\\.[0-9]+))?/, this.onLink]\n ]\n}\n\nexports.Module = Doc...
javascript
chosen
[ { "from": "system", "value": "install: Clean up after read-package-json's _id mess\n" }, { "from": "human", "value": "'use strict'\n\nvar defaultTemplate = {\n package: {\n dependencies: {},\n devDependencies: {},\n optionalDependencies: {},\n _requiredBy: [],\n _phantomChildren:...
javascript
chosen
[ { "from": "system", "value": "Add new edit type \"space\"\n" }, { "from": "human", "value": "\"use strict\";\nvar BACKWARDS_REMOVAL_KEYS = [\n \"backspace\"\n];\nvar FORWARD_REMOVAL_KEYS = [\n \"del\",\n \"delete\"\n];\nvar keycode = require(\"keycode\");\n\nmodule.exports = function(e)...
javascript
chosen
[ { "from": "system", "value": "Include new module dependencies: ngMessages.\n" }, { "from": "human", "value": "'use strict';\n\n// Init the application configuration module for AngularJS application\nvar ApplicationConfiguration = (function() {\n // Init module configuration options\n var appli...
javascript
chosen
[ { "from": "system", "value": "Support for object proxy and array proxy\n" }, { "from": "human", "value": "import Ember from 'ember';\nimport FormElement from 'ember-bootstrap/components/bs-form-element';\n\nconst {\n computed\n} = Ember;\n\nexport default function() {\n FormElement.reopen({\n ...
javascript
chosen
[ { "from": "system", "value": "Make sure appspec.yml is bundled\n" }, { "from": "human", "value": "import path from 'path'\n\nexport default {\n src: [\n '{bin,rhizome,datapoints,templates,env_var}/**/*.*',\n 'webapp*/public*/**/*.*',\n 'docs*/_build/**/*.*',\n 'manage.py',\n 'req...
javascript
chosen
[ { "from": "system", "value": "Add all possibilities to Babylon parser" }, { "from": "human", "value": "/*\n * Copyright (c) 2015-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directo...
javascript
chosen
[ { "from": "system", "value": "Add failing test for deeper nested directories in getFolderSubjects\n" }, { "from": "human", "value": "const assert = require('chai').assert\nconst { getFolderSubjects } = require('../checkAnyDataPresent.js')\n\ndescribe('checkAnyDataPresent', () => {\n describe('g...
javascript
chosen
[ { "from": "system", "value": "Fix link headers on the example\n" }, { "from": "human", "value": "'use strict';\nconst url = require('url');\n\nmodule.exports = (fragmentName, fragmentUrl) => (request, response) => {\n const pathname = url.parse(request.url).pathname;\n switch (pathname) {\...
javascript
chosen
[ { "from": "system", "value": "Remove not required logging from multiselect\n" }, { "from": "human", "value": "function cachedScript(url, options) {\n\n // Allow user to set any option except for dataType, cache, and url\n options = $.extend(options || {}, {\n dataType: \"script\",\n cac...
javascript
chosen
[ { "from": "system", "value": "Add a height offset for macOS' dialogs\n" }, { "from": "human", "value": "import {remote} from 'electron';\nimport settings from 'electron-settings';\n\nconst {dialog, getCurrentWindow} = remote;\n\ndocument.addEventListener('DOMContentLoaded', () => {\n settings.g...
javascript
chosen
[ { "from": "system", "value": "Improve JavaScript for generating section listing\n" }, { "from": "human", "value": "function create_section_listing() {\n $('div#sidebar h3').click(function(e) {\n window.scrollTo(0, 0);\n });\n\n $('.section_title').each(function (i, e) {\n $(\"div#sideba...
javascript
chosen
[ { "from": "system", "value": ":new: Add flow coverage help text\n" }, { "from": "human", "value": "/* @flow */\n\nimport { CompositeDisposable } from 'atom'\n\nexport type CoverageObject = {\n expressions: {\n covered_count: number,\n uncovered_count: number,\n }\n}\n\nclass CoverageView...
javascript
chosen
[ { "from": "system", "value": "Allow setting label to ma-filter-button\n\nAs it can be done with other ma-*-button ma-filter-button can get it's\nlabel set now\n" }, { "from": "human", "value": "export default function maFilterButton() {\n return {\n restrict: 'E',\n scope: {\n ...
javascript
chosen
[ { "from": "system", "value": "Add the twitter:description meta tag.\n" }, { "from": "human", "value": "// @flow strict\nimport React from 'react';\nimport Helmet from 'react-helmet';\nimport type { Node as ReactNode } from 'react';\nimport styles from './Layout.module.scss';\n\ntype Props = {\n ...
javascript
chosen
[ { "from": "system", "value": "Undo changes to profile-settings page. remove affix\n" }, { "from": "human", "value": "var profile = require('../profile.js');\n\nvar ctx = window.contextVars;\n\nnew profile.Names('#names', ctx.nameUrls, ['edit']);\nnew profile.Social('#social', ctx.socialUrls, ['e...
javascript
chosen
[ { "from": "system", "value": "Update momentjs locale globally when language is switched.\n" }, { "from": "human", "value": "// @ngInject\nexport default class LanguageUtilsService {\n // @ngInject\n constructor($translate, $http, ENV) {\n this.$translate = $translate;\n this.$http = $htt...
javascript
chosen
[ { "from": "system", "value": "Fix to TAP output when grep is used to filter out tests: these tests should not contribute to the overall total in the TAP plan.\n" }, { "from": "human", "value": "\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , cursor = Base.cursor\n , col...
javascript
chosen
[ { "from": "system", "value": "Remove properties for HTML elements in the annotation overlay view\n" }, { "from": "human", "value": "'use babel';\n\nexport default class AnnotationOverlayView {\n constructor({type, source, row, column, message}) {\n this.element = document.createElement('div'...
javascript
chosen
[ { "from": "system", "value": "Refactor react gulp code into its own task\n" }, { "from": "human", "value": "var gulp = require('gulp');\nvar react = require('gulp-react');\nvar git = require('gulp-git');\nvar fs = require('fs');\nvar shell = require('gulp-shell')\n\ngulp.task('brew', function ()...
javascript
chosen
[ { "from": "system", "value": "Annotate build steps for clarity" }, { "from": "human", "value": "const gulp = require('gulp');\nconst babel = require('gulp-babel');\n\ngulp.task('cp', function() {\n gulp.src([\n 'app/**/!(*.js)',\n 'MIT-LICENSE.txt',\n 'README.md',\n ])\n .p...
javascript
chosen
[ { "from": "system", "value": "Remove moderniz from the Block Header\n" }, { "from": "human", "value": "define([\n\t'Modernizr',\n\t'jQuery',\n], function()\n{\n\t\n\tfunction Header()\n\t{\n\t\tthis._$body = $('body');\n\t\tthis._$win = $(window);\n\t\tthis._$header = $('.js-header');\n\t};\n\t\...
javascript
chosen
[ { "from": "system", "value": "Save the next() function to the controller too.\n" }, { "from": "human", "value": "_.extend(RouteController.prototype, {\n initialize: function (context, options) {\n this.request = context.options.request;\n this.response = context.options.response;\n },\n\...
javascript
chosen
[ { "from": "system", "value": "Reconnect channel on window focus.\n" }, { "from": "human", "value": "$(function() {\n\tvar client = $(\"head\").data(\"client\");\n\tvar setup = function() {\n\t\t$.getJSON(\"/getToken/\", {client: client}, function(token) {\n\t\t\tvar chan = new goog.appengine.Cha...
javascript
chosen
[ { "from": "system", "value": "Add Windows example for factory\n" }, { "from": "human", "value": "\"use strict\";\n\nvar Sphero = require(\"./lib/sphero\");\n\n/**\n * Creates a new Sphero instance with the provided options.\n *\n * @param {String} address port/UUID/address of the connected Spher...
javascript
chosen
[ { "from": "system", "value": ":hammer: Change the way we reference the config in tests\n" }, { "from": "human", "value": "'use strict';\n\nvar config = require('../');\nvar stylelint = require('stylelint');\n\nfunction isObject(obj) {\n return typeof obj === 'object' && obj !== null;\n}\n\nit('...
javascript
chosen
[ { "from": "system", "value": "Return the assignment value instead of for DummyConfigResource.app's setter\n" }, { "from": "human", "value": "var _ = require('lodash');\n\nvar resources = require('../dummy/resources');\n\nvar DummyResource = resources.DummyResource;\n\n\nvar DummyConfigResource ...
javascript
chosen
[ { "from": "system", "value": "Replace constructor with singleton. Emit 'stats' on singleton\n" }, { "from": "human", "value": "var gcEmitter,\n\tutil = require('util'),\n\tgcstats = require('./build/Release/gcstats'),\n\tEventEmitter = require('events').EventEmitter;\n\nfunction GCStats() {\n\ti...
javascript
chosen
[ { "from": "system", "value": "Use tagged template literal for chalk\n" }, { "from": "human", "value": "#!/usr/bin/env node\n\n\"use strict\";\n\nconst moment = require(\"moment\");\nconst sugar = require(\"sugar\");\nconst chalk = require(\"chalk\");\nconst exec = require(\"child_process\").exec...
javascript
chosen
[ { "from": "system", "value": "Remove the unnecessary variable declarations.\n" }, { "from": "human", "value": "'use strict'\n\n\nmodule.exports = function (filename, encoding) {\n var filename = filename || '.env'\n var encoding = encoding || 'utf8'\n}\n" }, { "from": "gpt", "value...
javascript
chosen
[ { "from": "system", "value": "Fix router redirect on logout\n" }, { "from": "human", "value": "Template.nav.onRendered(function() {\n this.$('.button-collapse').sideNav({\n closeOnClick: true\n });\n});\n\nTemplate.nav.events({\n 'click .logout': function(e){\n e.preventDefault();\n ...
javascript
chosen
[ { "from": "system", "value": "Add a method to EndpointController to get back the Renderable representation of its data.\n" }, { "from": "human", "value": "/**\n * The default controller for your page structure.\n */\nvar turnpike = require('turnpike');\nvar util = require('util');\nvar _ ...
javascript
chosen
[ { "from": "system", "value": "Make boolean checkbox looks great on Firefox.\n" }, { "from": "human", "value": "import React from 'react';\n\nconst styles = {\n display: 'table-cell',\n boxSizing: 'border-box',\n verticalAlign: 'top',\n height: 21,\n width: '100%',\n outline: 'none',\n bor...
javascript
chosen
[ { "from": "system", "value": "Add jsdoc to source file\n" }, { "from": "human", "value": "module.exports = function (dest, src) {\n Object.getOwnPropertyNames(src).forEach(function (name) {\n var descriptor = Object.getOwnPropertyDescriptor(src, name)\n Object.defineProperty(dest, name, d...
javascript
chosen
[ { "from": "system", "value": "Improve the accuracy of dividing English words\n" }, { "from": "human", "value": "/**\n * Presets of sentenceSeparator, clauseRegExp, wordRegExp, wordBoundaryRegExp, abbrRegExp\n * for each languages.\n */\n\nexport default {\n en: {\n sentenceSeparator: /\\n/g,...
javascript
chosen
[ { "from": "system", "value": "Disable rimraf globbing since its not supported anywhere else within fs-extra\n\nAdd missing var declaration\n" }, { "from": "human", "value": "var rimraf = require('rimraf')\n\nfunction removeSync (dir) {\n return rimraf.sync(dir)\n}\n\nfunction remove (dir, callb...
javascript
chosen
[ { "from": "system", "value": "Create reducer: Move dispatched action type into the dedicated variable\n" }, { "from": "human", "value": "import { Iterable, fromJS } from 'immutable';\n\nconst defaultArgs = {\n initialState: {}\n};\n\n/**\n * Create reducer\n * @description Shorthand function to...
javascript
chosen
[ { "from": "system", "value": "Add displayName to all the Typography components\n" }, { "from": "human", "value": "import Monospaced from './Monospaced';\nimport { textFactory } from './Text';\n\nconst Heading1 = textFactory('heading', 'heading-1', 'h1');\nconst Heading2 = textFactory('heading', ...
javascript
chosen
[ { "from": "system", "value": "Move a lot of things to legacy.\n" }, { "from": "human", "value": "module.exports = function(session, options) { \n function testBrowser(name, version) {\n var config = {\n 'browserName': name,\n 'tunnel-identifier': process.env.TRAVI...
javascript
chosen
[ { "from": "system", "value": "Add some .class in Content\n" }, { "from": "human", "value": "\r\n// ----------------------------------------------------------------\r\n// Content Class\r\n\r\nclass Content {\r\n \r\n}\r\n" }, { "from": "gpt", "value": "\r\n// ------------------------...
javascript
chosen
[ { "from": "system", "value": "Clean Up the Contributing Documentation and Process: Part VII\n\n* Fix the globbing error in the previous commits." }, { "from": "human", "value": "module.exports = function(grunt) {\n\trequire(\"time-grunt\")(grunt);\n\tgrunt.initConfig({\n\t\tpkg: grunt.file.readJ...
javascript
chosen
[ { "from": "system", "value": "Remove unused import from gruntfile\n" }, { "from": "human", "value": "var webpack = require('webpack');\n\nmodule.exports = function(grunt) {\n require('load-grunt-tasks')(grunt);\n\n grunt.initConfig({\n secret: grunt.file.readJSON('secret.json'),\n\n clea...
javascript
chosen
[ { "from": "system", "value": "Use heroku db in production\n" }, { "from": "human", "value": "const Sequelize = require('sequelize');\n\nif (process.env.DATABASE_URL) {\n let db = new Sequelize(process.env.DATABASE_URL, {\n dialect: 'postgres',\n protocol: 'postgres',\n port: match...
javascript
chosen
[ { "from": "system", "value": "Add a shallow concretizing hasOwnProperty prototyp\n" }, { "from": "human", "value": "export default function(state, ctx, model, helpers) {\n\n\tconst ConcretizeIfNative = helpers.ConcretizeIfNative;\n\n\t//TODO: Test IsNative for apply, bind & call\n\tmodel.add(Fun...
javascript
chosen
[ { "from": "system", "value": "Add new url to get request\n" }, { "from": "human", "value": "document.addEventListener(\"DOMContentLoaded\", function (event) {\n // redirect to 7777 port\n // ping golang counter\n httpGetAsync(\"http://www.aracki.me:7777\", function (res) {\n aler...
javascript
chosen
[ { "from": "system", "value": "Check for input to be array\n" }, { "from": "human", "value": "/**\n * Created by sandeshkumar on 4/5/16.\n */\nfunction flattenArray(arr) {\n if(Array.isArray(arr)) {\n //return flatIterative(arr);\n //return flatRecursive(arr, []);\n return...
javascript
chosen
[ { "from": "system", "value": "Enable debugging with redux chrome plugin\n" }, { "from": "human", "value": "const redux = require('redux');\nconst reducers = require('../reducers');\n\nfunction reduxStore(initialState) {\n const store = redux.createStore(reducers, initialState);\n\n if (module....
javascript
chosen
[ { "from": "human", "value": "Add event handler for inserting new Host document.\n" }, { "from": "gpt", "value": "Template.HostCreate.events({\n 'form submit' : function (e, tmpl) {\n e.preventDefault();\n\n // Define form field variables.\n var hostname = e.target.hostname.value;\n ...
javascript
chosen
[ { "from": "system", "value": "Enable full repo name search\n" }, { "from": "human", "value": "'use strict';\n\nangular.module('visualizerApp')\n .controller('ExploreController', ['$scope', '$upload', '$location', '$http', '$timeout', '$filter', 'jsonFactory', function ($scope, $upload, $locatio...
javascript
chosen
[ { "from": "system", "value": "Add SocketIO server options to \"default\" nodejs environment\nso development mode isn't broken\n" }, { "from": "human", "value": "var path = require('path');\n\n// strip the last dir... essentially the same as __dirname/..\nvar root = path.dirname(__dirname); //.r...
javascript
chosen
[ { "from": "system", "value": "Update redux dev tool configuration\n" }, { "from": "human", "value": "// Redux\nimport { createStore, applyMiddleware, compose } from 'redux';\nimport thunk from 'redux-thunk';\n// import createLogger from 'redux-logger';\n// import Immutable from 'immutable';\nimp...
javascript
chosen
[ { "from": "system", "value": "Fix errors in FastBoot if user-agent is blank\n" }, { "from": "human", "value": "import Service from 'ember-service';\nimport get, { getProperties } from 'ember-metal/get';\nimport set from 'ember-metal/set';\nimport computed from 'ember-computed';\nimport getOwner ...
javascript
chosen
[ { "from": "system", "value": "Resolve client dist output js name from entry point\n" }, { "from": "human", "value": "var path = require('path');\nvar webpack = require('webpack');\n\nmodule.exports = {\n entry: './main.js',\n output: {\n path: path.resolve(__dirname, 'dist'),\n ...
javascript
chosen
[ { "from": "system", "value": "Fix issue with template, extra comma\n" }, { "from": "human", "value": "import React from 'react'\nimport {combineReducers, createStore, applyMiddleware} from 'redux'\nimport thunk from 'redux-thunk'\nimport { Provider } from 'react-redux'\nimport { render } from 'r...
javascript
chosen
[ { "from": "system", "value": "Set \"contentType\" on AJAX call.\n" }, { "from": "human", "value": "$(document).ready(function() {\r\n var editor = ace.edit(\"json\");\r\n editor.setTheme(\"ace/theme/github\");\r\n editor.session.setMode(\"ace/mode/json\");\r\n editor.setFontSize(14);...
javascript
chosen
[ { "from": "system", "value": "Update deprecated access token endpoint\n\nSee https://developer.github.com/changes/2020-04-15-replacing-create-installation-access-token-endpoint/\n" }, { "from": "human", "value": "\"use strict\";\nconst gh = require(\"simple-github\");\nconst jwt = require(\"json...
javascript
chosen
[ { "from": "system", "value": "Connect is required for selenium tests\n" }, { "from": "human", "value": "\"use strict\";\n\nmodule.exports = function (grunt) {\n grunt.registerTask(\"make\", [].concat([\n \"exec:version\",\n \"default\",\n \"concurrent:source\",\n \...
javascript
chosen