conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a state manager service\n"
},
{
"from": "gpt",
"value": "/**\n * @fileoverview This files provides a service for managing application\n * states. States are written to both the URL (through the ngeoLocation\n * service) and the local storage.\n */\ngoog.provide('... | javascript | chosen |
[
{
"from": "human",
"value": "Add specific JS to run after everything else has loaded, mainly for widget layout.\n"
},
{
"from": "gpt",
"value": "// ready() functions executed after everything else.\n// Mainly for widget layout\n\n$(function() {\n $(window).resize(function(event) {\n la... | javascript | chosen |
[
{
"from": "human",
"value": "Add initial implementation to force seperation of platform specific components\n"
},
{
"from": "gpt",
"value": "/**\n * @fileoverview Android and IOS components should be\n * used in platform specific React Native components.\n * @author Tom Hastjarjanto\n */\n'use s... | javascript | chosen |
[
{
"from": "human",
"value": "Define constructor for doubly linked list\n"
},
{
"from": "gpt",
"value": "\"use strict\";\n\n// DOUBLY-LINKED LIST\n\n// define constructor\nfunction Node(val) {\n\tthis.data = val;\n\tthis.previous = null;\n\tthis.next = null;\n}\n"
}
] | javascript | chosen |
[
{
"from": "human",
"value": "Add typedConnect to let smart components in on the action\n"
},
{
"from": "gpt",
"value": "// @flow\n\nimport {Component} from 'react'\nimport {connect} from 'react-redux'\n\ntype TypedMergeProps<State, Dispatch, OwnProps, Props> = (state: State, dispatch: Dispatch, ... | javascript | chosen |
[
{
"from": "human",
"value": "Add a unique index for the rom variant.\n"
},
{
"from": "gpt",
"value": "module.exports = {\n\tup: function(migration, DataTypes, done) {\n\t\tmigration.removeIndex('Incrementals', 'Incrementals_UniqueFilePerDirectory');\n\n\t\tmigration.addIndex(\n\t\t\t'Incremental... | javascript | chosen |
[
{
"from": "system",
"value": "Remove index.css import for CRA based apps.\n"
},
{
"from": "human",
"value": "import { configure } from '@kadira/storybook';\nimport '../src/index.css';\n\nfunction loadStories() {\n require('../src/stories');\n}\n\nconfigure(loadStories, module);\n"
},
{
... | javascript | chosen |
[
{
"from": "human",
"value": "Create script for getting seed test cases\n"
},
{
"from": "gpt",
"value": "var str = \"[\";\n\nfor (var seedVal = 0; seedVal < 256; seedVal++) {\n var a = -3969392806;\n var b = -1780940711;\n var c = -1021952437;\n var d = 255990488;\n var e = -651539848;\n va... | javascript | chosen |
[
{
"from": "human",
"value": "Add solution for \"remove the minimum\"\n"
},
{
"from": "gpt",
"value": "// https://www.codewars.com/kata/remove-the-minimum\n\nconst removeSmallest = numbers => {\n const smallest = Math.min(...numbers);\n const smallestIndex = numbers.findIndex(number => number =... | javascript | chosen |
[
{
"from": "human",
"value": "Add the example to subscribe the broadcast via amqp.\n"
},
{
"from": "gpt",
"value": "var amqp = require('amqp');\n\nvar connection = amqp.createConnection({\n host: 'localhost'\n});\n\nconnection.on('ready', function () {\n connection.exchange('broadcast', { ... | javascript | chosen |
[
{
"from": "human",
"value": "Write ajax call for new facts.\n"
},
{
"from": "gpt",
"value": "$(document).ready(function(){\n\n $(\"body\").on(\"click\", \"#new-facts button\", function(event){\n event.preventDefault();\n\n $.ajax({\n url: \"/factoids\",\n type: \"get\"\n }).d... | javascript | chosen |
[
{
"from": "human",
"value": "Add custom Node.js server written with Express.\n"
},
{
"from": "gpt",
"value": "var express = require('express');\nvar app = express();\n\nvar path = __dirname + '';\nvar port = 8080;\n\napp.use(express.static(path));\napp.get('*', function(req, res) {\n res.send... | javascript | chosen |
[
{
"from": "human",
"value": "Add the example to create a zip file with multiple files by archiver.\n"
},
{
"from": "gpt",
"value": "var fs = require('fs');\nvar archiver = require('archiver');\n\nvar output = fs.createWriteStream('output.zip');\noutput.on('close', function() {\n console.log('... | javascript | chosen |
[
{
"from": "human",
"value": "Add couch view for attachments\n"
},
{
"from": "gpt",
"value": "function (doc) {\n var media = 0, attachments = {}, value;\n\n if (doc.doc_type === \"XFormInstance\") {\n if (doc.xmlns) {\n for (var key in doc._attachments) {\n ... | javascript | chosen |
[
{
"from": "human",
"value": "Add script to help finding Apple documentation\n"
},
{
"from": "gpt",
"value": "// ==UserScript==\n// @name Apple documentation class link\n// @namespace https://franklinyu.github.io/\n// @version 0.1\n// @description create link for classes in code ... | javascript | chosen |
[
{
"from": "system",
"value": "Change function defs to variable defs in block scope.\n\nFunction definitions in blocks cause chrome to throw syntax error in\nstrict mode.\n"
},
{
"from": "human",
"value": "var isES5 = (function(){\n \"use strict\";\n return this === void 0;\n})();\n\nif (is... | javascript | chosen |
[
{
"from": "human",
"value": "Create reducer that listens to SAVE_BROADCAST actions.\n"
},
{
"from": "gpt",
"value": "import {SAVE_BROADCAST} from '../actions/index';\n\nexport default function (state=[], action) {\n switch (action.type){\n case SAVE_BROADCAST:\n return state.concat([act... | javascript | chosen |
[
{
"from": "human",
"value": "Add full coverage for contentDisposition utility\n"
},
{
"from": "gpt",
"value": "var assert = require('assert');\nvar contentDisposition = require('../../lib/util/content-disposition');\n\ndescribe('contentDisposition', function() {\n it('returns attachment for n... | javascript | chosen |
[
{
"from": "system",
"value": "Support path prefixes for service workers\n"
},
{
"from": "human",
"value": "import emitter from \"./emitter\"\n\nif (`serviceWorker` in navigator) {\n navigator.serviceWorker\n .register(`sw.js`)\n .then(function(reg) {\n reg.addEventListener(`updatefou... | javascript | chosen |
[
{
"from": "human",
"value": "Add tests for cell component\n"
},
{
"from": "gpt",
"value": "import React from 'react';\n\nimport {renderIntoDocument} from 'react-addons-test-utils';\nimport {expect} from 'chai';\n\nimport Cell from '../../../../src/notebook/components/cell/cell';\nimport * as com... | javascript | chosen |
[
{
"from": "human",
"value": "Fix jasmine has no output\n"
},
{
"from": "gpt",
"value": "var util = require('util');\nvar options = {\n showColors: true,\n print: function () {\n process.stdout.write(util.format.apply(this, arguments));\n }\n};\n\njasmine.getEnv().addReporter(new jasmine.Co... | javascript | chosen |
[
{
"from": "human",
"value": "Add a basic error reporting module.\n"
},
{
"from": "gpt",
"value": "/**\n * Meters the number of page errors, and provides traces after notices.\n */\n\nexports.version = '0.1';\n\nexports.module = function(phantomas) {\n\tvar errors = [];\n\n\tphantomas.on('pageerr... | javascript | chosen |
[
{
"from": "system",
"value": "Fix hofer life music Controller name\n"
},
{
"from": "human",
"value": ";(function() {\n \"use strict\";\n\n var BaseController = require(\"BaseController\");\n\n new BaseController({\n siteName: \"LifeStoreFlat\",\n play: \".player-play-button .icon-play-b... | javascript | chosen |
[
{
"from": "human",
"value": "fix(LookupTableProxy): Add proxy to manage LoookupTable with preset\n"
},
{
"from": "gpt",
"value": "import macro from 'vtk.js/Sources/macro';\n\nimport vtkColorMaps from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction/ColorMaps';\nimport vtkColorTransferFunctio... | javascript | chosen |
[
{
"from": "human",
"value": "Add stream handler for saving new tweets and emitting data to the client\n"
},
{
"from": "gpt",
"value": "var Tweet = require('../models/Tweet');\n\nvar StreamHandler = function(stream, io) {\n // Whenever the stream handler passes new tweets...\n stream.on('data',... | javascript | chosen |
[
{
"from": "human",
"value": "test: Add test to verify npm-registry-mock version\n\nI keep getting myself into weird cases where I have an outdated copy of\nnpm-registry-mock, and so tests fail, and I spend several minutes digging\nonly to find that it's because I didn't update after the package.json dep\nch... | javascript | chosen |
[
{
"from": "human",
"value": "Add mp3 file streaming example"
},
{
"from": "gpt",
"value": "var express = require('express');\nvar app = express();\nvar fs = require('fs');\n\napp.listen(3000, function() {\n console.log(\"[NodeJS] Application Listening on Port 3000\");\n})... | javascript | chosen |
[
{
"from": "human",
"value": "Add karma file for browser tests\n"
},
{
"from": "gpt",
"value": "module.exports = function(config) {\n config.set({\n // base path, that will be used to resolve files and exclude\n basePath : '',\n\n // frameworks to use\n framework... | javascript | chosen |
[
{
"from": "human",
"value": "Test for manually delivering events\n"
},
{
"from": "gpt",
"value": "const expect = require('expect');\nconst createProbot = require('..');\n\ndescribe('Probot', () => {\n let probot;\n let event;\n\n beforeEach(() => {\n probot = createProbot();\n probot.ro... | javascript | chosen |
[
{
"from": "human",
"value": "Fix Arena Trap on Inverse Battle\nArena Trap still does not trap Flying-types on Inverse Battle.\n"
},
{
"from": "gpt",
"value": "exports.BattleAbilities = {\n\tarenatrap: {\n\t\tinherit: true,\n\t\tonFoeModifyPokemon: function(pokemon) {\n\t\t\tif (!pokemon.hasType(... | javascript | chosen |
[
{
"from": "human",
"value": "Test runner for `api-compiler` tests\n"
},
{
"from": "gpt",
"value": "'use strict';\nrequire('./patch-module');\nrequire('marko/node-require').install();\n\nvar chai = require('chai');\nchai.config.includeStack = true;\n\nvar expect = require('chai').expect;\nvar nod... | javascript | chosen |
[
{
"from": "human",
"value": "Add partial solution to sequence-interface exercise\n\nSpecify Sequence interface - define constructor, instance properties, and prototype\nmethods. Also implement ArraySeq constructor that uses the Sequence\ninterface.\n"
},
{
"from": "gpt",
"value": "// Design an ... | javascript | chosen |
[
{
"from": "human",
"value": "Create view file for popup.\n"
},
{
"from": "gpt",
"value": "PinPoint.View = function(){\n //Steven's storeListDOMRoot is equivalent to our noteList\n this.noteListDOMRoot = document.getElementsByTagName('table');\n\n}\n\n//the 'notes' argument will be an array of ... | javascript | chosen |
[
{
"from": "human",
"value": "Add admin backend js helper\n\ngit-svn-id: c69874b65fc60996824a336b7ccbc1d3cf663ce3@12655 ee427ae8-e902-0410-961c-c3ed070cd9f9\n"
},
{
"from": "gpt",
"value": "/*\n * $Id$\n *\n * (c) 2008 Thomas Rabaix <thomas.rabaix@soleoweb.com>\n * \n * THIS SOFTWARE IS PROVIDED... | javascript | chosen |
[
{
"from": "human",
"value": "Create a place for function helpers\n\nAdd first function, capitalizeFirstLetter\n"
},
{
"from": "gpt",
"value": "module.exports = {\n\n capitalizeFirstLetter: function (str) {\n if (str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n ret... | javascript | chosen |
[
{
"from": "human",
"value": "Add tests for GET /lambdas/:organizationName/:lambdaName\n"
},
{
"from": "gpt",
"value": "import express from \"express\";\nimport request from \"supertest-as-promised\";\nimport {sign} from \"jsonwebtoken\";\n\nimport api from \"api\";\nimport * as config from \"con... | javascript | chosen |
[
{
"from": "human",
"value": "Add localeResource model and update\n"
},
{
"from": "gpt",
"value": "var fs = require('fs');\n\nvar namespaces = [\n\t\t'app','home','form','services',\n\t\t'footer','portfolio','terms',\n\t\t'contact'\n\t],\n\tlngs = ['fr', 'en'],\n\tresources = [];\n\n\nfunction lo... | javascript | chosen |
[
{
"from": "system",
"value": "Remove unique constraint for ListSubscribers table\n"
},
{
"from": "human",
"value": "'use strict';\nmodule.exports = function(sequelize, DataTypes) {\n var listsubscriber = sequelize.define('listsubscriber', {\n email: DataTypes.STRING,\n subscribed: { type:... | javascript | chosen |
[
{
"from": "human",
"value": "feat: Add config panel demo with everyone's favorite, clickable-square\n"
},
{
"from": "gpt",
"value": "FamousFramework.component('famous-demos:config-panel', {\n\n tree: `\n <famous:ui:config-panel:controller id=\"controller\">\n <famous-demos:c... | javascript | chosen |
[
{
"from": "human",
"value": "Add settings for UIU-193 CRUD Fee/Fine Owners\n"
},
{
"from": "gpt",
"value": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport ControlledVocab from '@folio/stripes-smart-components/lib/ControlledVocab';\n\nclass OwnerSettings extends React.Com... | javascript | chosen |
[
{
"from": "human",
"value": "Remove \"level\" fields from pools table in database.\n"
},
{
"from": "gpt",
"value": "export async function up(r) {\n return r.table('pools').replace(r.row.without('levels'))\n}\n\nexport async function down() {\n // irreversible; cannot recover data\n}\n"
}
] | javascript | chosen |
[
{
"from": "human",
"value": "Add database connection script with mysql option\n"
},
{
"from": "gpt",
"value": "var mysqlConnection = function(credentials) {\n var mysql = require('mysql');\n\n this.connection = mysql.createConnection(credentials);\n return this;\n}\nmysqlConnection.prototype.... | javascript | chosen |
[
{
"from": "human",
"value": "Add unit test for editController.js\n"
},
{
"from": "gpt",
"value": "describe('editController', function(){\n var scope; // use this scope in our tests\n\n // mock Application to allow us to inject our own dependencies\n beforeEach(angular.mock.module('zoomableApp... | javascript | chosen |
[
{
"from": "human",
"value": "Add common filters file. filter created to filter by first char\n"
},
{
"from": "gpt",
"value": "define(['app','lodash', ], function (app,_) { 'use strict';\n\n //##################################################################\n app.filter('filterByLetter'... | javascript | chosen |
[
{
"from": "human",
"value": "Add a top-level Sentient module…\n\nThis will probably be re-written to use dedicated\ncompiler / runtime so that they can be packaged\nseparately, but this will do for now."
},
{
"from": "gpt",
"value": "\"use strict\";\n\nvar Level2Compiler = require(\"./sentient/c... | javascript | chosen |
[
{
"from": "human",
"value": "Create a separate Flows collection\n"
},
{
"from": "gpt",
"value": "import { Mongo } from 'meteor/mongo';\nimport SimpleSchema from 'simpl-schema';\nimport { FlowSchema } from './projects';\n\nFlows = new Mongo.Collection('flows');\n\n\nif (Meteor.isServer) {\n Fl... | javascript | chosen |
[
{
"from": "human",
"value": "Add unit tests for adjustResourceQuantity\n"
},
{
"from": "gpt",
"value": "const adjustResourceQuantity = require('../../../../server/util/adjust-resource-quantity');\n\nadjustResourceQuantity.setResources([\n {name: 'cat', plural_form: 'cats'},\n {name: 'person', ... | javascript | chosen |
[
{
"from": "human",
"value": "Build and serve via Grunt.\n"
},
{
"from": "gpt",
"value": "module.exports = function(grunt) {\n\n grunt.initConfig({\n less: {\n production: {\n options: {\n paths: [ \"bower_components/bootstrap/less\" ],\n cleancss: true\n ... | javascript | chosen |
[
{
"from": "human",
"value": "Add nesteMenu directive in relation\n"
},
{
"from": "gpt",
"value": "\"use strict\";\n\nangular.module('arethusa.relation').directive('nestedMenu', [\n '$compile',\n function($compile) {\n return {\n restrict: 'A',\n scope: {\n relation: '=',\n ... | javascript | chosen |
[
{
"from": "human",
"value": "Add script to add URL to queue\n"
},
{
"from": "gpt",
"value": "const AWS = require('aws-sdk');\nconst async = require('async');\nconst argv = require('minimist')(process.argv.slice(2));\nconst config = require('./config');\nconst helpers = require('./helpers');\n\nA... | javascript | chosen |
[
{
"from": "system",
"value": "Print combined logs in production\n"
},
{
"from": "human",
"value": "\"use strict\";\n\nvar express = require('express');\nvar path = require('path');\nvar logger = require('morgan');\nvar cookieParser = require('cookie-parser');\nvar bodyParser ... | javascript | chosen |
[
{
"from": "human",
"value": "Create unit test to task controller (getAll)\n"
},
{
"from": "gpt",
"value": "const TaskController = require('../../../controllers/tasks');\n\ndescribe('Controllers: Tasks', () => {\n\n describe('Get all tasks from a tasklist: getAll()', () => {\n it('should retu... | javascript | chosen |
[
{
"from": "human",
"value": "Test to check JSX does not pass comments as children.\n"
},
{
"from": "gpt",
"value": "import { Component, Render, RasterManager, View, Text } from '../index';\nconst assert = require('assert');\n\ndescribe('JSX', function() {\n describe('Comments', function() {\n ... | javascript | chosen |
[
{
"from": "human",
"value": "Test query string is built correctly\n"
},
{
"from": "gpt",
"value": "import test from 'ava'\nimport nock from 'nock'\nimport data from './fixtures/data'\nimport Onionoo from '../'\n\ntest('Query string is built correctly', async t => {\n const onionoo = new Onionoo... | javascript | chosen |
[
{
"from": "human",
"value": "Add tests for basic auth header parser\n"
},
{
"from": "gpt",
"value": "\"use strict\";\n\nvar Server = require(\"../server\");\n\nexports.testMissingBasicHeader = function (test) {\n\tvar parser = Server.prototype._basicAuthentication({\n\t\t\"headers\": {}\n\t});\n... | javascript | chosen |
[
{
"from": "human",
"value": "Add simple tests to detect redirect behavior\n"
},
{
"from": "gpt",
"value": "const koa = require('koa'),\n expect = require('expect'),\n uncapitalize = require('../'),\n app = koa();\n\napp.use(uncapitalize);\napp.use(function *(next) {\n if (this.pa... | javascript | chosen |
[
{
"from": "human",
"value": "Add a jjs runnable JavaScript test script to ease testing whether native\nlibrary is loaded on a specific platform.\n\nSigned-off-by: Haochen Xie <6cdef7921402f78bb75e2821c6818c66fb01ab31@xie.name>\n"
},
{
"from": "gpt",
"value": "/**\n * Example command for running ... | javascript | chosen |
[
{
"from": "human",
"value": "Add an image remix for Cameron Kaiser’s (@doctorlinguist) image posts.\n"
},
{
"from": "gpt",
"value": "'use strict';\n\n// Generate image link\nvar SERVICE_FLOODGAP = /(((www.floodgap\\.com))\\/\\w\\/\\w+)/i;\n\nexports.process = function(media, remix) {\n if (!rem... | javascript | chosen |
[
{
"from": "human",
"value": "Add solution to question 155\n"
},
{
"from": "gpt",
"value": "/**\n * @constructor\n */\nvar MinStack = function() {\n this.stack = [];\n this.minStack = [];\n};\n\n/**\n * @param {number} x\n * @returns {void}\n */\nMinStack.prototype.push = function(x) {\n ... | javascript | chosen |
[
{
"from": "human",
"value": "Add Node.js test asserting on the number of sourcemap comments in final assets\n"
},
{
"from": "gpt",
"value": "var fs = require('fs');\n\nQUnit.module('sourcemap validation', function() {\n var assets = ['ember.debug', 'ember.prod', 'ember.min'];\n\n assets.forEac... | javascript | chosen |
[
{
"from": "system",
"value": "[api] Set param theme precedence over hook theme module scope ( for now ) "
},
{
"from": "human",
"value": "var config = require('../../../config');\n\nvar fs = require(\"fs\");\n\nmodule['exports'] = function attemptToRequireUntrustedHook (opts, callback) {\n\n va... | javascript | chosen |
[
{
"from": "human",
"value": "Add helper method to replay events\n"
},
{
"from": "gpt",
"value": "export function replayEvents(events, currentTime) {\n const head = events[0];\n const tail = events.slice(1);\n\n // Exit condition, no events\n if (head === undefined) return;\n\n if (head.time... | javascript | chosen |
[
{
"from": "human",
"value": "Add better seeded random function\n\nInstead of using\n`Math.seedrandom(seed)` which affects the global Math object, use\n\n`var rand = Random(seed)` which returns a unique random object for you\nto use. This does not affect the global random method or other instances\nof random... | javascript | chosen |
[
{
"from": "human",
"value": "Add ip column for actions table\n"
},
{
"from": "gpt",
"value": "\nexports.up = function(knex, Promise) {\n return knex.schema.table('actions', function(table) {\n table.string('ip', 15);\n });\n};\n\nexports.down = function(knex, Promise) {\n return knex.schem... | javascript | chosen |
[
{
"from": "human",
"value": "Add lib js for signature"
},
{
"from": "gpt",
"value": "// FIXME: origin unknown\nif (!window.atob) {\n var tableStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var table = tableStr.split(\"\");\n\n window.atob = function (base64) {\n... | javascript | chosen |
[
{
"from": "human",
"value": "Add problem 9 solution :tada:\n"
},
{
"from": "gpt",
"value": "/*\n A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,\n\n a^2 + b^2 = c^2\n For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.\n\n There exists exactly one Pythagorean triplet for w... | javascript | chosen |
[
{
"from": "human",
"value": "ADD Initial version of mailchimp api connection\n\n"
},
{
"from": "gpt",
"value": "// @flow\nimport R from 'ramda';\nimport axios from 'axios';\nimport env from '../../env';\nimport { baseUrl, reportUrl } from './generateUrl';\n\nconst MC_KEY = env('MC_KEY');\nconst ... | javascript | chosen |
[
{
"from": "human",
"value": "Add the example to use moment to manipulate time by add.\n"
},
{
"from": "gpt",
"value": "var moment = require('moment');\n\nconsole.log(moment(\"2014-12-11 4:30\", \"YYYY-MM-DD HH:mm\")); \nconsole.log(moment(\"2014-12-11 4:30 +0800\", \"YYYY-MM-DD HH:mm Z\")... | javascript | chosen |
[
{
"from": "human",
"value": "Add a simple script to validate that a component can be server-side rendered.\n\nThis is intended for use with webapp's\nreact_util/server_side_render_test.py.\n\nAuditors: jlfwong\n\nTest Plan:\nIn webapp, ran\n tools/runtests.py --max-size=large react_util/server_side_render... | javascript | chosen |
[
{
"from": "human",
"value": "Add js for mobile nav\n"
},
{
"from": "gpt",
"value": "function toggleNav() {\n nav = document.getElementsByClassName('js-side-nav');\n navItems = document.getElementsByClassName('js-side-nav-item');\n activeLink = document.getElementsByClassName('js-side-nav-link... | javascript | chosen |
[
{
"from": "human",
"value": "Add a webpack settings file.\n"
},
{
"from": "gpt",
"value": "module.exports = {\n entry: './temp/react-components/app-main.js',\n output: {\n path: './build/js',\n filename: 'react-app.js',\n },\n resolve: {\n extensions: ['', '.js']... | javascript | chosen |
[
{
"from": "system",
"value": "Add helper function for downloading files\n"
},
{
"from": "human",
"value": "/*!\n Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>\n Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n Created By: ivan... | javascript | chosen |
[
{
"from": "human",
"value": "Create a task to install all dependencies\n\nIncluding NPM and Bower\n"
},
{
"from": "gpt",
"value": "(function() {\n\n 'use strict';\n\n var yeoman = require('yeoman-generator'),\n chalk = require('chalk');\n\n module.exports = yeoman.generators.Base... | javascript | chosen |
[
{
"from": "human",
"value": "Add a new controller for memory management.\n"
},
{
"from": "gpt",
"value": "(function () {\n angular\n .module('app')\n .controller('MemoryController', [\n MemoryController\n ]);\n\n function MemoryController() {\n var vm... | javascript | chosen |
[
{
"from": "human",
"value": "Test cases for clickover and autoclosing popovers\n"
},
{
"from": "gpt",
"value": "/*jshint multistr: true */\n\n'use strict'\n\nvar $ = require('jquery');\n\nrequire('../../../js/libs/popover');\n\n$.fx.off = !$.fx.off;\n\ndescribe('Test extra functionality added to... | javascript | chosen |
[
{
"from": "human",
"value": "Add test skeleton for updateGitignore\n"
},
{
"from": "gpt",
"value": "// import { expect } from 'chai'\n// import updateGitignore from './update-gitignore'\n\ndescribe('updateGitignore', () => {\n describe('given the file does not exist', () => {\n it('should cr... | javascript | chosen |
[
{
"from": "human",
"value": "Add unit tests for translation\n"
},
{
"from": "gpt",
"value": "const React = require('react');\nconst expect = require('expect');\nimport * as languageHandler from '../../src/languageHandler';\n\nconst testUtils = require('../test-utils');\n\ndescribe('languageHandl... | javascript | chosen |
[
{
"from": "human",
"value": "Add integration test for `checkIsRepo`\n"
},
{
"from": "gpt",
"value": "'use strict';\n\nconst FS = require('fs');\nconst Test = require('./include/runner');\n\nconst setUp = (context) => {\n\n context.realRoot = context.dir('real-root');\n context.realSubRoot = ... | javascript | chosen |
[
{
"from": "human",
"value": "Add a script to do OAuth authorization\n\nCloses #124.\n"
},
{
"from": "gpt",
"value": "// authorize.js\n//\n// Get OAuth token\n//\n// Copyright 2011-2012, StatusNet Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use t... | javascript | chosen |
[
{
"from": "human",
"value": "Add sidebar navigation acceptance tests\n"
},
{
"from": "gpt",
"value": "import { test } from 'qunit';\n\nimport moduleForAcceptance from 'ember-api-docs/tests/helpers/module-for-acceptance';\n\nmoduleForAcceptance('Acceptance | sidebar navigation');\n\ntest('can nav... | javascript | chosen |
[
{
"from": "human",
"value": "Add module for sending RF remote notifications\n"
},
{
"from": "gpt",
"value": "'use strict';\n\nmodule.exports = function(config, ircbot) {\n\tlet skipMessages = [];\n\n\tircbot.on('mqttMessage', function (topic, payload) {\n\t\tif (topic !== config.topic) {\n\t\t\t... | javascript | chosen |
[
{
"from": "human",
"value": "Break out channel select functionality\n"
},
{
"from": "gpt",
"value": "import React from 'react'\n\nimport Subheader\n from 'material-ui/lib/Subheader/Subheader'\nimport RadioButton\n from 'material-ui/lib/radio-button'\nimport RadioButtonGroup\n from 'material-u... | javascript | chosen |
[
{
"from": "human",
"value": "Create utility methods for testing\n"
},
{
"from": "gpt",
"value": "const mongo = require('mongodb')\nconst http = require('http')\n\n/** (mongo.db -> Promise) -> () */\nexports.mongo = function (action) {\n mongo.MongoClient\n .connect(\"mongodb://localho... | javascript | chosen |
[
{
"from": "human",
"value": "Add the example to add the audio in the video file via ffmpeg.\n"
},
{
"from": "gpt",
"value": "var ffmpeg = require('fluent-ffmpeg');\n\nvar dirpath = 'video/'; \nvar tmppath = 'tmp/'; \nvar audio = 'testaudio-one.wav';\nvar videoname = 'output.avi'; \nvar Command... | javascript | chosen |
[
{
"from": "human",
"value": "Add a util function for throttling\n"
},
{
"from": "gpt",
"value": "/**\n * Throttle a function call.\n *\n * @description\n * Function calls are delayed by `wait` milliseconds but at least every `wait`\n * milliseconds a call is triggered.\n *\n * @param {functiom} ... | javascript | chosen |
[
{
"from": "human",
"value": "chore: Add index script for better performances\n"
},
{
"from": "gpt",
"value": "db.apis.createIndex( { \"visibility\" : 1 } );\ndb.apis.createIndex( { \"group\" : 1 } );\ndb.applications.createIndex( { \"group\" : 1 } );\ndb.events.createIndex( { \"type\" : 1 } );\n... | javascript | chosen |
[
{
"from": "human",
"value": "Create new feature, add array prototypes\n\nCreate new feature, add array prototypes"
},
{
"from": "gpt",
"value": "Array.prototype.remove = function(from, to) {\n var rest = this.slice((to || from) + 1 || this.length);\n this.length = from < 0 ? this.length + ... | javascript | chosen |
[
{
"from": "human",
"value": "Add a golden ratio approximation using fibonacci numbers and es6 generators\n"
},
{
"from": "gpt",
"value": "// es6 generators example\n// \"The Goden Ration\" (phi) approximation using fibonacci numbers\n\nconst MAX_APPROX = 100;\n\nfunction* fib(x, y) {\n for (let... | javascript | chosen |
[
{
"from": "human",
"value": "Add Test for Bot model\n"
},
{
"from": "gpt",
"value": "var chai = require('chai');\nvar expect = chai.expect; // we are using the \"expect\" style of Chai\nvar Bot = require('./../../models/bot');\n\ndescribe('Bot', function() {\n it('Bot() create new bot object wi... | javascript | chosen |
[
{
"from": "human",
"value": "Test suite for ConnectionPools that use hostPoolSize option.\n\nRe-runs the existing thrift.js test suite, but sets the\nhostPoolSize option before starting.\n"
},
{
"from": "gpt",
"value": "/**\n * Runs tests defined in thrift.js, but with ConnectionPool \n * option... | javascript | chosen |
[
{
"from": "system",
"value": "Fix current track selectors for Yandex"
},
{
"from": "human",
"value": ";(function() {\n \"use strict\";\n\n require(\"BaseController\").init({\n siteName: \"Yandex\",\n playPause: \".player-controls__btn_play\",\n playNext: \".player-controls__btn_next\"... | javascript | chosen |
[
{
"from": "system",
"value": "Make a JSON representation of the page's object available to the JS\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 th... | javascript | chosen |
[
{
"from": "human",
"value": "Add skeleton file for test\n"
},
{
"from": "gpt",
"value": "const assert = require('assert')\r\nconst CNJokes = require('./index.js')\r\n\r\ndescribe('get chucknorris joke', function() {\r\n it('should return random joke', function() {\r\n\r\n });\r\n\r\n it('shou... | javascript | chosen |
[
{
"from": "human",
"value": "Add tests for Home Page\n"
},
{
"from": "gpt",
"value": "/**\n * Copyright (C) 2019 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later versi... | javascript | chosen |
[
{
"from": "human",
"value": "Add a simple example demonstrating ticks and calls.\n"
},
{
"from": "gpt",
"value": "\"use strict\";\n\nvar Q = require(\"../q\");\n\nfunction log() {\n console.log.apply(console, arguments);\n}\n\nQ(\"----------- tick 1 -----------\").done(log); // next tick\nQ()... | javascript | chosen |
[
{
"from": "system",
"value": "Fix the dependencies of set os unit tests\n"
},
{
"from": "human",
"value": "'use strict';\n\nmodule.exports = {\n\tassets: {\n\t\tlib: {\n\t\t\tcss: [\n\t\t\t\t'lib/bootstrap/dist/css/bootstrap.css',\n\t\t\t\t'lib/bootstrap/dist/css/bootstrap-theme.css',\n\t\t\t\t'... | javascript | chosen |
[
{
"from": "human",
"value": "Add fullscreen class to scenes.\n\nAffects #4 but won't work until A-Frame v0.2.0\n"
},
{
"from": "gpt",
"value": "(function () {\n\n /**\n * Monkey patch to apply a 'fullscreen' class to A-Frame scenes in fullscreen\n * mode. Allows overlay content to be hidden... | javascript | chosen |
[
{
"from": "human",
"value": "Add placeholder for clone unit tests\n"
},
{
"from": "gpt",
"value": "'use strict';\n\n// const tmp = require('tmp');\n// // Mine\n// const core = require('../lib/core');\n// const fsX = require('../lib/fsExtra');\n// const util = require('../lib/util');\n// //\n// c... | javascript | chosen |
[
{
"from": "human",
"value": "Test multiple notifications failure case\n"
},
{
"from": "gpt",
"value": "var mercurius = require('../index.js');\nvar request = require('supertest');\nvar assert = require('assert');\nvar nock = require('nock');\n\ndescribe('mercurius', function() {\n var token;\n\... | javascript | chosen |
[
{
"from": "human",
"value": "Add Toggl - Weekly report: calculation and display the work day percentages\n\nSigned-off-by: Fabien Crassat <777bcfcf9efee56bedca63c5eb2304e67df52892@crassat.com>\n"
},
{
"from": "gpt",
"value": "// ==UserScript==\n// @name Toggl - Weekly report\n// @namespa... | javascript | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.