conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Reformat posts in seed data\n" }, { "from": "human", "value": "import moment from 'moment';\n\nimport { Posts } from '../../api/collections';\n\nconst seedPosts = () => {\n const postCount = Posts.find().count();\n\n if (postCount === 0) {\n for (let i = 0; i <...
javascript
chosen
[ { "from": "system", "value": "Disable source map for production\n" }, { "from": "human", "value": "const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');\nconst { NewLineKind } = require('typescript');\n\nmodule.exports = {\n transpileDependencies: ['vuetify'],\n outputD...
javascript
chosen
[ { "from": "system", "value": "Fix missing underscore in comment type\n" }, { "from": "human", "value": "import Base from './base';\nimport process from 'reddit-text-js';\n\nclass Comment extends Base {\n _type = 'Comment';\n\n constructor(props) {\n super(props);\n\n var comment = this;\...
javascript
chosen
[ { "from": "system", "value": "Make URL shortener more forgiving\n" }, { "from": "human", "value": "var standardPageTypes = {\n\t'event': /^(19|20)[0-9]{2}\\//\n};\n\nvar resolveUrl = function(urlFragment) {\n\treturn (/^http:\\/\\//).test(urlFragment) ? urlFragment : 'http://lanyrd.com/' + urlFr...
javascript
chosen
[ { "from": "system", "value": "Support New and Old Spotify\n" }, { "from": "human", "value": "controller = new BasicController({\n supports: {\n playpause: true,\n next: true,\n previous: true\n },\n useLazyObserving: true,\n frameSelector: '#main, #app-player',\n playStateSelector:...
javascript
chosen
[ { "from": "system", "value": "Allow inputs inside forest tables\n" }, { "from": "human", "value": "// Forest tables\n\n$(document).on('mouseenter', '.forest-table tbody tr', function() {\n var $row = $(this);\n\n $row.addClass('active');\n\n $(document).one('turbolinks:before-cache.forestTabl...
javascript
chosen
[ { "from": "system", "value": "Return exact results by default\n" }, { "from": "human", "value": "export function filterByText(data, textFilter) {\n if (textFilter === '') {\n return data;\n }\n\n // case-insensitive\n textFilter = textFilter.toLowerCase();\n const exactMatches = [];\n c...
javascript
chosen
[ { "from": "system", "value": "Use raf for Relay's task scheduler\n" }, { "from": "human", "value": "/**\n * Client entry point\n */\n\n// Polyfills\nimport 'babel-polyfill'\n\n// Styles\nimport 'components/styles/resets.css'\n\n// Modules\nimport { browserHistory } from 'react-router'\nimport Re...
javascript
chosen
[ { "from": "system", "value": "Make sure UI is consistent on load\n" }, { "from": "human", "value": "$('#task').on('change', function() {\n if ( $(this).val() == 'custom') {\n $('#custom_videos').removeClass('hidden');\n } else {\n $('#custom_videos').addClass('hidden');\n }\n});\n" },...
javascript
chosen
[ { "from": "system", "value": "Add missing trailing commas in new webpack config\n" }, { "from": "human", "value": "/* eslint-disable import/no-commonjs */\n\nconst webpack = require('webpack')\n\nconst baseConfig = {\n entry: './src/index.js',\n module: {\n rules: [\n {\n test: ...
javascript
chosen
[ { "from": "system", "value": "presence: Initialize lastReportPresence as \"long ago\", not \"now\".\n\nBefore we were setting it as `new Date()`. So when app was opened, this\nvariable was initialized as `new Date()` and we call `reportPresence`\nfrom `fetchActions`. As diff is not >= 60, so `reportPresence...
javascript
chosen
[ { "from": "system", "value": "Resolve full file path + name to fix existsSync check\n" }, { "from": "human", "value": "/* eslint global-require: 0 */\n/* eslint import/no-dynamic-require: 0 */\n\nconst Environment = require('./environment')\nconst { existsSync } = require('fs')\n\nfunction creat...
javascript
chosen
[ { "from": "system", "value": "Hide or show inbound date according with type of trip selected\n" }, { "from": "human", "value": "$(document).ready(function () {\n $(\"#id_type_1\").click(function () {\n $(\"#id_inbound_date\").parents('.row').hide();\n $(\"#id_inbound_date_prefer...
javascript
chosen
[ { "from": "system", "value": "Fix function so it properly deducts 15% from price\n" }, { "from": "human", "value": "// priceDiscount function\n// Discounts sale price by 15% is price is > $8,000\nmodule.exports.priceDiscount = (price) => {\n\tif (price > 8000) {\n\t\treturn price * .15\n\t}\n\tr...
javascript
chosen
[ { "from": "system", "value": "Use Idle.getTimeout() instead of internal _options()\n" }, { "from": "human", "value": "angular.module('ngIdle.countdown', ['ngIdle.idle'])\n .directive('idleCountdown', ['Idle', function(Idle) {\n return {\n restrict: 'A',\n scope: {\n value: '...
javascript
chosen
[ { "from": "system", "value": "Use the right port number\n\nI find this makes all the difference...\n" }, { "from": "human", "value": "import WebpackDevServer from 'webpack-dev-server';\nimport config from './webpack.config.js';\nimport gulp from 'gulp';\nimport gutil from 'gulp-util';\nimport we...
javascript
chosen
[ { "from": "system", "value": "Update webpack project config path\n" }, { "from": "human", "value": "'use strict';\n\nvar tmpl = require('blueimp-tmpl').tmpl;\nvar path = require('path');\nvar readTemplate = require('../../utils/read-template');\nvar projectName = require('project-name');\n\n\nfu...
javascript
chosen
[ { "from": "system", "value": "Use /base in the SVG path\n\nUnfortunatly we need that.\n" }, { "from": "human", "value": "define([\"sugar-web/graphics/icon\"], function (icon) {\n describe(\"icon\", function () {\n var wasLoaded;\n var iconUrlResult;\n\n it(\"should be abl...
javascript
chosen
[ { "from": "system", "value": "Update ElevateZoom uses class .zoom" }, { "from": "human", "value": "$(function() {\n $('#zoom_01').elevateZoom();\n});\n" }, { "from": "gpt", "value": "$(function() {\n $('#zoom_01').elevateZoom();\n\n $('.zoom').each(function(element) {\n $(this)...
javascript
chosen
[ { "from": "system", "value": "Refactor listToArray to work with list parameters of dynamic sizes\n" }, { "from": "human", "value": "// Write a function arrayToList that builds up a data structure like the previous one when given [1, 2, 3] as argument, and write a listToArray function that produc...
javascript
chosen
[ { "from": "system", "value": "Fix smoke-test to do something useful.\n" }, { "from": "human", "value": "var assert = require('assert')\n // , expresso = require('expresso')\n , dustx = require('dust-x')\n \nmodule.exports = {\n 'test 1': function(end) {\n assert.ok(true, 'pre-test')...
javascript
chosen
[ { "from": "system", "value": "Fix supertest to not overwrite request\n" }, { "from": "human", "value": "var assert = require('chai').assert;\nvar http = require('http');\nvar mathServer = require('../lib/mathServer.js');\nvar request = require('supertest');\n\nprocess.env.NODE_ENV = 'test';\n\nd...
javascript
chosen
[ { "from": "system", "value": "Refactor serializer to support list\n" }, { "from": "human", "value": "import { underscore } from '@ember/string';\n\nexport function serializer(payload) {\n const serializedPayload = {};\n Object.keys(payload.attrs).map((_key) => {\n serializedPayload[undersco...
javascript
chosen
[ { "from": "system", "value": "test: Use log level of INFO for karma\n" }, { "from": "human", "value": "// Karma configuration\n\n// base path, that will be used to resolve files and exclude\nbasePath = '';\n\n// list of files / patterns to load in the browser\nfiles = [\n JASMINE,\n JASMINE_AD...
javascript
chosen
[ { "from": "system", "value": "Add wikipedia as a tag." }, { "from": "human", "value": "export const SPECIFICATION = 'spec';\nexport const MDN = 'mdn';\nexport const VIDEO = 'video';\nexport const ARTICLE = 'article';\nexport const DOCS = 'docs';\nexport const ANNOUNCEMENT = 'announcement';\nexpo...
javascript
chosen
[ { "from": "system", "value": "Make XHR compatible with new Kitt implementation" }, { "from": "human", "value": "var Q = require(\"../vendor/q/q\");\n\nexports.post = function (url, data) {\n console.log('posting to', url);\n var defer = Q.defer();\n\n var xhr = new XMLHttpRequest();\n xhr.on...
javascript
chosen
[ { "from": "system", "value": "Add plain object action clearUserInfo\n" }, { "from": "human", "value": "import types from '../constants/ActionTypes'\nimport utils from '../../shared/utils'\n\nfunction replaceUserInfo(userInfo) {\n return {\n type: types.REPLACE_USER_INFO,\n userI...
javascript
chosen
[ { "from": "system", "value": "Stop propagation for clicks (since a click on model view can toggle more information.\n" }, { "from": "human", "value": "var app = require('ridge');\n\nmodule.exports = require('ridge/view').extend({\n\tevents: {\n\t\t'click button': function(e) {\n\t\t\te.preventDe...
javascript
chosen
[ { "from": "system", "value": "Add handler for blog path\n" }, { "from": "human", "value": "let Path = require('path');\nlet Hapi = require('hapi');\nvar Good = require('good');\n\nlet server = new Hapi.Server({\n connections: {\n routes: {\n files: {\n relativeTo: Path.join(__dir...
javascript
chosen
[ { "from": "system", "value": "[fix] Remove references to \"big\" in resource installing code. Resources should now install to the correct application directory." }, { "from": "human", "value": "var helper = exports;\nvar copyDir = helper.copyDir = function (source, target) {\n var fs = require(...
javascript
chosen
[ { "from": "system", "value": "Stop previous sound before play new one\n" }, { "from": "human", "value": "/**\n * @flow\n */\n\nimport {default as Sound} from 'react-native-sound'\n\nexport default class SoundsManager {\n constructor (onChangeCallback) {\n this.muted = false\n this.sounds ...
javascript
chosen
[ { "from": "system", "value": "Set private vars, move events to public function\n" }, { "from": "human", "value": "var Gificiency = (function() {\n 'use strict';\n\n var search = function(filter) {\n $('a').each(function() {\n var elem = $(this);\n if (elem.text().search( new RegEx...
javascript
chosen
[ { "from": "system", "value": "Add a hook to the web version that checks on save if the archive can be loaded again.\n" }, { "from": "human", "value": "import { getQueryStringParam, substanceGlobals, platform } from 'substance'\nimport { TextureWebApp } from 'substance-texture'\n\nwindow.addEvent...
javascript
chosen
[ { "from": "system", "value": "Update test suite to ensure spinner and spinner options are rendered as expected\n" }, { "from": "human", "value": "/** @jsx React.DOM */\n\nvar React = require('react');\nvar Loader = require('../../lib/react-loader');\nvar expect = require('chai').expect;\n\nvar l...
javascript
chosen
[ { "from": "system", "value": "Include redux devtools through compose\n" }, { "from": "human", "value": "import React from 'react'\nimport ReactDOM from 'react-dom'\nimport getRoutes from './config/routes'\nimport { createStore, applyMiddleware } from 'redux'\nimport { Provider } from 'react-redu...
javascript
chosen
[ { "from": "system", "value": "Fix link in Profile error message.\n" }, { "from": "human", "value": "Template.mybilltable.created = function(){\n Session.set('message', '');\n};\n\nTemplate.mybilltable.helpers({\n onReady: function(){\n //Meteor.subscribe(\"mybills\");\n\n },\n bill: funct...
javascript
chosen
[ { "from": "system", "value": "Remove console.log from all files\n" }, { "from": "human", "value": "import privateInfo from \"../../../../../credentials/token.json\";\n\n/**\n * Fetches translated text using the Google Translate API\n */\nexport function getTranslation(term, fromLang, toLang) {\n...
javascript
chosen
[ { "from": "system", "value": "Update timer for star rating\n" }, { "from": "human", "value": "import test from 'tape-async'\nimport helper from 'tipsi-appium-helper'\n\nconst { driver, select, idFromXPath } = helper\n\ntest('<StarRating />', async (t) => {\n const starsAndTextId = select({\n ...
javascript
chosen
[ { "from": "system", "value": "Fix inefficient use of run.once by EmberEnvironment.async\n" }, { "from": "human", "value": "import Ember from 'ember';\nimport { defer } from 'rsvp';\nimport { Environment } from './external/environment';\nimport { assert } from '@ember/debug';\nimport { join, next...
javascript
chosen
[ { "from": "system", "value": "Test for ambigous file loading.\n" }, { "from": "human", "value": "// Test that loading SQL files for PostgreSQL works.\n'use strict';\n\nvar Code = require('code');\nvar Lab = require('lab');\nvar Querious = require('../index');\nvar path = require('path');\n\nvar ...
javascript
chosen
[ { "from": "system", "value": "Fix order of invokation of achievement mocking\n" }, { "from": "human", "value": "/* eslint-env node, jest */\n\nconst shogi = require('./index.js');\nconst Slack = require('../lib/slackMock.js');\n\njest.mock('../achievements/index.ts');\n\nlet slack = null;\n\nbef...
javascript
chosen
[ { "from": "system", "value": "Update spechelper in the rails 2 generator to reflect that addMatchers is exposed on the global namespace\n" }, { "from": "human", "value": "beforeEach(function() {\n this.addMatchers({\n toBePlaying: function(expectedSong) {\n var player = this.actual;\n ...
javascript
chosen
[ { "from": "system", "value": "Refresh letters content on <iframe> when reloading letters list\n" }, { "from": "human", "value": "//= require jquery-1.8.3.min\n//= require_tree .\n\njQuery(function($) {\n $('.letter-opener').on('click', 'tr', function() {\n var $this = $(this);\n $('iframe...
javascript
chosen
[ { "from": "system", "value": "Add missing `await` to outer iterator `next` call.\n\nCloses #73.\n" }, { "from": "human", "value": "module.exports = function (paginator, filter) {\n const iterator = paginator[Symbol.asyncIterator]()\n\n let done = false\n\n return {\n [Symbol.asyn...
javascript
chosen
[ { "from": "system", "value": "Allow to override specific contract template values\n\n- CS-208\n" }, { "from": "human", "value": "import template from './expert-contract-form.html';\n\nconst expertContract = {\n template,\n bindings: {\n model: '=',\n form: '<',\n contractTemplate: '<'...
javascript
chosen
[ { "from": "human", "value": "Add HTTP json api logic\n" }, { "from": "gpt", "value": "var http = require('http');\nvar url = require('url');\n\n// return a JSON object with the hour minute and second\nfunction parseTime(time){\n return {\n hour: time.getHours,\n minute: time.get...
javascript
chosen
[ { "from": "system", "value": "Use different notification messages when the tab is focused, unfocused, closed\n" }, { "from": "human", "value": "self.addEventListener('push', function(event) {\n event.waitUntil(clients.matchAll().then(function(clientList) {\n var focused = false;\n for (va...
javascript
chosen
[ { "from": "system", "value": "Fix bug: Action name should be split into 2 elements (not 1)\n" }, { "from": "human", "value": "import { createActions, handleActions } from 'redux-actions'\nimport { takeEvery } from 'redux-saga/effects'\n\nexport const createModule = (moduleName, definitions, defa...
javascript
chosen
[ { "from": "system", "value": "Resolve the value of self later\n" }, { "from": "human", "value": "// @flow\n\n/* Transform a Promise-returning function into a function that can optionally\n * take a callback as the last parameter instead.\n *\n * @param {Function} fn a function that...
javascript
chosen
[ { "from": "system", "value": "Make fast config have less space between games\n" }, { "from": "human", "value": "anyware_config = {\n DEBUG: {\n status: true, // Persistent status icons\n debugView: true, // Show game debug view\n console: false, // Javascript console debug ou...
javascript
chosen
[ { "from": "system", "value": "Create greyspace parser function to allow for splitting greyspace\nby type.\n" }, { "from": "human", "value": "import fs from \"fs\";\nimport InputStream from \"./InputStream\";\n\nexport function isGreyspace(string) {\n if (string === \"\" ||\n string ===...
javascript
chosen
[ { "from": "system", "value": "Rename 'obj' to 'value' for clarity\n" }, { "from": "human", "value": "// @flow\n\n// Recursively remove undefined, null, empty objects and empty arrays\nexport const compact = (obj: any): any => {\n if (obj === null) {\n return undefined;\n }\n\n if (Array.is...
javascript
chosen
[ { "from": "system", "value": "Store internal IP in docker host\n" }, { "from": "human", "value": "var git = require(\"./git\");\nvar hostname = require(\"./hostname\");\n\nexports.load = function(root) {\n var manifest = require(root + \"/package.json\");\n manifest.revision = \n ma...
javascript
chosen
[ { "from": "system", "value": "Update js for sticky content\n" }, { "from": "human", "value": "// This is a manifest file that'll be compiled into application.js, which will include all the files\n// listed below.\n//\n// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, v...
javascript
chosen
[ { "from": "system", "value": "Remove unused javascript requirements and add frontend toolkit" }, { "from": "human", "value": "//= require libs/jquery/jquery-ui-1.8.16.custom.min\n//= require libs/jquery/plugins/jquery.base64\n//= require libs/jquery/plugins/jquery.mustache.js\n//= require core\n...
javascript
chosen
[ { "from": "system", "value": "Set default extension (html) for nunjucks\n" }, { "from": "human", "value": "// view engine setup\nnunjucks.configure('views', {\n autoescape: true,\n express: app\n});\n" }, { "from": "gpt", "value": "\n// view engine setup\nnunjucks.configure('views'...
javascript
chosen
[ { "from": "system", "value": "Add event return listeners for Twitter warning,limit and discnct\n\nconsidering the amount of information you will be processing it\nis more imperative for you to take into account and work on being\nable to keep track of what twitters feedback is going to be. Thus\ncreated a s...
javascript
chosen
[ { "from": "system", "value": "Handle parsing errors on parse completion.\nStream file and parse the list into JSON objs and dump onto the res\n" }, { "from": "human", "value": "/**\n * Basic route controller\n */\nvar pages = require('./pages');\nvar formidable = require('formidable');\n\n\nmod...
javascript
chosen
[ { "from": "system", "value": "Add import and export buttons\n" }, { "from": "human", "value": "//Source:\n//https://plus.google.com/+AddyOsmani/posts/jBS8CiNTESM\n//http://bgrins.github.io/devtools-snippets/#console-save\n(function(console){\n\n console.save = function(data, filename){\n\n ...
javascript
chosen
[ { "from": "system", "value": "Update to proper Node module scope conventions\n" }, { "from": "human", "value": "var log = require(\"./log.js\");\n\nvar app = \n{\n\t// io: null\n};\n\napp.init = function init(httpServer)\n{\n\t// TODO: add WebSocket (socket.io) endpoints or other light non-HTTP ...
javascript
chosen
[ { "from": "system", "value": "Update chrome clean pipelines plugin to work with concourse 5\n\nThis commit updates the divs that we wish to remove from the pipeline view.\n" }, { "from": "human", "value": "// ==UserScript==\n// @name Remove concourse elements\n// @namespace cloudpipelin...
javascript
chosen
[ { "from": "system", "value": "Use mailto: for the moment\n" }, { "from": "human", "value": "import Shariff from '/imports/ui/lib/shariff/shariff';\n\nTemplate.sharing.onRendered(function() {\n\tthis.autorun(() => {\n\t\tthis.shariff = new Shariff(this.find('.shariff'), {\n\t\t\tlang: Session.get...
javascript
chosen
[ { "from": "system", "value": "Add a new question regarding datetime\n" }, { "from": "human", "value": "/* eslint-disable max-len */\nexport default `Ich als [Nutzerrolle] \nhabe auf der Seite [???]\ndie Funktion [???]\naufgrund des Fehlers/der Fehlermeldung \"[???]\"\nnicht benutzen können.\n\nT...
javascript
chosen
[ { "from": "system", "value": "Use array.buffer so that TypedArray and Buffer share the same memory\n" }, { "from": "human", "value": "const fs = require('fs');\n\nconst sampleRate = 44100,\n resolution = 16;\n\nconst maxLevel = Math.pow(2, resolution - 1) - 1,\n BinaryArray = {\n ...
javascript
chosen
[ { "from": "system", "value": "Add comments in StripeJS mock\n" }, { "from": "human", "value": "class Element {\n mount(el) {\n if (typeof el === \"string\") {\n el = document.querySelector(el);\n }\n\n el.classList.add('StripeElement');\n\n el.innerHTML = `\n <input id=\"s...
javascript
chosen
[ { "from": "system", "value": "Adjust database host to always be localhost\n" }, { "from": "human", "value": "var connection = {\n client: 'mysql',\n connection: {\n host: process.env.HOST,\n database: process.env.APP_NAME,\n user: process.env.DB_USER,\n password: process.env.DB_PAS...
javascript
chosen
[ { "from": "system", "value": "Create a simple component with JSX\n" }, { "from": "human", "value": "import React from 'react'\nimport ReactDOM from 'react-dom'\n\n/* Create a simple component without JSX\n\t<div>\n\t\tReact Tutorial\n\t</div> \n*/\nconst App = function() {\n\treturn React.create...
javascript
chosen
[ { "from": "system", "value": "Return array when creating from string and better conversion to array\n" }, { "from": "human", "value": "import create from './create';\n\nexport default function $$(ufo, context) {\n if (typeof ufo === 'string') {\n // if it seems to be HTML, create an elements...
javascript
chosen
[ { "from": "system", "value": "Add waitRegexp as an argument.\n" }, { "from": "human", "value": "var childProcess = require('child_process');\nvar q = require('q');\n\nvar runCommand = function(command) {\n var deferred = q.defer();\n\n console.log('Running command: [%s]', command);\n\n var co...
javascript
chosen
[ { "from": "system", "value": "Load the active user using the previous stored location if an active user does not exist\n" }, { "from": "human", "value": "import { Promise } from 'es6-promise';\nimport { Kinvey as CoreKinvey, isDefined, KinveyError } from 'kinvey-js-sdk/dist/export';\nimport { Cl...
javascript
chosen
[ { "from": "system", "value": "[minor] Use stop instead of close, it fixes, things.\n" }, { "from": "human", "value": "'use strict';\n\n/**\n * Minimum viable Browserchannel server for Node.js that works through the primus\n * interface.\n *\n * @runat server\n * @api private\n */\nmodule.exports...
javascript
chosen
[ { "from": "system", "value": "Update Parameters to be self extending vs containing to conform to Options\n" }, { "from": "human", "value": "/**\n * Copyright (c) 2015-present, Joshua Hollenbeck\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the...
javascript
chosen
[ { "from": "system", "value": "Make sure the pad() function works correctly\n" }, { "from": "human", "value": "// ----------------------------------------------------------------------------\n//\n// helpers.js\n//\n// ----------------------------------------------------------------------------\n\...
javascript
chosen
[ { "from": "system", "value": "feat(native): Add missing install call to raven config\n" }, { "from": "human", "value": "import 'babel-polyfill';\nimport React from 'react';\nimport { ApolloProvider } from 'react-apollo';\nimport { AppRegistry } from 'react-native';\nimport { NativeRouter } from ...
javascript
chosen
[ { "from": "system", "value": "Add missing coverage for KARMA_BROWSER flag" }, { "from": "human", "value": "import karma from '../src/karma';\n\ndescribe('karma config', function() {\n it('should generate config', function() {\n // Success is not throwing at this point. The simple karma tests...
javascript
chosen
[ { "from": "system", "value": "Test About for HTTP 200\n" }, { "from": "human", "value": "var siteName = \"tlks.io\";\n\n// http://tlks.io/\ncasper.test.begin('Testing tlks.io UI', 2, function(test) {\n\n var url = \"http://tlks.io/\";\n\n casper.start(url);\n\n casper.then(function() {\...
javascript
chosen
[ { "from": "system", "value": "Test Promise value always resolves to undefined\n" }, { "from": "human", "value": "import test from 'ava';\nimport whenDomReady from '../';\n\ntest('whenDomReady is a function', t => {\n\tt.is(typeof whenDomReady, 'function');\n});\n\ntest('whenDomReady returns a Pr...
javascript
chosen
[ { "from": "system", "value": "FIX manager using ESM in dev-kits example\n" }, { "from": "human", "value": "module.exports = {\n stories: ['./stories/*.*'],\n webpack: async (config, { configType }) => ({\n ...config,\n module: {\n ...config.module,\n rules: [\n ...config...
javascript
chosen
[ { "from": "system", "value": "Fix error where DATABASE_URL does not exist in environment\n" }, { "from": "human", "value": "var Sequelize = require('sequelize'),\n pg = require('pg').native;\n\nmodule.exports = function(opts) {\n if (!opts.DATABASE_URL) {\n throw(new Error('Must specify DAT...
javascript
chosen
[ { "from": "system", "value": "Check whether object exists before retrieving\n" }, { "from": "human", "value": "'use strict';\n\n/**\n * @ngdoc service\n * @name dormManagementToolApp.userService\n * @description\n * # userService\n * Service in the dormManagementToolApp.\n */\nangular.module('do...
javascript
chosen
[ { "from": "system", "value": "Fix error code for missing payload.\n" }, { "from": "human", "value": "import getRawBody from 'raw-body'\n\nexport default (limit) => {\n\tlimit = (limit || '512kb')\n\n\treturn (req, res, next) => {\n\t\t// Parse payload into buffer\n\t\tgetRawBody(req, {\n\t\t\tle...
javascript
chosen
[ { "from": "system", "value": "Use widget and progress component\n" }, { "from": "human", "value": "import { Component } from 'react'\nimport 'isomorphic-fetch'\n\nexport default class PageSpeedInsights extends Component {\n static defaultProps = {\n filter_third_party_resources: true,\n l...
javascript
chosen
[ { "from": "system", "value": "Add helper functions to update velocity options\n" }, { "from": "human", "value": "import animate from './animate';\nimport {assign} from './utils';\n\nconst helpers = {\n delay(msec) {\n this._opts.delay = msec;\n return this;\n },\n\n progress(fn, tween =...
javascript
chosen
[ { "from": "system", "value": "Rename Node.js \"Stable\" releases to \"Current\"\n" }, { "from": "human", "value": "const groupRe = /^((:?\\w|\\-|,|, )+):\\s*/i\n , reverts = require('./reverts')\n\n\nfunction toGroups (summary) {\n summary = reverts.cleanSummary(summary)\n var m = summary.m...
javascript
chosen
[ { "from": "system", "value": "Add command in view menu\n" }, { "from": "human", "value": "require(\"./stylesheets/main.less\");\nvar settings = require(\"./settings\");\n\nvar commands = codebox.require(\"core/commands\");\n\nvar manager = new codebox.tabs.Manager({\n tabMenu: false\n});\nman...
javascript
chosen
[ { "from": "system", "value": "Move cathing functions to catch file\n" }, { "from": "human", "value": "import 'babel-polyfill';\n\nconst window = (typeof window !== 'undefined') ? window : {};\n\n// Default config values.\nconst defaultConfig = {\n loggingFunction: () => true,\n loadInWorke...
javascript
chosen
[ { "from": "system", "value": "Fix bug by adding Switch to the routes and more specific routes shown first in code\n" }, { "from": "human", "value": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { createStore, applyMiddleware } fro...
javascript
chosen
[ { "from": "system", "value": "Use Object.getOwnPropertyNames for compatibility with native promises\n" }, { "from": "human", "value": "'use strict';\n\nvar Promise = require('bluebird');\nvar sinon = require('sinon');\n\nfunction thenable (promiseFactory) {\n return Object.keys(Promise.protot...
javascript
chosen
[ { "from": "system", "value": "Remove not useful function creator\n" }, { "from": "human", "value": "function createDynamicFunction(customAction) {\n return Function('action', 'return function (){ return action.apply(this, [...arguments]) };')(customAction);\n}\n\nfunction formatFunctionName(t...
javascript
chosen
[ { "from": "system", "value": "Use standard JS indent width\n" }, { "from": "human", "value": "let possibilites = 1;\nfor (let i = 53; i >= 48; i--) {\n possibilites *= i;\n}\nconsole.log('The odds are %d to 1', possibilites);\n" }, { "from": "gpt", "value": "let possibilites = 1;\...
javascript
chosen
[ { "from": "system", "value": "Remove explicit assignment to undefined.\n\njshint complains about these.\n" }, { "from": "human", "value": "var Timer = (function(Event, Util) {\n 'use strict';\n\n // Internal constants for the various timer states.\n var Waiting = 0, Inspecting = 1, Ready = 2,...
javascript
chosen
[ { "from": "system", "value": "Add overlay option for debugging\n" }, { "from": "human", "value": "const Environment = require('../environment')\nconst { dev_server } = require('../config')\nconst assetHost = require('../asset_host')\nconst webpack = require('webpack')\n\nmodule.exports = class e...
javascript
chosen
[ { "from": "system", "value": "Proxy: Correct structure, and only ever create one splashscreen window.\n" }, { "from": "human", "value": "var exec = require('cordova/exec');\n\nmodule.exports = {\n splashscreen: {\n win: null,\n\n show: function() {\n win= window.open(...
javascript
chosen
[ { "from": "system", "value": "Hide notification bars after a few seconds.\n\n\nFormer-commit-id: 8dc17c173ff496666879f82c6544e0826d8d36f5" }, { "from": "human", "value": "// This is a manifest file that'll be compiled into application.js, which will include all the files\n// listed below.\n//\n/...
javascript
chosen
[ { "from": "system", "value": "Add import of phoenix_html back\n\nWithout this import the delete links stopped working\n" }, { "from": "human", "value": "\n /*\n VENDOR\n */\n\n require( \"material-design-lite\" );\n\n /*\n APPLICATION\n */\n\n const { initTerms } = require( \"./t...
javascript
chosen
[ { "from": "system", "value": "Fix plotband label unmount crashing\n" }, { "from": "human", "value": "import React, { useRef, useEffect, useState } from 'react';\nimport uuid from 'uuid/v4';\nimport { attempt } from 'lodash-es';\nimport useModifiedProps from '../UseModifiedProps';\nimport useAxis...
javascript
chosen
[ { "from": "system", "value": "Fix fs.exists to existsSync where necessary\n" }, { "from": "human", "value": "var fs = require(\"fs\");\nvar path = require(\"path\");\n\nvar Helper = module.exports = {\n\tgetConfig: function () {\n\t\tvar filename = process.env.SHOUT_CONFIG;\n\t\tif(!filename || ...
javascript
chosen
[ { "from": "system", "value": "Enable form submit by pressing enter\n" }, { "from": "human", "value": "\nmodule.exports = (model, dispatch) => {\n const root = document.createElement('div');\n\n if (model.channelOnEdit === null) {\n return root;\n }\n\n const c = model.channelOnEdit;\n co...
javascript
chosen
[ { "from": "system", "value": "Send data using jsonp instead of cors\n" }, { "from": "human", "value": "\nKadira = {};\nKadira.options = __meteor_runtime_config__.kadira;\n\nif(Kadira.options && Kadira.options.endpoint) {\n Kadira.syncedDate = new Ntp(Kadira.options.endpoint);\n Kadira.syncedDa...
javascript
chosen
[ { "from": "system", "value": "Rewrite require to ES6 destructuring\n" }, { "from": "human", "value": "var chai = require('chai'),\n expect = chai.expect;\n\ndescribe('the program', function () {\n it('can handle the truth', function () {\n expect(true).to.equal(true);\n });\n\n})...
javascript
chosen