conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add test for missing str parameter\n" }, { "from": "human", "value": "import request from 'supertest';\nimport test from 'tape';\n\nimport app from '../server';\n\ntest('Should leftpad correctly', t => {\n request(app)\n .get('?str=paddin%27%20oswal...
javascript
chosen
[ { "from": "system", "value": "Use proper path when copying manifests to test install\n" }, { "from": "human", "value": "// Sloppy mock for component.install in tests\n\nvar\n utils = require('../lib/utils'),\n fs = require('fs-extra'),\n Emitter = require('events').EventEmitter;\n\nfun...
javascript
chosen
[ { "from": "system", "value": "Rename parameter to not interfere with cb func\n" }, { "from": "human", "value": "/**\n * @title Open - cordova.plugins.bridge.open\n * @overview Open documents with compatible apps.\n * @copyright © 2014 cordova-bridge\n * @license GPLv2\n * @author Carlos Antonio\...
javascript
chosen
[ { "from": "system", "value": "Add ajax calls for sending emails\n" }, { "from": "human", "value": "/**\r\n * Created by nkmathew on 23/06/2016.\r\n */\r\n\r\n$(document).ready(function () {\r\n var source = $(\"#email-list-template\").html();\r\n var template = Handlebars.compile(source)...
javascript
chosen
[ { "from": "system", "value": "NIHVIVO-1361: Add less time for fading in alert messages.\n" }, { "from": "human", "value": "/* $This file is distributed under the terms of the license in /doc/license.txt$ */\n\n$(document).ready(function(){\n\n // login form is hidden by default; use JavaScri...
javascript
chosen
[ { "from": "system", "value": "Add prop classnames to the component\n" }, { "from": "human", "value": "import classNames from 'classnames/dedupe';\nimport React from 'react';\n\nimport TabButtonList from './TabButtonList';\n\nclass Tabs extends React.Component {\n getChildren() {\n const {pro...
javascript
chosen
[ { "from": "system", "value": "Update how we parse svg\n" }, { "from": "human", "value": "import path from 'path';\nimport fs from 'fs';\n\nconst getViewBoxDimensions = dir => file => {\n const fileContent = fs.readFileSync(path.join(dir, file), 'utf-8');\n const matches = fileContent.match(/vi...
javascript
chosen
[ { "from": "system", "value": "Disable legacy native modules in bridgeless mode\n\nSummary: Requiring legacy native modules fails in bridgeless mode because they use the batched bridge, so we need to check for turbomodules first to avoid crashing. In D15703655 I reversed the order of this check for everyone,...
javascript
chosen
[ { "from": "system", "value": "Fix legacy build by defining ol alias\n" }, { "from": "human", "value": "const path = require('path');\nmodule.exports = {\n entry: './build/index.js',\n devtool: 'source-map',\n mode: 'production',\n output: {\n path: path.resolve('./build/legacy'),\n fil...
javascript
chosen
[ { "from": "system", "value": "[TASK] Add an empty shim obj to the requireJS config\n" }, { "from": "human", "value": "/**\n * RequireJS configuration\n * @description Pass in options for RequireJS like paths, shims or the baseUrl\n */\nrequire.config({\n\tpaths: {\n\t\t\"mainModule\" : \"Modules...
javascript
chosen
[ { "from": "system", "value": "Replace button with Bootstrap button for better styling.\n" }, { "from": "human", "value": "import React, { Component } from 'react';\nimport { Link } from \"react-router-dom\";\n\nimport './Home.css';\n\nclass Home extends Component {\n render() {\n return (\n ...
javascript
chosen
[ { "from": "system", "value": "doc: Use correct syntax for optional parameter in Console.put()\n" }, { "from": "human", "value": "// Copyright © 2014 Intel Corporation. All rights reserved.\n// Use of this source code is governed by an Apache v2\n// license that can be found in the LICENSE-A...
javascript
chosen
[ { "from": "system", "value": "Use the built-in stream module\n" }, { "from": "human", "value": "'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\n\n\n// STREAM //\n\n/**\n* Readable stream.\n*\n* @private\n* @constructor\n* @returns {Stream} Stream instance...
javascript
chosen
[ { "from": "system", "value": "Add `window` check for when running server\n" }, { "from": "human", "value": "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compl...
javascript
chosen
[ { "from": "system", "value": "Fix / optimize ajax form plugin\n\n[#75226372]\n\nDo not send unnecessary AJAX request when there are no target elements\navailable.\n" }, { "from": "human", "value": "(function($) {\n\n /**\n * Downloads data and uses it to dynamically create set of select optio...
javascript
chosen
[ { "from": "system", "value": "Support a 'use' option to specify further defaults\n" }, { "from": "human", "value": "import defaultKeymap from \"./defaultkeymap\"\nimport {Range} from \"./selection\"\nimport {Node, Pos} from \"../model\"\n\nclass Option {\n constructor(defaultValue, update, upda...
javascript
chosen
[ { "from": "system", "value": "Fix reference to undeclared variable maybeParse.\n" }, { "from": "human", "value": "'use strict';\n\nlet moment = require('moment');\nlet dateTimeFormat = require('./date-time-format');\n\nmodule.exports = function(value) {\n if(value[0] === '@') {\n retur...
javascript
chosen
[ { "from": "system", "value": "Add ping route for testing\n" }, { "from": "human", "value": "import express from 'express';\nimport locations from './routes/locations';\nimport tripLocations from './routes/trip-locations';\nimport distances from './routes/distances';\nimport admin from './routes/...
javascript
chosen
[ { "from": "system", "value": "Make the screen scroll less frequently\n\n…it's a bit intense" }, { "from": "human", "value": "(function(GOVUK, GDM) {\n\n var $page = $(\"html, body\"),\n delayInSeconds = 8,\n generateScrollTo = function($sections, index) {\n\n return function() ...
javascript
chosen
[ { "from": "system", "value": "Fix link togglers jumping to top\n\nFix #29414\n" }, { "from": "human", "value": "/* eslint-disable wrap-iife, func-names, space-before-function-paren, prefer-arrow-callback, vars-on-top, no-var, max-len */\n(function(w) {\n $(function() {\n var toggleContainer ...
javascript
chosen
[ { "from": "system", "value": "Check if action is available\n\n" }, { "from": "human", "value": "import Component from '@ember/component';\nimport { inject as service } from '@ember/service';\nimport layout from '../templates/components/time-input';\n\nexport default Component.extend({\n layout,...
javascript
chosen
[ { "from": "system", "value": "Add warning about accounting name for SLURM allocation provision form [WAL-1131]\n" }, { "from": "human", "value": "const SlurmAllocationConfig = {\n order: [\n 'name',\n 'description',\n 'cpu_limit',\n ],\n options: {\n name: {\n type: 'string',...
javascript
chosen
[ { "from": "system", "value": "Accumulate ancestor nodes during walk\n" }, { "from": "human", "value": "'use strict';\n\n// MODULES //\n\nvar walk = require( 'acorn/dist/walk.js' ).full;\nvar contains = require( '@stdlib/assert/contains' );\nvar types = require( './node_types.js' );\n\n\n// MAIN ...
javascript
chosen
[ { "from": "system", "value": "Add G Suite verification tag\n" }, { "from": "human", "value": "// @flow\nimport React from 'react'\nimport Helmet from 'react-helmet'\nimport PropTypes from 'prop-types'\n\nimport Background from '../Background'\nimport Navbar from '../Navbar'\nimport { Container, ...
javascript
chosen
[ { "from": "system", "value": "Add docs to server init\n" }, { "from": "human", "value": "// {{{ Express HTTP server setup\nlet express = require('express');\nlet less = require('less-middleware');\nlet app = express();\n\napp.set('views', __dirname + '/views');\napp.set('view engine', 'ejs');\na...
javascript
chosen
[ { "from": "system", "value": "[chore] Add ngAnimate module to uploadcontroller.js\n" }, { "from": "human", "value": "angular.module('upload', [\n 'utils'\n])\n\n.controller('uploadController', [\n '$scope',\n '$http',\n '$stateParams',\n '$rootScope',\n 'fileTransfer',\n 'webRTC',\n 'pac...
javascript
chosen
[ { "from": "system", "value": "Put back the shifting again" }, { "from": "human", "value": "define(function() {\n\n 'use strict';\n \n var DELTAS = new Int8Array([0, -49, -36, -25, -16, -9, -4, -1, 0, 1, 4, 9, 16, 25, 36, 49]);\n\n function open(item) {\n return item.getBytes().then(functi...
javascript
chosen
[ { "from": "system", "value": "Fix form submission bug in comment dialog\n" }, { "from": "human", "value": ";(function($, ns) {\n ns.Comment = chorus.dialogs.Base.extend({\n className : \"comment\",\n title : t(\"comments.new_dialog.title\"),\n persistent : true,\n ...
javascript
chosen
[ { "from": "system", "value": "Update port number for test env\n" }, { "from": "human", "value": "var\n env = process.env.NODE_ENV || 'development',\n config;\n\nconfig = {\n production : {\n db : {\n URL : process.env['wac_service_mongodb_url']\n },\n componentsURL : 'http://50....
javascript
chosen
[ { "from": "system", "value": "Add version and initialize AppHelper\n" }, { "from": "human", "value": "define([\n 'jquery',\n 'underscore',\n 'backbone',\n 'router',\n 'helpers/app',\n 'helpers/conf',\n 'helpers/usertag',\n 'views/sidebar',\n 'views/user',\n 'views/search',\n 'text!tem...
javascript
chosen
[ { "from": "system", "value": "Fix unhandled rejection handler param name.\n" }, { "from": "human", "value": "'use strict';\n\nconst app = require('ampersand-app');\n\n/**\n * **Handle** unhandled rejections.\n *\n * @todo This prevents program shutdown on unhandled rejections, which equate to\n ...
javascript
chosen
[ { "from": "system", "value": "Fix removeObservers on null properties\n" }, { "from": "human", "value": "import Ember from 'ember';\n\nexport default Ember.Mixin.create({\n\n leafletProperties: null,\n\n _addObservers() {\n this._observers = {};\n let layer = this.get('_layer');\n let ...
javascript
chosen
[ { "from": "system", "value": "Use headless Firefox for Protractor tests\n\n(see https://github.com/angular/protractor/blob/master/docs/browser-setup.md)\n" }, { "from": "human", "value": "'use strict'\n\nexports.config = {\n directConnect: true,\n\n allScriptsTimeout: 80000,\n\n specs: [\n ...
javascript
chosen
[ { "from": "system", "value": "Fix the Main Header Text font size according to the size of the screen.\n" }, { "from": "human", "value": "(function() {\n \"use strict\"; // Start of use strict\n\n // Offset for Main Navigation\n $('#mainNav').affix({\n offset: {\n top:...
javascript
chosen
[ { "from": "system", "value": "Update object.js - insert missing variable" }, { "from": "human", "value": "if (typeof define !== 'function') { var define = require('amdefine')(module); }\n\ndefine(function() {\n return {\n alterContext : function(fn, obj) {\n\n },\n\n alterObjects : fun...
javascript
chosen
[ { "from": "system", "value": "Add line break to fix linter\n" }, { "from": "human", "value": "import styles from './Footer.css';\nimport React, { Component } from 'react';\n\nexport default class Header extends Component {\n render() {\n return (\n <footer className={styles.footer}>\n ...
javascript
chosen
[ { "from": "system", "value": "Add some initial tracking events\n" }, { "from": "human", "value": "'use strict';\n\n/*\n * Module for tracking user actions\n */\n\nangular.module('trackinghandler', [])\n.factory('trackingFactory', function ($ionicAnalytics, $window) {\n\n var registerGlobals =...
javascript
chosen
[ { "from": "system", "value": "Load markdown files in webpack\n" }, { "from": "human", "value": "const path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n entry: './client/Index.ts',\n module: {\n rules: [\n {\n test: /\\.tsx?$/,\n use: 'ts...
javascript
chosen
[ { "from": "system", "value": "[bug] Fix bug on cartridge handler\n" }, { "from": "human", "value": "var builder = require('focus').component.builder;\nvar React = require('react');\nvar applicationStore = require('focus').application.builtInStore();\n\nvar cartridgeMixin = {\n getDefaultProps: ...
javascript
chosen
[ { "from": "system", "value": "Add fail on invalid command to reload\n\n" }, { "from": "human", "value": "'use babel';\n'use strict';\n\nimport Command from '../Command';\nimport now from 'performance-now';\n\nexport default class Reload extends Command\n{\n\tconstructor(bot)\n\t{\n\t\tsuper(bot,...
javascript
chosen
[ { "from": "system", "value": "Return `value` as `null` when done.\n\nCloses #75.\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.asyncIterator]: fun...
javascript
chosen
[ { "from": "system", "value": "Remove now-extra specific excision of the version_info query string - the\n\"bare\" option is invoked to do the job.\n" }, { "from": "human", "value": "/**\n * FileVersionModel.js\n */\n(function (spiderOakApp, window, undefined) {\n \"use strict\";\n var console ...
javascript
chosen
[ { "from": "system", "value": "Clarify redux form input binding\n" }, { "from": "human", "value": "import React, { PropTypes } from 'react';\nimport TextField from 'material-ui/TextField';\n\nconst LongTextInput = ({ input, label, meta: { touched, error }, options }) => (\n <TextField\n ...
javascript
chosen
[ { "from": "system", "value": "Set `disableHostCheck: true` for webpack-dev-server\n" }, { "from": "human", "value": "const path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n devtool: 'source-map',\n ...
javascript
chosen
[ { "from": "system", "value": "Add rackhdCallbackScript variable to centos task for template rendering\n" }, { "from": "human", "value": "// Copyright 2015, EMC, Inc.\n\n'use strict';\n\nmodule.exports = {\n friendlyName: 'Install CentOS',\n injectableName: 'Task.Os.Install.CentOS',\n im...
javascript
chosen
[ { "from": "system", "value": "Add reducer cases for add/removing board filters\n" }, { "from": "human", "value": "import initialState from './initialState';\nimport { \n BOARD_REQUESTED, \n BOARD_LOADED, \n BOARD_DESTROYED, \n BOARD_SCROLLED_BOTTOM,\n BOARD_FILTER,\n BOARD_INVA...
javascript
chosen
[ { "from": "system", "value": "Throw a Gulp stream error upon Compass compilation failure.\n" }, { "from": "human", "value": "var gulp = require(\"gulp\");\nvar CFG = require(\"./utils/config.js\");\nvar $ = require(\"gulp-load-plugins\")();\nvar path = require(\"path\");\nvar pkg = require(path....
javascript
chosen
[ { "from": "system", "value": "Refactor previous code into a function\n" }, { "from": "human", "value": "var myId = data[\"student\"][\"id\"];\nvar myGrade;\n\nvar finalGrades;\n\ndata[\"evaluations\"].forEach(function(grades) {\n if(grades[\"name\"] === \"Pauta Final\") {\n finalGrades...
javascript
chosen
[ { "from": "system", "value": "Add Update Position For Hue Slider\n" }, { "from": "human", "value": "let React = require(\"react\")\nlet Colr = require(\"colr\")\nlet cx = require(\"classnames\")\nlet draggable = require('./higher_order_components/draggable')\nlet {errorList, sizeClassNames, form...
javascript
chosen
[ { "from": "system", "value": "Put Minionette together in the right order.\n" }, { "from": "human", "value": "var Minionette = (function(global, _, $, Backbone) {\n 'use strict';\n\n // Define and export the Minionette namespace\n var Minionette = {};\n Backbone.Minionette = Minionett...
javascript
chosen
[ { "from": "system", "value": "Exit from for loop to reduce execution time\n\nUsing `forEach` doesn't give an option to break the loop so implement it ourselves then use `stop` to break from it.\r\n\r\nI also like to support the asynchronous each? will it break library?" }, { "from": "human", "va...
javascript
chosen
[ { "from": "system", "value": "Enable public access to default settings\n" }, { "from": "human", "value": "/*!\n * jQuery Fragment Scroll v1.0.1\n *\n * Copyright 2014 miWebb and other contributors\n * Released under the MIT license\n */\n\n(function($) {\n\t\"use strict\";\n\n\t$.fn.fragmentScro...
javascript
chosen
[ { "from": "system", "value": "Add comments to example module\n" }, { "from": "human", "value": "/**\n * Example WebSocket module.\n */\n\nclass EchoChat {\n constructor( ws ) {\n this.ws = ws;\n }\n\n doAction( messageObj ) {\n console.log( \"do action\", messageObj );\n ...
javascript
chosen
[ { "from": "system", "value": "Disable destructuring enforcement on array\n" }, { "from": "human", "value": "'use strict';\nconst path = require('path');\n\nmodule.exports = {\n\textends: path.join(__dirname, 'index.js'),\n\trules: {\n\t\t'no-var': 'error',\n\t\t'object-shorthand': ['error', 'alw...
javascript
chosen
[ { "from": "system", "value": "Add reducer cases for newly added actions\n" }, { "from": "human", "value": "/**\n * mSupply Mobile\n * Sustainable Solutions (NZ) Ltd. 2019\n */\n\nimport { PATIENT_ACTIONS } from '../actions/PatientActions';\n\nconst patientInitialState = () => ({\n currentPatien...
javascript
chosen
[ { "from": "system", "value": "Add vaccine reducer blink/start/stop cases\n" }, { "from": "human", "value": "import { VACCINE_ACTIONS } from '../actions/VaccineActions';\n\nconst initialState = () => ({\n isScanning: false,\n scannedSensorAddresses: [],\n});\n\nexport const VaccineReducer = (st...
javascript
chosen
[ { "from": "system", "value": "Add Chiang Mai Province in address info\n" }, { "from": "human", "value": "const office = {\n bangkok: {\n lat: 13.7456,\n lng: 100.5623,\n key: 'Asoke Tower',\n address:\n '219 / 22 Asoke Towers 7th, Soi Sukhumvit 21 Rd.\\nKlongtoey Nua, Wattana, ...
javascript
chosen
[ { "from": "system", "value": "Return promise from listen call.\n" }, { "from": "human", "value": "const Koa = require('koa');\nconst bodyParser = require('koa-bodyparser');\nconst request = require('./request');\n\nclass Server {\n constructor() {\n this.app = new Koa();\n this.app.use(as...
javascript
chosen
[ { "from": "system", "value": "tweak: Use babel config with react\n" }, { "from": "human", "value": "/**\n *\n */\nmodule.exports = {\n extends: [\n require.resolve('./base-config.js'),\n require.resolve('eslint-config-airbnb/rules/react'),\n // require.resolve('eslint-config-airbnb/rul...
javascript
chosen
[ { "from": "system", "value": "Make the server work again\n\nThis solution has a slight disadvantage, if running either library or pages, the assets are served in the root, otherwise we get different relative paths based on the output path." }, { "from": "human", "value": "import express from 'ex...
javascript
chosen
[ { "from": "system", "value": "Fix a situation where the file system polyfill was causing a name collision in Closure.\n" }, { "from": "human", "value": "var missing_externs = {};\n\nmissing_externs.deltaX;\nmissing_externs.deltaY;\nmissing_externs.wheelDeltaX;\nmissing_externs.wheelDeltaY;\nmiss...
javascript
chosen
[ { "from": "system", "value": "Remove scroll event before applying new one\n" }, { "from": "human", "value": "import $ from 'jquery'\nimport {Behavior} from 'backbone.marionette'\nimport template from './BtnToTop.ejs'\n\nclass BtnToTop extends Behavior {\n\n events() {\n return {\n ...
javascript
chosen
[ { "from": "system", "value": "Update name lists on each call\n" }, { "from": "human", "value": "/* global angular, StellarSdk */\n\nangular.module('app')\n.directive('uniqueName', function (Contacts, Wallet) {\n\t'use strict';\n\n\tconst names = getNames();\n\n\tfunction getNames() {\n\t\tconst ...
javascript
chosen
[ { "from": "system", "value": "Transform commonjs import into require so that transform-require works\n" }, { "from": "human", "value": "module.exports = {\n presets: [\n 'stage-1',\n ],\n plugins: [\n 'transform-runtime'\n ],\n}\n" }, { "from": "gpt", "value": "module.expor...
javascript
chosen
[ { "from": "system", "value": "Set frameset to 100%,0% on load.\n" }, { "from": "human", "value": "function receiveMessage(event) {\n\tvar commentPath,\n\t\tframeURL;\n\n\t// get url of comment\n\tcommentPath = event.data.commentURL;\n\tframeURL \t= \"https://news.ycombinator.com/\" + commentPath...
javascript
chosen
[ { "from": "system", "value": "Add missing keywords, fix typo from vim syntax file\n" }, { "from": "human", "value": "define(function (require) {\n 'use strict';\n var jquery = require('jquery');\n var monaco = require('monaco');\n var cpp = require('vs/basic-languages/src/cpp');\n\n ...
javascript
chosen
[ { "from": "system", "value": "Use port 80 for socket server.\n" }, { "from": "human", "value": "\"use strict\";\n\nangular.module(\"hikeio\").\n\tservice(\"config\", [\"$location\", function($location) {\n\t\tthis.isProd = $location.host() === \"hike.io\";\n\t\tthis.hikeImagesPath = this.isProd ...
javascript
chosen
[ { "from": "system", "value": "Improve accuracy of keyword counts.\n" }, { "from": "human", "value": "/**\nKeyword analysis for HackMyResume.\n@license MIT. See LICENSE.md for details.\n@module keyword-inspector.js\n*/\n\n\n\n(function() {\n\n\n\n var _ = require('underscore');\n var FluentDate...
javascript
chosen
[ { "from": "system", "value": "Test port change for hapi-auth-hawk plugin\n" }, { "from": "human", "value": "/**\n * Created by Omnius on 6/15/16.\n */\n'use strict';\n\nconst Boom = require('boom');\n\nexports.register = (server, options, next) => {\n\n server.auth.strategy('hawk-login-auth-s...
javascript
chosen
[ { "from": "system", "value": "[RFR] Fix title is not updated when record changes\n\nFixes #1236\n\nThis is because onlyUpdateForKeys does not work for deep objects. See https://github.com/acdlite/recompose/issues/166\n" }, { "from": "human", "value": "import React from 'react';\nimport PropTypes...
javascript
chosen
[ { "from": "system", "value": "Switch to new pliers plugin interface\n" }, { "from": "human", "value": "var fs = require('fs')\n , request = require('request')\n\nmodule.exports = function (pliers, name) {\n\n pliers(name || 'npmSecurityCheck', function (done) {\n fs.createReadStream('./npm-...
javascript
chosen
[ { "from": "system", "value": "Fix Indent, an storing accessTokens\n" }, { "from": "human", "value": "/**\n * Created by joeparrinello on 10/3/15.\n */\n\nvar passport = require('passport');\nvar FacebookTokenStrategy = require('passport-facebook-token');\n\nvar User = require('../models/user.js'...
javascript
chosen
[ { "from": "system", "value": "Initialize method with this.options to pass position to client-side\n" }, { "from": "human", "value": "define(function(require, exports, module) {\n var _ = require('underscore');\n var $ = require('jquery');\n var Backbone = require('backbone');\n var GenderTpl...
javascript
chosen
[ { "from": "system", "value": "Remove reference to admin-commands which doesn't exist yet.\n" }, { "from": "human", "value": "module.exports = function (o) {\n o.db.user = this;\n\n o.commandHandler = require('admin-commands')(this);\n};\n" }, { "from": "gpt", "value": "module.expor...
javascript
chosen
[ { "from": "system", "value": "Reduce code, use more of the existing variables and lodash sugar.\n" }, { "from": "human", "value": "'use strict';\n\n// store method reference in case it is overwritten later\nvar getDescriptor = Object.getOwnPropertyDescriptor,\n setDescriptor = Object.definePr...
javascript
chosen
[ { "from": "system", "value": "Allow enter button to trigger login.\n" }, { "from": "human", "value": "var authDialog;\nvar loadingDialog;\n\nvar authDialogPassword;\nvar authSubmit;\n\nvar forwardUrl = QueryString.fu;\n\nfunction onLoad() {\n authDialog = $(\"#auth_dialog\");\n loadingDial...
javascript
chosen
[ { "from": "system", "value": "Change worker stats api url\n" }, { "from": "human", "value": "import Promise from 'bluebird';\nimport request from 'superagent';\nimport camelcase from 'camelcase';\nimport snakecase from 'snake-case';\nimport _ from 'lodash';\n\nPromise.promisifyAll(request);\n\ne...
javascript
chosen
[ { "from": "system", "value": "Clean up console output a bit.\n" }, { "from": "human", "value": "#!/usr/bin/env node\n//@flow\n\nconst elmCss = require(\"../\"),\n program = require(\"commander\"),\n chalk = require(\"chalk\"),\n path = require(\"path\"),\n pkg = require(\"../package.json\");...
javascript
chosen
[ { "from": "system", "value": "Implement super-minimal stats without formatting or gzip stats\n" }, { "from": "human", "value": "'use strict';\n\nmodule.exports = function () {\n return function (tree) {\n // TODO: implement\n return tree;\n };\n};\n" }, { "from": "gpt...
javascript
chosen
[ { "from": "system", "value": "Select the embed code on click\n" }, { "from": "human", "value": "Template.home.events({\n 'submit .demo-form': function (e, tpl) {\n e.preventDefault();\n var fullName = tpl.$('.package-name').val();\n var iconPath = Meteor.absoluteUrl(`package/${fullName...
javascript
chosen
[ { "from": "system", "value": "feat(templates): Add more badges to README\n" }, { "from": "human", "value": "/* @flow */\nimport type { Template } from 'create-npm/lib/template'\n\nexport default function({ repoName }: { repoName: string }): Template {\n const [, packageName] = repoName.split('/...
javascript
chosen
[ { "from": "system", "value": "Solve problem 01. Odd or Eaven\n" }, { "from": "human", "value": "function foo () {\n var num = 8;\n if (num % 2 === 0) {\n console.log('even');\n } else {\n console.log('odd');\n }\n}\n\nfoo();\n\n" }, { "from": "gpt", "value":...
javascript
chosen
[ { "from": "system", "value": "Fix tests to respect removal of magic arg\n" }, { "from": "human", "value": "var test = require('tape');\nvar loader = require('../primus-loader');\nvar qsa = require('fdom/qsa');\nvar async = require('async');\n\ntest('can load primus', function(t) {\n t.plan(2);\...
javascript
chosen
[ { "from": "system", "value": "Make sure all tests pass for Travis\n" }, { "from": "human", "value": "/**\n *\n * Application or Website name\n *\n * Copyright 2015, Author Name\n * Some information on the license.\n *\n * Tests > Unit > Sample\n *\n * Jasmine test examples: http://evanhahn.com/h...
javascript
chosen
[ { "from": "system", "value": "Add logic for es5 to take in arguments instead of array.\n" }, { "from": "human", "value": "\"use strict\";\n\nvar counter = function() {\n var numbers = Array.prototype.slice.call(arguments);\n return numbers.reduce(function(prev, curr) {\n return prev...
javascript
chosen
[ { "from": "system", "value": "Fix bug when an event happens on a non-component with root as parent\n" }, { "from": "human", "value": "var ReactDOMComponentTree = require('react/lib/ReactDOMComponentTree')\n\nvar utils = require('../lib/utils')\n\nfunction nodeName (domNode) {\n var reactElem = ...
javascript
chosen
[ { "from": "system", "value": "Add markers on map and adjust window size based on all markers\n" }, { "from": "human", "value": "import React, { createRef } from 'react'\n\n/**\n * Props:\n * zoom : 13 - higher the number, the more zoomed the map is on center\n * center: {lat:0.0, lng:0.0} - coor...
javascript
chosen
[ { "from": "system", "value": "Comment out old demos for now.\n" }, { "from": "human", "value": "/// <reference path=\"../typings/angularjs/angular.d.ts\"/>\nangular.module('MyModule', ['ngRoute']);\n\nangular.module('MyModule').config(function ($routeProvider) {\n $routeProvider.when(\"/main\"...
javascript
chosen
[ { "from": "system", "value": "Use a host-relative URL for the websocket\n" }, { "from": "human", "value": "$(function() {\n var socket = new WebSocket(\"ws://localhost:3001/\");\n\n socket.onmessage = function(message){\n console.log('got a message: ')\n console.log(message)\n }\n\n});\...
javascript
chosen
[ { "from": "system", "value": "Set default state property values to `null`\n" }, { "from": "human", "value": "/* eslint-disable */\n// export default function detailReducer(state = {}, action) {\n/* istanbul ignore next */\nwindow.reducers = window.reducers || {};\nwindow.reducers.detailReducer =...
javascript
chosen
[ { "from": "system", "value": "Add version constraints to make meteor publish happy.\n" }, { "from": "human", "value": "Package.describe({\n name: 'cunneen:packmeteor',\n version: '0.1.12',\n summary: \"Rig the basics for packmeteor\",\n git: 'https://github.com/cunneen/packmeteor'\n});\n\nPa...
javascript
chosen
[ { "from": "system", "value": "Add get method for accessToken on class\n" }, { "from": "human", "value": "var rpcRequest = require('./rpc-request');\n\nvar DropboxApi = function () {\n this.accessToken = '';\n};\n\nDropboxApi.prototype.setAccessToken = function (accessToken) {\n this.accessToke...
javascript
chosen
[ { "from": "system", "value": "Reset section field after add.\n" }, { "from": "human", "value": "Template.addSection.events({\n 'click #add-section-button': function (event, template) {\n /*\n / Add new section to the course\n */\n\n // Get current sections, before ...
javascript
chosen
[ { "from": "system", "value": "Fix syntax error in command-line client\n" }, { "from": "human", "value": "#!/usr/bin/env node\n\nvar util = require('util');\nvar path = require('path');\nvar minimist = require('minimist');\nvar index = require('../lib/index');\n\nfunction list(arg) {\n...
javascript
chosen
[ { "from": "system", "value": "MRWidget: Make error message bold and red.\n" }, { "from": "human", "value": "import eventHub from '../../event_hub';\n\nexport default {\n name: 'MRWidgetAutoMergeFailed',\n props: {\n mr: { type: Object, required: true },\n },\n data() {\n return {\n ...
javascript
chosen
[ { "from": "system", "value": "Allow ExpressMiddleware without extra prefix\n" }, { "from": "human", "value": "/*\n * Return express middleware that measures overall performance.\n */\nfunction factory(parentClient) {\n return function (prefix, options) {\n var client = parentClient.get...
javascript
chosen
[ { "from": "system", "value": "Adjust check to reject single-column entries\n" }, { "from": "human", "value": "/**\n * @class csv\n * @module Parsers\n */\nmodule.exports = (function() {\n\n var FileParser = require('../interfaces/FileParser');\n\n /**\n * @method Parser\n * @constr...
javascript
chosen
[ { "from": "system", "value": "Enforce using all args and ignore with underscore\n" }, { "from": "human", "value": "module.exports = {\n parser: 'babel-eslint',\n rules: {\n // Disallow dangling commas\n 'comma-dangle': [2, 'never'],\n\n // Allow anonymous functions\n 'func-names': ...
javascript
chosen
[ { "from": "system", "value": "Reduce complexity, hinted by eslint." }, { "from": "human", "value": "export default class RawKataData{\n constructor(loadRemoteFile, katasUrl){\n this.katasUrl = katasUrl;\n this.loadRemoteFile = loadRemoteFile;\n }\n\n load(onError, onSuccess) {\n cons...
javascript
chosen
[ { "from": "system", "value": "Fix multiple chat buttons when relaunching the bookmarklet" }, { "from": "human", "value": "require('./main.css');\nvar d = document,\n _queryS = d.querySelector.bind(d);\n\nvar mybt = d.createElement('i');\nmybt.setAttribute('class', 'btn btn-large btn-l-gray bt...
javascript
chosen