conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Save user information in local storage\n" }, { "from": "human", "value": "import axios from 'axios';\nimport { push } from 'react-router-redux';\nimport { LOGGING_IN, LOGIN_SUCCESS, LOGIN_FAILURE } from './types';\nimport { apiURL } from './userSignUp';\n\nconst log...
javascript
chosen
[ { "from": "system", "value": "Make sure intercom object is on the window before trying to call apply\n" }, { "from": "human", "value": "(function() {\n /* globals define */\n 'use strict';\n\n function l(config) {\n var i = function() {\n i.c(arguments);\n };\n i.q = [];\n i....
javascript
chosen
[ { "from": "system", "value": "Configure ad hoc test rig to force stop and restart\n" }, { "from": "human", "value": "'use strict';\n\n// This module pits a cluster of aggressive clients against a cluster of flaky\n// servers.\n\nvar path = require('path');\nvar ClusterSupervisor = require('../cl...
javascript
chosen
[ { "from": "system", "value": "test(LineChart): Add hoverSize option to LineChart test/example\n" }, { "from": "human", "value": "import { msft } from '../util/datasets';\nimport showComponent from '../util/showComponent';\n\nwindow.onload = () => {\n showComponent('LineChart', 'div', {\n dat...
javascript
chosen
[ { "from": "system", "value": "[refactor] Make selector more specific\nTo avoid conflicts with future examples.\n" }, { "from": "human", "value": "import React, { Component } from 'react'\nimport * as d3 from 'd3'\n\nclass SelectionAndData extends Component {\n componentDidMount() {\n const r...
javascript
chosen
[ { "from": "system", "value": "Make sure that the user local storage is only called for real server\n" }, { "from": "human", "value": "'use strict';\n\nrequire('./user-store-manage');\nrequire('./user-repository-internal');\n\nvar glimpse = require('glimpse');\nvar localRepository = require('./us...
javascript
chosen
[ { "from": "system", "value": "Throw NotFound instead of 500\n\n" }, { "from": "human", "value": "const { BadRequest } = require('@feathersjs/errors');\nconst { schoolModel: School } = require('../model');\n\n/**\n * Add school object referenced in route to params\n *\n * @example `/schools/23bd1...
javascript
chosen
[ { "from": "system", "value": "Check for specific prop of window before adding window handlers\n\nAllows for webpack static builds where a dummy window object is present (eg static-site-generator-webpack-plugin).\n" }, { "from": "human", "value": "// local imports\nimport addPerformanceModeHandle...
javascript
chosen
[ { "from": "system", "value": "Change API, .create() return promise\n" }, { "from": "human", "value": "/**\n * @file Node env\n * @author treelite(c.xinle@gmail.com)\n */\n\nvar extend = require('saber-lang').extend;\nvar configMgr = require('./lib/config');\n\n/**\n * 全局配置\n *\n * @param {Object...
javascript
chosen
[ { "from": "system", "value": "Sort by order of descending length for phrase mapping; the mapping is first copied to avoid changing the order of the original array\n" }, { "from": "human", "value": "(function PhraseMappingServiceModule() {\n\t\"use strict\";\n\t\n\tangular.module('translate.app')...
javascript
chosen
[ { "from": "system", "value": "Allow an `options` to be passed when initializing modal\n" }, { "from": "human", "value": "var $soloModal = null // Used when allowMultiple = false.\n\n// The public API.\nModal = {\n\t\n\tallowMultiple: false,\n\t\n\tshow: function(templateName, data){\n\t\t\n\t\ti...
javascript
chosen
[ { "from": "system", "value": "Add source map to uglifyjs\n" }, { "from": "human", "value": "const webpack = require('webpack');\nconst path = require('path');\n\nmodule.exports = {\n entry: './src/index.js',\n devtool: 'source-map',\n output: {\n path: path.join(__dirname, 'dist'),\n fi...
javascript
chosen
[ { "from": "system", "value": "Fix links in tags page\n" }, { "from": "human", "value": "import React from 'react';\nimport PropTypes from 'proptypes';\nimport graphql from 'graphql';\nimport Link from '../components/Link';\n\nclass TagRoute extends React.Component {\n static propTypes = {\n ...
javascript
chosen
[ { "from": "system", "value": "[Danger] Add a check for lib code before failing the build\n" }, { "from": "human", "value": "// CHANGELOG check\nif (_.includes(git.modified_files, \"CHANGELOG.md\") === false) {\n fail(\"No CHANGELOG added.\")\n}\n\nconst test_files = _.filter(git.modified_files,...
javascript
chosen
[ { "from": "system", "value": "Add a kata, which explains what the \"unary operator\" is.\n" }, { "from": "human", "value": "// ES1 - 8: Unary + Operator\n// To do: make all tests pass, leave the assert lines unchanged!\n// Follow the hints of the failure messages!\n\ndescribe('Unary \"+\" operat...
javascript
chosen
[ { "from": "system", "value": "Fix bug in publishable behaviour\n" }, { "from": "human", "value": "/**\n * The Publishable Behaviour class\n *\n * @constructor\n * @extends alchemy.classes.Behaviour\n *\n * @author Jelle De Loecker <jelle@codedor.be>\n * @since 0.1.0\n * @v...
javascript
chosen
[ { "from": "system", "value": "Fix two bugs. First is that the unsubscribe event is triggered even if the client isn't subscribed. Second is that that messages weren't being sent to all clients due to the 'len' variable being cached.\n" }, { "from": "human", "value": "var sys = require(\"sys\"), ...
javascript
chosen
[ { "from": "system", "value": "Revert \"Make nodeModulesBabelLoader compatible with Babel 6\"\n\nThis reverts commit 1bcb78fa\n" }, { "from": "human", "value": "import { includePaths, excludePaths } from '../config/utils';\n\nexport default options => ({\n test: /\\.(mjs|jsx?)$/,\n use: [\n ...
javascript
chosen
[ { "from": "system", "value": "Logs: Set stdout log level to trace\n" }, { "from": "human", "value": "/**\n * This file sets up the logging system and also sets up the\n * external logs system if enabled in the config.\n *\n * The log module will be called by the whole application a lot\n * durin...
javascript
chosen
[ { "from": "system", "value": "Send guilds every 10 secs to datadog\n" }, { "from": "human", "value": "import { StatsD } from 'node-dogstatsd'\nvar dogstatsd = new StatsD()\n\nfunction registerEvents (bot) {\n bot.on('messageCreate', (msg) => {\n dogstatsd.increment('blair.messages_total')\n ...
javascript
chosen
[ { "from": "system", "value": ":art: Make the app always transparent\n" }, { "from": "human", "value": "const {\n app,\n BrowserWindow,\n ipcMain\n} = require('electron')\nconst { platform } = require('os')\nconst { join } = require('path')\n\nlet win\napp.on('ready', () => {\n win = new ...
javascript
chosen
[ { "from": "system", "value": "Use correct noun for sample remove modal\n\nUse 'sample' instead of 'OTU'" }, { "from": "human", "value": "import React from \"react\";\nimport { connect } from \"react-redux\";\nimport { push } from \"connected-react-router\";\nimport { routerLocationHasState } fro...
javascript
chosen
[ { "from": "system", "value": "Make lookup accessible for 1.13.x and 2.x\n" }, { "from": "human", "value": "import Config from '../config/environment';\n\nexport function initialize(instance) {\n if (Config.mixpanel.enabled) {\n var router = instance.lookup('router:main');\n router.on('did...
javascript
chosen
[ { "from": "system", "value": "chore(pui): Add necessary modules to styleguide\n" }, { "from": "human", "value": "global.$ = global.jQuery = require('jquery');\nglobal._ = require('lodash');\nrequire('bootstrap');\n\nrequire('pui-prismjs');\n\nrequire('./scale')();\nrequire('@npmcorp/pui-react-ba...
javascript
chosen
[ { "from": "system", "value": "Allow plusplus in for loops\n" }, { "from": "human", "value": "module.exports = {\n \"parserOptions\": {\n \"ecmaVersion\": 6,\n \"sourceType\": \"module\",\n \"ecmaFeatures\": {\n \"experimentalObjectRestSpread\": true,\n },\n },\n\n \"rules\": ...
javascript
chosen
[ { "from": "system", "value": "Make sure user is authenticated when calling api\n" }, { "from": "human", "value": "\"use strict\";\n\nvar express = require('express');\nvar api = require('./modules/projectController.js');\nvar errorHandler = require('./modules/errorHandler.js');\nvar mongoose = r...
javascript
chosen
[ { "from": "system", "value": "Add a default port (8080)\n" }, { "from": "human", "value": "/**\n * Extract all the necessary\n * configuration information\n * from either command line arguments\n * (which take priority) or environment\n * variables. Non-specified information\n * should prevent t...
javascript
chosen
[ { "from": "system", "value": "Fix computation of ticks for yAxis on responsive - part two\n" }, { "from": "human", "value": "export default chart => {\n if (chart.responsive) {\n\n const {\n width,\n height\n } = chart\n\n // preserve original values\n chart._originWidth =...
javascript
chosen
[ { "from": "system", "value": "Replace \"noon\" handler with a handler that throws an error, per advice from Antranig. Also greatly improved documentation in comments.\n" }, { "from": "human", "value": "// Base gradeName for handlebars \"helper\" modules, which can be used on both the client and...
javascript
chosen
[ { "from": "system", "value": "Add a functionnal Ajax module\n" }, { "from": "human", "value": "Pebble.addEventListener(\"ready\",\n function(e) {\n console.log(\"Hello world! - Sent from your javascript application.\");\n }\n);\n" }, { "from": "gpt", "value": "Pebble.add...
javascript
chosen
[ { "from": "system", "value": "Add shader-chunks to built app\n" }, { "from": "human", "value": "/*jshint node:true*/\n'use strict';\n\n// https://github.com/gruntjs/grunt-contrib-uglify\n\n// Minify files with UglifyJS.\n\nmodule.exports = function (config) {\n return {\n app: {\n src: ...
javascript
chosen
[ { "from": "system", "value": "Add transitionend event to remove playing class\n" }, { "from": "human", "value": "window.addEventListener('keydown', function(e) {\n let audio = document.querySelector(`audio[data-key='${e.keyCode}']`)\n\tlet key = document.querySelector(`.key[data-key='${e.keyCod...
javascript
chosen
[ { "from": "system", "value": "Fix test case for crbug/507070.\n\n--debug-code causes full-codegen on arm64 to emit different number\nof calls, which confuses the debugger when on-stack replacing code\nwith recompiled debug version on-stack.\n\nBUG=chromium:507070\nTBR=mstarzinger@chromium.org\nLOG=N\n\nRevi...
javascript
chosen
[ { "from": "system", "value": "Add language field not found in yaml file test case\n" }, { "from": "human", "value": "/* global describe it */\n'use strict'\n\nconst chai = require('chai')\nconst chaiAsPromised = require('chai-as-promised')\nconst requireInject = require('require-inject')\nconst ...
javascript
chosen
[ { "from": "system", "value": "Add route to server location message\n" }, { "from": "human", "value": "process.title = 'test-server';\n\nvar fs = require('fs');\nvar hapi = require('hapi');\nvar inert = require('inert');\n\nvar root = fs.readFileSync(__dirname + '/layout_partials/root.hbt').toS...
javascript
chosen
[ { "from": "system", "value": "Create final version of User SignIn and Error Handling\n" }, { "from": "human", "value": "'use strict';\n\nangular.module('myApp.register',['ngRoute', 'firebase'])\n\n//Declare route\n.config(['$routeProvider', function($routeProvider){\n\t$routeProvider.when('/regi...
javascript
chosen
[ { "from": "system", "value": "Fix broken unit test which resulted from deprecating KeyboardDirectionMixin defining a public orientation property.\n" }, { "from": "human", "value": "import * as symbols from '../../src/symbols.js';\nimport KeyboardDirectionMixin from '../../src/KeyboardDirectionMi...
javascript
chosen
[ { "from": "system", "value": "Set corresponder visible by default\n" }, { "from": "human", "value": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/M...
javascript
chosen
[ { "from": "system", "value": "Modify the cypress test since the \"first\" input is now the days projection input\n" }, { "from": "human", "value": "/// <reference types=\"cypress\" />\n\ncontext('Actions', () => {\n beforeEach(() => {\n cy.visit('http://localhost:8000')\n })\n\n it('All + ...
javascript
chosen
[ { "from": "system", "value": "Support multiple loggers per module\n" }, { "from": "human", "value": "var REPLACE_TOKEN = '__LOGGING_NAME__'\n, THIS_MODULE = /(?:[^\\/]+\\/node_modules\\/)?triton\\/buildutils\\/logging-name-loader\\.js$/\n, BASE_PATH = module.filename.replace(THIS_MODUL...
javascript
chosen
[ { "from": "system", "value": "Add arguments to abstract functions.\n" }, { "from": "human", "value": "// An infinite computer must be able to do the following things:\n// 1. getTotalScrollableHeight()\n// 2. getDisplayIndexStart()\n// 3. getDisplayIndexEnd()\n\nclass InfiniteComputer {\n con...
javascript
chosen
[ { "from": "system", "value": "Fix line endings; watch more file extensions; disable on EXIT_ON_CHANGES=0\n" }, { "from": "human", "value": "var fs = require('fs');\r\n\r\nif(process.env.EXIT_ON_CHANGES) {\r\n\tconsole.log(\"In development mode, will exit on file changes in cwd\");\r\n\tfs.watch(...
javascript
chosen
[ { "from": "system", "value": "Add systemjs import for tests\n" }, { "from": "human", "value": "'use strict';\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport TestUtils from 'react-addons-test-utils';\nimport expect from 'unexpected';\n\nimport CardComponent from './CardCo...
javascript
chosen
[ { "from": "system", "value": "Change links to TCGplayer links\n" }, { "from": "human", "value": "app.service(\"cardService\", function() {\n this.getCardUrl = function(name) {\n name = this.sanitizeName_(name);\n return \"http://gatherer.wizards.com/Pages/Card/Details.aspx?name=\" + name;...
javascript
chosen
[ { "from": "system", "value": "Disable the Stamp and Line Panels\n" }, { "from": "human", "value": "export {default as StampPanel} from './stamp-panel.js';\nexport {default as LinePanel} from './line-panel.js';\n" }, { "from": "gpt", "value": "//export {default as StampPanel} from './...
javascript
chosen
[ { "from": "system", "value": "Add errors to API strategy\n" }, { "from": "human", "value": "/*\n* FIXME: Move format-specific stuff out of responder into\n* individual strategies? All the API formats share this\n* strategy for now.\n*/\nvar utils = require('utilities')\n , Strategy = functi...
javascript
chosen
[ { "from": "system", "value": "Use body property of Notification\n\nInstead of the non-existing content property.\n" }, { "from": "human", "value": "// Main process\n'use strict';\nconst path = require('path');\nconst app = require('app');\nconst ipcMain = require('electron').ipcMain;\nconst Brow...
javascript
chosen
[ { "from": "system", "value": "Revert \"adding settings for EJS render method\"\n" }, { "from": "human", "value": "'use strict';\n\nvar through = require('through2');\nvar gutil = require('gulp-util');\nvar ejs = require('ejs');\nvar assign = require('object-assign');\n\nmodule.exports = function...
javascript
chosen
[ { "from": "system", "value": "refactor: Move deps api into subapp\n" }, { "from": "human", "value": "const express = require('express');\nconst app = express();\nconst backpat = require('backpat').backpat;\n\napp.use(express.static('./'));\napp.use(express.static('dist'));\n\napp.get('/favicon.i...
javascript
chosen
[ { "from": "system", "value": "Set file.path as the error object's .fileName\n\nThe default error message generated when there's a syntax error in a JSX file doesn't include the source file name, only the line number the error was found on.\r\n\r\nAdding a filePath property to the error object exposes this i...
javascript
chosen
[ { "from": "system", "value": "Fix video URL from PlaylistItem\n" }, { "from": "human", "value": "const duration = require('iso8601-duration');\r\n\r\nclass Video {\r\n constructor(youtube, data) {\r\n this.youtube = youtube;\r\n this.title = data.snippet.title;\r\n this.i...
javascript
chosen
[ { "from": "system", "value": "Use error response instead of throwing error\n" }, { "from": "human", "value": "#!/usr/bin/env node\n\nvar fs = require('fs'),\n path = require('path'),\n url = require('url'),\n templates = require('./templates'),\n Server = require('./server').Serve...
javascript
chosen
[ { "from": "system", "value": "Use navigator model when clicking in home url" }, { "from": "human", "value": "define([\n 'jquery',\n 'backbone',\n 'dust',\n 'dust.marionette',\n 'models/settings-model',\n 'controllers/event-bus',\n 'header-template',\n], function ($, Backbone, dust, dustMa...
javascript
chosen
[ { "from": "system", "value": "Remove needless logging of encoded lines.\n" }, { "from": "human", "value": "let fs = require(\"fs\");\n\nlet data = fs.readFileSync(\"./data\").toString();\n\nlet codeCharacters = 0;\nlet encodedCharacters = 0;\n\ndata.split(\"\\n\").forEach(line => {\n\tcodeCharac...
javascript
chosen
[ { "from": "system", "value": "Correct link to start controller in routing\n" }, { "from": "human", "value": "'use strict';\n\nangular.module('repicbro', ['repicbro.controllers',\n 'repicbro.services',\n 'repicbro.filters',\n ...
javascript
chosen
[ { "from": "system", "value": "Fix all bugs with WOW\n" }, { "from": "human", "value": "/**\n * Created by George Ruan on May 22, 2016.\n *\n * Defines the routing behavior for the web application.\n */\n\n(function() {\n 'use strict';\n\n angular\n .module('nobe', ['ngRoute']) // Set up ap...
javascript
chosen
[ { "from": "system", "value": "Implement passing code for the headers\n" }, { "from": "human", "value": "const jwt = require('jsonwebtoken')\nconst userModel = require('../../models/users')\nconst { buildResponse } = require('../../utils/responseService')\nconst validator = require('./loginValida...
javascript
chosen
[ { "from": "system", "value": "Add nonspec handlers for animationend.\n" }, { "from": "human", "value": "import Ember from 'ember';\n\nvar ESC = 27;\nvar $document = Ember.$(document);\n\nexport default Ember.Component.extend({\n classNames: 'ui-overlay',\n role: 'dialog',\n\n actions: {...
javascript
chosen
[ { "from": "system", "value": "Initialize the fastclick plugin on document ready\n" }, { "from": "human", "value": ";(function($, win, doc) {\n var $win = $(win);\n var $doc = $(doc);\n\n // Enable CSS active pseudo styles in Mobile Safari\n $doc.on({\n touchstart: function() {}\n });\n})...
javascript
chosen
[ { "from": "system", "value": "Reduce the displayed channels to top 12\n" }, { "from": "human", "value": "import axios from 'axios';\n\n// get top twitch channels\nexport const GET_CHANNELS = 'GET_CHANNELS';\nexport function getChannels() {\n const request = axios.get('https://api.twitch.tv/krak...
javascript
chosen
[ { "from": "system", "value": "Revert \"Fixed the function syntax\"\n\nThis reverts commit 9b1cba30501212f0dda428bf9228d20ac441dfff.\n" }, { "from": "human", "value": "$(document).ready(function(){\n\t//initialize code here\n\t\n\tvar update_ranking = function()\n\t{\n\t\t$.get\n\t\t(\n\t\t\t'aja...
javascript
chosen
[ { "from": "system", "value": "Implement user aware notifications controller\n" }, { "from": "human", "value": "module.exports = {\n\n};\n" }, { "from": "gpt", "value": "module.exports = {\n\n find: function(req, res) {\n return res.badRequest('List notifications is not supported'...
javascript
chosen
[ { "from": "system", "value": "Add function based queries for publications\n" }, { "from": "human", "value": "const DB = require('./db');\n\nclass Boost extends DB {\n constructor(config) {\n super(config);\n this.model = config.model;\n }\n\n db() {\n return this.mo...
javascript
chosen
[ { "from": "system", "value": "Remove @tracked as it is not used\n" }, { "from": "human", "value": "import { inject as service } from '@ember/service';\nimport Component from '@ember/component';\nimport { tracked } from '@glimmer/tracking';\n\nclass Field {\n @tracked name;\n @tracked class;\n}...
javascript
chosen
[ { "from": "system", "value": "Add fix for null images\n" }, { "from": "human", "value": "import Ember from 'ember';\n\nexport default Ember.Object.extend({\n posterDefaultSize: 2,\n posterUrl: function() {\n var posterPath = this.get('poster_path');\n var config = this.get('tmdbConfig');...
javascript
chosen
[ { "from": "system", "value": "Simplify error logging and exit\n" }, { "from": "human", "value": "// @flow\n\n/* eslint-disable no-console */\n\nimport path from 'path';\nimport inquirer from 'inquirer';\nimport writeDefaultConfig from '../writeDefaultConfig';\nimport { fileExists } from '../util...
javascript
chosen
[ { "from": "system", "value": "Fix bug in email subscription server function - if no valid email was sent, respond with email null.\n" }, { "from": "human", "value": "'use strict';\n\n/**\n * Module dependencies.\n */\nvar mailChimp = require('../../node_modules/mailchimp-api/mailchimp'),\n\tvali...
javascript
chosen
[ { "from": "system", "value": "Fix the error that change page after creating project\n" }, { "from": "human", "value": "(function() {\n 'use strict';\n\n angular\n .module('vmsFrontend')\n .controller('CreateProjectController', CreateProjectController);\n\n /** @ngInject */\n function C...
javascript
chosen
[ { "from": "system", "value": "[FIX] Fix formatting on help box\n" }, { "from": "human", "value": "import React from 'react';\nimport { Link } from 'react-router-dom';\n\nconst HelpBox = ({showHelp}) => {\n\tif (showHelp) {\n\t\treturn (\n\t\t\t<div className='pt-callout pt-icon-help pt-intent-pr...
javascript
chosen
[ { "from": "system", "value": "Add email to OrganizationInvitation query\n" }, { "from": "human", "value": "import Relay from 'react-relay';\n\nimport OrganizationMemberRoleConstants from '../constants/OrganizationMemberRoleConstants';\n\nexport default class OrganizationInvitationCreate extends ...
javascript
chosen
[ { "from": "system", "value": "Use var instead of let for now\n" }, { "from": "human", "value": "\"use strict\";\n\nimport Dispatcher from \"../dispatcher\";\nimport Constants from \"../constants\";\nimport StoreCommon from \"./store_common\";\nimport assign from \"object-assi...
javascript
chosen
[ { "from": "system", "value": "Add alerts for web sockets\n" }, { "from": "human", "value": "var hostname = window.location.hostname;\nvar wsaddr = \"wss://\".concat(hostname, \":1234/api\");\nconsole.log(\"Connecting to \" + wsaddr);\n\nvar paladinws = new PaladinWebSocket(wsaddr);\n\nvar width ...
javascript
chosen
[ { "from": "system", "value": "Remove unused dependencies and functions.\n" }, { "from": "human", "value": "Application.Controllers.controller('projectsProject',\n [\"$scope\", \"$stateParams\", \"pubsub\", \"$state\",\n \"ProvD...
javascript
chosen
[ { "from": "system", "value": "Allow circular references in dust templates.\n" }, { "from": "human", "value": "var dust = require('dustjs-linkedin');\nvar _ = require('lodash');\n\ndust.compiled = function(template) {\n\treturn this.template(template).compiled;\n};\n\ndust.src = function(template...
javascript
chosen
[ { "from": "system", "value": "Fix reference to the header-controller\n" }, { "from": "human", "value": "(function(global) {\n 'use strict';\n var app = global.app || {};\n var m = global.m;\n\n var document = global.document;\n\n app.controller = function() {\n var HeaderController = app...
javascript
chosen
[ { "from": "system", "value": "Change Click Event to match new design\n" }, { "from": "human", "value": "chrome.runtime.onMessage.addListener( function(request, sender, sendResponse){\r\n var click_event = new Event('click');\r\n\r\n switch(request.action){\r\n case 'NEXT-MK':\r\n ...
javascript
chosen
[ { "from": "system", "value": "Fix support for message objects\n" }, { "from": "human", "value": "/*jslint node: true */\n\"use strict\";\n\nvar utils = require(\"../utils\");\nvar log = require(\"npmlog\");\n\nmodule.exports = function(mergeWithDefaults, api, ctx) {\n return function deleteMess...
javascript
chosen
[ { "from": "system", "value": "Fix post insertion path for organization, better status codes\n" }, { "from": "human", "value": "const app = require('express')();\nconst Organization = require('../models/Organization');\n\napp.get('/', (req, res) => {\n Organization.find()\n .then(orgs =...
javascript
chosen
[ { "from": "system", "value": "Use `'html'` as output format\n\nPer jstransformers/jstransformer#3.\n" }, { "from": "human", "value": "'use strict';\n\nvar re = /\\]\\]>/g;\n\nexports.name = 'cdata-js';\nexports.outputFormat = 'xml';\n\nexports.render = function (str, options) {\n var escaped = ...
javascript
chosen
[ { "from": "system", "value": "Update display on all key events.\n" }, { "from": "human", "value": "$(function(){\n $('textarea.yaml').change(function(){\n var yaml = jsyaml.load($(this).val());\n var yaml_flat = JSON.flatten(yaml);\n var gengo = \"\"; // = JSON.stringify(yaml_flat, nul...
javascript
chosen
[ { "from": "system", "value": "Remove event listener automatically on page change\n" }, { "from": "human", "value": "var TurbolinksAdapter = {\n beforeMount: function(){\n document.addEventListener('turbolinks:before-cache', () => {\n this.$destroy();\n });\n\n this.$originalEl = t...
javascript
chosen
[ { "from": "system", "value": "Add extra space for convention.\n" }, { "from": "human", "value": "var rest = require('restler');\n\nmodule.exports = {\n 'gif': function(input, cb) {\n var self = this;\n var query = encodeURIComponent(input.parsed);\n var options = { rejectUnauthorized: ...
javascript
chosen
[ { "from": "system", "value": "Create markers based on retrieved posts\n" }, { "from": "human", "value": "var map = null;\n\n$(document).on('pageshow', '#map', function() {\n // draw the map once\n if (map == null) drawMap();\n});\n\nfunction drawMap() {\n $('#map_canvas').css('height', ...
javascript
chosen
[ { "from": "system", "value": "Add comment explaining explicit setting of output\n" }, { "from": "human", "value": "'use strict';\n\nvar peg = require('pegjs');\n\nclass PegJsPlugin {\n\n constructor(config) {\n this.config = config.plugins.pegjs;\n this.config.output = 'source';\n }\n\n ...
javascript
chosen
[ { "from": "system", "value": "Revert \"debugging the ios directory issue\"\n\nThis reverts commit 03acb171f091c3228033a60adbacbe4a2a62e524.\n" }, { "from": "human", "value": "#!/usr/bin/env node\nconst yargs = require('yargs');\n\nyargs\n.usage('$0 command')\n.command('all', 'run all bundled com...
javascript
chosen
[ { "from": "system", "value": "Set cookie to http only\n" }, { "from": "human", "value": "require('dotenv').config();\nconst express = require('express');\nconst bodyParser = require('body-parser');\nconst cookieParser = require('cookie-parser');\nconst login = require('./login.js');\nconst getPu...
javascript
chosen
[ { "from": "system", "value": "Fix match error on file extension check\n\nWith the current code, if the file name contains any of the possible extensions with a dot before it, it will be matched and removed.\r\nAn example of this would be the emoji movie, if its file is, for example, The.Emoji.Movie.mp4, bot...
javascript
chosen
[ { "from": "system", "value": "Include solrBaseURL in 'connect-src' content security policy too.\n\nAllows normal JSON or JSON-P.\n" }, { "from": "human", "value": "/* jshint node: true */\n'use strict';\n\nvar path = require('path');\n\nmodule.exports = {\n name: 'ember-solr',\n\n config: func...
javascript
chosen
[ { "from": "system", "value": "Remove extra margin around SVG images\n" }, { "from": "human", "value": "import React, { PropTypes, PureComponent } from 'react';\nimport { View, Platform, WebView, ActivityIndicator } from 'react-native';\n\nexport default class SVGImage extends PureComponent {\n ...
javascript
chosen
[ { "from": "system", "value": "Add log to see if it's working or not\n" }, { "from": "human", "value": "#!/usr/bin/env node\n'use strict';\n\nvar\n clipboard = require('copy-paste'),\n request = require('request');\n\nvar\n FAILURE_EXIT = 1,\n SUCCESS_EXIT = 1;\n\nvar options = {\n url: 'h...
javascript
chosen
[ { "from": "system", "value": "Add assertions about the constructor parameter\n" }, { "from": "human", "value": "module.exports = EventSender;\n\nfunction EventSender(httpResponse) {\n this.httpResponse = httpResponse;\n this.httpResponse.setHeader('Content-Type', 'text/event-stream');\n}\n\nEv...
javascript
chosen
[ { "from": "system", "value": "Add user reference to topic\n" }, { "from": "human", "value": "app.service('TopicService', ['$rootScope', '$firebase', function($rootScope, $firebase) {\n var topicsRef = $firebase(fb.child('topics'));\n\n this.list = function() {\n return topicsRef;\n };\n\n ...
javascript
chosen
[ { "from": "system", "value": "Implement timeout on focus directive\n" }, { "from": "human", "value": "\"use strict\";\ndefine([], function(){\n\tvar FocusDirective = function ($parse) {\n\t\t\treturn{\n\t\t\t\tlink : function(scope, element,attrs) {\n\t\t\t\t\tscope.$watch($parse(attrs.focus), ...
javascript
chosen
[ { "from": "system", "value": "Allow all users to add tags\n" }, { "from": "human", "value": "var mongoose = require('mongoose');\nvar Schema = mongoose.Schema;\n\nvar Objectid = mongoose.Schema.Types.ObjectId;\nvar Mixed = mongoose.Schema.Types.Mixed;\n\nvar TagSchema = new Schema({\...
javascript
chosen
[ { "from": "system", "value": "Refactor to follow style guides\n" }, { "from": "human", "value": "import Ember from 'ember';\n\n/**\n * @module components\n * @class sl-pagination-per-page-select\n */\nexport default Ember.Component.extend({\n\n /**\n * Class names for the root element\n ...
javascript
chosen
[ { "from": "system", "value": "Print the port that will be listened to\n\nWhen listen fails due to address-in-use, its nice to know what address\nwas in use.\n" }, { "from": "human", "value": "var options = require('optimist').argv;\nvar express = require('express');\nvar app = express();\n\napp....
javascript
chosen
[ { "from": "system", "value": "Change test of configure() to validate if configure sets de parameters on the Leafbird config\n" }, { "from": "human", "value": "/*\n Copyright 2015 Leafbird\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file excep...
javascript
chosen
[ { "from": "system", "value": "Handle win32 drive letters when reconstituting paths\n" }, { "from": "human", "value": "const path = require('path')\n\n// Private: re-join the segments split from an absolute path to form another absolute path.\nfunction absolute (...parts) {\n const candidate = p...
javascript
chosen
[ { "from": "system", "value": "Allow caller to set custom log level\n" }, { "from": "human", "value": "var RadiodanClient = require('./lib/radiodan-client'),\n MessagingClient = require('./lib/messaging-client');\n\nmodule.exports.create = function (opts) {\n opts = opts || {};\n\n var clie...
javascript
chosen
[ { "from": "system", "value": "Reset graphite model on each request\n\nNew behavior is to try and be smart and merge the results.\nReset restores the old behavior.\n" }, { "from": "human", "value": "/*global define*/\ndefine([\n 'underscore',\n 'backbone',\n 'marionette'\n], function (_,...
javascript
chosen