conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Hide images in article content too.\n" }, { "from": "human", "value": "var articleParent = document.querySelector('#storyContent');\nvar articleParas = document.querySelectorAll('#storyContent p');\n\nfor(var x = 0; x < articleParas.length; x += 1){\n\tarticleParas[...
javascript
chosen
[ { "from": "system", "value": "Add speech service unit tests\n" }, { "from": "human", "value": "describe('speechService', () => {\n let speechService;\n\n beforeEach(angular.mock.module('app'));\n beforeEach(inject((_speechService_) => {\n speechService = _speechService_;\n }));\n\n it('e...
javascript
chosen
[ { "from": "system", "value": "Reduce rewind speed to zero to remove animation\n" }, { "from": "human", "value": "/*\n * Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\");\...
javascript
chosen
[ { "from": "system", "value": "Fix non-compressed output on Sass files in build\n\nThis closes #101.\n" }, { "from": "human", "value": "/**\n * Sass\n */\n'use strict';\n\nvar config = require('../config');\n\n/*\n * Helper\n */\nvar helper = {};\n\nhelper.sassDev = {};\nhelper.sassDev[config.sas...
javascript
chosen
[ { "from": "system", "value": "Make sure afterTransitionLoading is set correctly\n" }, { "from": "human", "value": "import React, { Component, PropTypes } from 'react';\nimport getRoutePath from './util/getRoutePath';\n\nexport default class RedialContainer extends Component {\n static displayNa...
javascript
chosen
[ { "from": "system", "value": "Fix JSON input and JSON response.\n" }, { "from": "human", "value": "\"use strict\";\n\nvar request = require(\"request\");\n\nfunction rCall(command, args, callback, options) {\n var opts = options || {},\n url;\n\n opts.server = opts.server || \"https...
javascript
chosen
[ { "from": "system", "value": "Adjust merge function per @developit's suggestion\n" }, { "from": "human", "value": "const deepMerge = (base, override) => {\n if (override === undefined) {\n return base || {};\n }\n\n let mergedObj = Object.assign({}, base);\n\n Object.keys(override).forEac...
javascript
chosen
[ { "from": "system", "value": "Use a function to chain sendCommands method\n" }, { "from": "human", "value": "var Q = require('q'),\n mpd = require('mpd'),\n EventEmitter = require('events').EventEmitter,\n winston = require('winston');\n\nexports.create = function (port, logge...
javascript
chosen
[ { "from": "system", "value": "Use lstat instead of stat to ignore symlinks\n" }, { "from": "human", "value": "const fs = require('fs')\nconst util = require('util')\n\nconst parseDirectory = require('./parsers/directory')\nconst parseName = require('./parsers/name')\nconst parseType = require('....
javascript
chosen
[ { "from": "system", "value": "Append the username when using the temporary folder.\n" }, { "from": "human", "value": "var os = require('os');\nvar path = require('path');\nvar osenv = require('osenv');\n\n// Assume XDG defaults\n// See: http://standards.freedesktop.org/basedir-spec/basedir-spec-...
javascript
chosen
[ { "from": "system", "value": "Fix counts for search timeline updates\n" }, { "from": "human", "value": "YUI.add(\"model-timeline-base\", function(Y) {\n \"use strict\";\n \n var models = Y.namespace(\"Falco.Models\"),\n \n TimelineBase;\n \n TimelineBase = Y.Base...
javascript
chosen
[ { "from": "system", "value": "Use double quotes in script\n" }, { "from": "human", "value": "'use strict';\n\n(function () {\n\n var React = require('react');\n\n var analyticsScript = '(function(i,s,o,g,r,a,m){i[\\'GoogleAnalyticsObject\\']=r;i[r]=i[r]||function(){' +\n '(i[r].q=i[r].q||[]...
javascript
chosen
[ { "from": "system", "value": "Change the executable check—hopefully work w/linux" }, { "from": "human", "value": "var fs = require('fs')\n\nvar OTHERS = parseInt('0001', 8)\nvar GROUP = parseInt('0010', 8)\nvar USER = parseInt('0100', 8)\n\nmodule.exports = function (path, cb) {\n fs.stat(path,...
javascript
chosen
[ { "from": "system", "value": "Fix single player import logic\n\nPassing through the player directly meant `key` couldn’t be used for the clever config merging\nFixes https://github.com/CookPete/react-player/issues/993\n" }, { "from": "human", "value": "const { join } = require('path')\nconst { w...
javascript
chosen
[ { "from": "system", "value": "Add allow rule and a createCommentNotification\n" }, { "from": "human", "value": "Notifications = new Mongo.Collection('notifications');\n" }, { "from": "gpt", "value": "Notifications = new Mongo.Collection('notifications');\n\nNotifications.allow({\n u...
javascript
chosen
[ { "from": "system", "value": "Remove if statement before return\n" }, { "from": "human", "value": "import React from 'react';\n// import CurrentTemp from '../CurrentTemp.js';\n\nconst CurrentWeather = ({ weather }) => {\n let today;\n let hourly;\n\n if (weather.length) {\n today = weather...
javascript
chosen
[ { "from": "system", "value": "Return original text if it contains no native function declarations.\n" }, { "from": "human", "value": "const Applause = require('applause');\n\nmodule.exports = {\n // Here, you can strip out any non-JS content\n // and split into multiple strings to lint.\n pre...
javascript
chosen
[ { "from": "system", "value": "Simplify sbFormatBytes by using template over jQuery\n" }, { "from": "human", "value": "'use strict';\n\n/* Directives */\n\nangular.module('swiftBrowser.directives', []).\n directive('sbVersion', ['version', function(version) {\n return function(scope, el...
javascript
chosen
[ { "from": "system", "value": "Fix typo. errorHanlder -> errorHandler\n" }, { "from": "human", "value": "import errorHanlder from 'errorhandler';\nimport accepts from 'accepts';\n\nexport default function prodErrorHandler() {\n if (process.env.NODE_ENV === 'development') {\n return errorHanld...
javascript
chosen
[ { "from": "system", "value": "Add an info button to Course\n" }, { "from": "human", "value": "'use strict';\n\nimport * as _ from 'lodash'\nimport * as React from 'react'\nimport * as humanize from 'humanize-plus'\n\nimport DraggableMixin from '../mixins/draggable'\n\nvar Course = React.createCl...
javascript
chosen
[ { "from": "system", "value": "Add arrow keys to list that don't have keypress events\n" }, { "from": "human", "value": "const KeysWithoutPressEventDictionary = {\n Shift: true,\n Control: true,\n Alt: true,\n Meta: true,\n Enter: true,\n Tab: true,\n BackSpace: true,\n /**\n * Caps loc...
javascript
chosen
[ { "from": "system", "value": "Fix Mithril v2 bug with m.route.prefix no longer being a function\n" }, { "from": "human", "value": "import m from 'mithril';\nimport FastClick from 'fastclick';\nimport AppComponent from './components/app.js';\n\n// Eliminate the #! for all routes\nm.route.prefix('...
javascript
chosen
[ { "from": "system", "value": "Replace with tested wait-for-socket implementation\n" }, { "from": "human", "value": "var Q = require('q'),\n spawn = require('child_process').spawn,\n fs = require('fs'),\n net = require('net'),\n logger = require('winston'),\n mpdConfig...
javascript
chosen
[ { "from": "system", "value": "Make tracking ID a config option for Heroku deploys\n" }, { "from": "human", "value": "var express = require('express');\nvar app = express();\n\nvar forceSsl = function (req, res, next) {\n if (req.headers['x-forwarded-proto'] !== 'https') {\n res.header(\"Stri...
javascript
chosen
[ { "from": "system", "value": "Add basic hide functionality to banner\n" }, { "from": "human", "value": "import React from 'react';\nimport styles from './Banner.scss';\n\nconst Banner = () => (\n <div className={styles.Banner}>\n <span>\n This game has a play testing session available.\...
javascript
chosen
[ { "from": "system", "value": "Make sure test run exits no matter what\n" }, { "from": "human", "value": "\n'use strict';\n\nlet co = require('co'),\n redisModule = require('../../../server/lib/redis'),\n redis = redisModule.createClient();\n\nmodule.exports = {\n local: {\n dontR...
javascript
chosen
[ { "from": "system", "value": "bugfix: Fix capitalization in Materialize bower dependency\n" }, { "from": "human", "value": "/*jshint node:true*/\n/* global require, module */\nvar EmberAddon = require('ember-cli/lib/broccoli/ember-addon');\n\nmodule.exports = function(defaults) {\n var app = ne...
javascript
chosen
[ { "from": "system", "value": "Add extend and from to Id spec\n" }, { "from": "human", "value": "function Id(a) {\n this.value = a;\n}\n\n// Semigroup (value must also be a Semigroup)\nId.prototype.concat = function(b) {\n return new Id(this.value.concat(b.value));\n};\n\n// Monoid (value m...
javascript
chosen
[ { "from": "system", "value": "Add babel-register under -b flag for ES6 tasks\n" }, { "from": "human", "value": "#!/usr/bin/env node\nimport osia from '.';\nimport minimist from 'minimist';\nimport list from 'cli-list';\nimport routine from 'promise-routine';\nimport { join } from 'path';\n\ncons...
javascript
chosen
[ { "from": "system", "value": "Add parameter to get single post/user/tag\n" }, { "from": "human", "value": "import React from 'react';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { actions } from 'redux-ghost';\n\nimport JsonTree from 'react-json-t...
javascript
chosen
[ { "from": "system", "value": "Fix example so it lints\n" }, { "from": "human", "value": "'use strict';\n\n/*\n Example of using raml2md as a script.\n */\n\nvar raml2md = require('..');\n\n// raml2md.render() needs a config object with at least a `template` property (a url to a Nunjucks template...
javascript
chosen
[ { "from": "system", "value": "Add getURL() method that returns a Promise" }, { "from": "human", "value": "define([], function() {\n\n 'use strict';\n \n function ByteSource() {\n }\n \n function ByteSourceFromBlob(blob) {\n this.blob = blob;\n }\n (function(proto) {\n proto.slice =...
javascript
chosen
[ { "from": "system", "value": "Move format estimation function to format mixin\n" }, { "from": "human", "value": "import { mapGetters } from 'vuex'\n\nexport const formatListMixin = {\n\n created () {\n },\n\n mounted () {\n },\n\n beforeDestroy () {\n },\n\n computed: {\n ...mapGetters...
javascript
chosen
[ { "from": "system", "value": "Add timer, only calculate values once for each depth level, and remove delayed 'growth' of tree\n" }, { "from": "human", "value": "function drawBlock(parent, width, depth) {\n var newWidth = Math.sqrt(2 * Math.pow(width / 2, 2));\n var color = 'rgba(' + [0, Ma...
javascript
chosen
[ { "from": "system", "value": "Fix bug when env.queries is a function\n" }, { "from": "human", "value": "/**\n * Resolves queries from a map to arrays of maps to field values.\n *\n * @param queries A map to arrays of maps to field values.\n * @param name Query name.\n * @param rank Query result ...
javascript
chosen
[ { "from": "system", "value": "Test for links in nav bar component\n" }, { "from": "human", "value": "import {\n moduleForComponent,\n test\n} from 'ember-qunit';\n\nmoduleForComponent('nav-bar', {});\n\ntest('it renders', function(assert) {\n assert.expect(2);\n\n // creates the component in...
javascript
chosen
[ { "from": "system", "value": "Use Array.from instead of Array.prototype\n" }, { "from": "human", "value": "chrome.storage.local.get(['pattern', 'case_insensitive', 'color', 'opacity'], function(items) {\n var pattern, case_insensitive, color, opacity;\n var re, flags;\n\n pattern = items.patt...
javascript
chosen
[ { "from": "system", "value": "Remove PositionLayer as it's an expensive operation\n" }, { "from": "human", "value": "import PIXI from 'pixi.js';\nimport Hexagon from './hexagon.js';\nimport GroundLayer from './layer/groundLayer.js';\nimport PositionLayer from './layer/positionLayer.js';\n\nlet h...
javascript
chosen
[ { "from": "system", "value": "Update footer color: use vscode-footer-like color" }, { "from": "human", "value": "import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme'\nimport {merge} from 'lodash'\n\nexport default merge(lightBaseTheme, {\n palette: {\n primary1Color: '#f...
javascript
chosen
[ { "from": "system", "value": "Add text and manual redirect link to log out page\n" }, { "from": "human", "value": "// @flow\n\nimport * as React from 'react';\nimport { Redirect } from 'react-router';\n\nimport { AuthToken } from 'lib/auth';\n\nexport default class Logout extends React.Component...
javascript
chosen
[ { "from": "system", "value": "Add dynamic event template selection\n" }, { "from": "human", "value": "\"use strict\";\n\n$(function(){\n var Workspace = Backbone.Router.extend({\n routes: {\n \"\": \"index\",\n \"event/:id\": \"event\"\n },\n\n index: function() {\n },\n\n...
javascript
chosen
[ { "from": "system", "value": "Use Array.from instead of custom function\n" }, { "from": "human", "value": "'use strict';\n\nconst fs = require('fs');\nconst camelCase = require('camelcase');\n\nfunction getPackageDeps() {\n const pkgFile = fs.readFileSync('./package.json');\n return Object.key...
javascript
chosen
[ { "from": "system", "value": "Add tmp directory to deploy exclude list\n" }, { "from": "human", "value": "'use strict';\n\nvar gulp = require('gulp');\nvar to5 = require('gulp-6to5');\nvar watch = require('gulp-watch');\nvar deploy = require('gulp-gh-pages');\nvar jshint = require('gulp-jshint')...
javascript
chosen
[ { "from": "system", "value": "Update truth tree base to have open and close stack properties\n" }, { "from": "human", "value": "/**\n * jKif - 2015\n * truth_tree_base.js\n * @file Base TruthTree Constructor which all TruthTrees call up to on initialization\n * @author Clark Feusier - cfeusier@g...
javascript
chosen
[ { "from": "system", "value": "Make compilation the gulp default task\n" }, { "from": "human", "value": "var gulp = require('gulp'),\n gutil = require('gulp-util'),\n coffee = require('gulp-coffee');\n\ngulp.task('logger-change', function(){\n gulp.src('src/*.coffee')\n .pipe(coff...
javascript
chosen
[ { "from": "system", "value": "Delete non present ignore files from gulp parsing\n" }, { "from": "human", "value": "// gulp\nvar gulp = require('gulp');\n\n// plugins\nvar jshint = require('gulp-jshint');\nvar jscs = require('gulp-jscs');\nvar argv = require('yargs').argv;\nvar gulpIgnore = req...
javascript
chosen
[ { "from": "system", "value": "Sort sets by sequence number.\n\nThe AllSets query uses only tags, which are\na boolean term. Therefore the result set wont\nbe affected by the sort field. However, it will\nmean that the array we get back from xapian\nis sorted by sequence number, which is needed\nfor the para...
javascript
chosen
[ { "from": "system", "value": "refactor(createUserReducer): Add initial user redux state.\n" }, { "from": "human", "value": "import update from 'immutability-helper'\n\n// TODO: port user-specific code from the otp reducer.\nfunction createUserReducer () {\n const initialState = {}\n\n return (...
javascript
chosen
[ { "from": "system", "value": "Use appendChild instead of append\n\n`append` is only supported in Chrome > 54\n\nFixes #1127\n\n// FREEBIE\n" }, { "from": "human", "value": "/*global $, Whisper, Backbone, textsecure, extension*/\n/*\n * vim: ts=4:sw=4:expandtab\n */\n(function () {\n 'use stri...
javascript
chosen
[ { "from": "system", "value": "Use itemID as react list key.\n" }, { "from": "human", "value": "import React from \"react\";\nimport moment from 'moment';\nimport ReactCSSTransitionGroup from 'react-addons-css-transition-group'\n\nimport NewsItem from \"./NewsItem\";\nimport NewsCow from \"./News...
javascript
chosen
[ { "from": "system", "value": "Disable shuffle button while shuffling in progress.\n" }, { "from": "human", "value": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslator } from '@u-wave/react-translate';\nimport CircularProgress from '@material-ui/core/Circular...
javascript
chosen
[ { "from": "system", "value": "Revert \"SYNTAX ERROR SORRY EVERYONE\"\n\nThis reverts commit 9f9d12108a52875e3106b05ba00604cd891a4ce7.\n" }, { "from": "human", "value": "var mongoose = require('mongoose');\n\nmodule.exports.finderForProperty = function(field, props) {\n if (props === undefined...
javascript
chosen
[ { "from": "system", "value": "ENYO-13: Complete JSDoc3 conversion on Mochi\n" }, { "from": "human", "value": "/**\n\tAn mochi-styled TextArea control. In addition to the features of\n\t<a href=\"#enyo.TextArea\">enyo.TextArea</a>, mochi.TextArea has a\n\t*defaultFocus* property that can be set t...
javascript
chosen
[ { "from": "system", "value": "Move small caps to extended formatting.\n" }, { "from": "human", "value": "// annotations that are simple annotations\nexport const RICH_TEXT_ANNOS = ['bold', 'italic', 'small-caps', 'superscript', 'subscript']\n\nexport const EXTENDED_FORMATTING = ['monospace', 'st...
javascript
chosen
[ { "from": "system", "value": "Correct the timer element issue\n" }, { "from": "human", "value": "const Timer = React.createClass({\n getInitialState: function () {\n return { secondsToWait: this.props.secondsToWait };\n },\n runTimer: function () {\n let timer = setInterval(() => {\n ...
javascript
chosen
[ { "from": "system", "value": "Add build step to pre-push git hook\n" }, { "from": "human", "value": "'use strict'\n\nmodule.exports = {\n hooks: {\n 'pre-commit': 'npm run lint',\n 'pre-push': 'npm run lint && npm test',\n },\n}\n" }, { "from": "gpt", "value": "'use strict'\n...
javascript
chosen
[ { "from": "system", "value": "Fix administration era end day\n" }, { "from": "human", "value": "import moment from 'moment'\nconst today = new moment()\n\nexport default [\n\t{\n\t\tstart_date: {\n\t\t\tyear: 2015,\n\t\t\tmonth: 6,\n\t\t\tday: 16\n\t\t},\n\t\tend_date: {\n\t\t\tyear: 2016,\n\t\t...
javascript
chosen
[ { "from": "system", "value": "Use Ember.get in Object Proxy\n\nThis allows the use of POJOs" }, { "from": "human", "value": "import Ember from 'ember';\nimport RecordKeeperMixin from 'ember-time-machine/mixins/time-machine';\nimport Record from 'ember-time-machine/-private/Record';\nimport { wra...
javascript
chosen
[ { "from": "system", "value": "Make scale automatically wrap high degrees to higher octaves.\n" }, { "from": "human", "value": "var Scale = new Class({\n initialize: function(degrees, tuning) {\n this.degrees = degrees;\n this.tuning = tuning || new EqualTemperamentTuning(12);\n ...
javascript
chosen
[ { "from": "system", "value": "Add viewbox, fill, and fill-rule in draw command\n" }, { "from": "human", "value": "var express = require('express');\nvar gm = require('gm');\nvar hashblot = require('hashblot');\n\nfunction encode(str) {\n return encodeURIComponent(str).replace(/%20/g,'+')}\nfunc...
javascript
chosen
[ { "from": "system", "value": "Add rule context for device command (enhances logging)\n" }, { "from": "human", "value": "var path = require('path');\n\nvar Rules = require('./lib/rules');\nvar Resource = require('./resource');\n\nvar rules = new Rules({\n filename: path.join(process.cwd(), './ru...
javascript
chosen
[ { "from": "system", "value": "Allow CORS requests from all domains (*)\n\nSince this is an API after all\n" }, { "from": "human", "value": "var express = require('express');\nvar app = express();\n\nvar routes = require('./api/routes');\n\napp.set('port', 14000);\n\napp.use('/api/', routes);\n\n...
javascript
chosen
[ { "from": "system", "value": "Add the delete and the edit functionality\n" }, { "from": "human", "value": "function NotesApplication(author) {\n\tthis.author = author;\n\tthis.notesList = [];\n}\n\nNotesApplication.prototype.create(note_content){\n\tthis.notesList.push(note_content)\n}\n\nNotesA...
javascript
chosen
[ { "from": "system", "value": "Create Mongoose model for Note, and list notes." }, { "from": "human", "value": "var app = require('express')();\n\napp.get('/', function(req, res) {\n res.send('Hello World!');\n});\n\nvar server = app.listen(3000, function() {\n console.log('Listening on http://...
javascript
chosen
[ { "from": "system", "value": "Fix game name on Dashboard when not initalised\n" }, { "from": "human", "value": "import React from 'react'\n\nimport GameCard from './GameCard'\n\nexport default (props) => {\n const userId = props.userId\n const teams = props.teams\n const games = []\n const g...
javascript
chosen
[ { "from": "system", "value": "Remove unneeded map for collection model\n" }, { "from": "human", "value": "/**\n * Main entrypoint for banknote.\n *\n * Copyright 2015 Ethan Smith\n */\n\nvar Backbone = require('backbone'),\n Marionette = require('backbone.marionette'),\n $ = require('jquer...
javascript
chosen
[ { "from": "system", "value": "Set release attr in correct place" }, { "from": "human", "value": "import { init, captureException, configureScope } from '@sentry/browser';\n\nimport { LOG_ERRORS, RAVEN_ENDPT, RELEASE } from '../constants';\n\nexport const setup = () => {\n if (LOG_ERRORS) {\n ...
javascript
chosen
[ { "from": "system", "value": "Fix missing comma in sohm al triggers\n" }, { "from": "human", "value": "// Sohm Al (normal)\n// Nobody remembers what to do here, so here's triggers.\n[{\n zoneRegex: /^Sohm Al$/\n triggers: [\n {\n id: 'Sohm Al Myath Stack',\n regex: /1B:........:(\...
javascript
chosen
[ { "from": "system", "value": "Convert CLI output to `.csv`\n" }, { "from": "human", "value": "#!/usr/bin/env node\n'use strict';\n\nvar input = process.argv.slice(2);\nvar pkg = require('./package.json');\nvar stdin = require('get-stdin');\nvar viewport = require('./');\n\n/**\n * Help screen\n ...
javascript
chosen
[ { "from": "system", "value": "Exit 1 on usage if specified a file.\n" }, { "from": "human", "value": "#!/usr/bin/env node\n\nconst fs = require('fs')\nconst path = require('path')\nconst readline = require('readline')\n\nconst flat = require('./index')\n\nif (process.stdin.isTTY) {\n const file...
javascript
chosen
[ { "from": "system", "value": "tweak: Increase the maximum length of a line\n" }, { "from": "human", "value": "/**\n *\n */\nmodule.exports = {\n extends: 'airbnb-base',\n\n env: {\n jest: true,\n },\n\n rules: {\n 'no-underscore-dangle': ['off'],\n 'global-require': ['off'],\n 'n...
javascript
chosen
[ { "from": "system", "value": "Make channel private by default\n" }, { "from": "human", "value": "import gql from 'graphql-tag';\n\nexport default gql`\n mutation createChannelMutation($title: String!) {\n create_channel(input: { title: $title }) {\n channel {\n id: slug\n ...
javascript
chosen
[ { "from": "system", "value": "Update new recs view and controller 2\n" }, { "from": "human", "value": "craftEd.controller('RecsController', ['$scope', '$http', '$location', function($scope, $http, $location){\n\n var config = {\n headers: {\n 'content-type': 'application/json'\n }\n ...
javascript
chosen
[ { "from": "system", "value": "Add site footer to each documentation generator\n" }, { "from": "human", "value": "var _ = require('lodash')\nvar fs = require('fs')\nvar gzip = require('gzip-size')\nvar filesize = require('filesize')\nvar cssstats = require('cssstats')\n\nvar module = require('tac...
javascript
chosen
[ { "from": "system", "value": "Add headers for Reddit requests\n" }, { "from": "human", "value": "export default {\n chan: {\n headers: {\n \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\",\n \"Accept-Encoding\": \"gzip, de...
javascript
chosen
[ { "from": "system", "value": "Use Surge's 200 file for clean routing.\n" }, { "from": "human", "value": "// see http://vuejs-templates.github.io/webpack for documentation.\nconst path = require('path')\n\nmodule.exports = {\n build: {\n env: require('./env.prod'),\n index: path....
javascript
chosen
[ { "from": "system", "value": "Rename function - Make it safer for IE\n" }, { "from": "human", "value": "\n\n/**\n * Rename a function to a new name, for call stack and debugging\n *\n * @param {Function} func the function to rename\n * @param {String} newName the new name\n */\nfunction renameFu...
javascript
chosen
[ { "from": "system", "value": "Add toggle is copied constant\n" }, { "from": "human", "value": "export const SELECT_KEY = 'SELECT_KEY'\nexport const CLEAR_SELECTED_KEYS = 'CLEAR_SELECTED_KEYS'\nexport const TOGGLE_COMPOSER = 'TOGGLE_COMPOSER'\nexport const TOGGLE_GENERATING_KEY = 'TOGGLE_GENERATI...
javascript
chosen
[ { "from": "system", "value": "Add route to register users\n" }, { "from": "human", "value": "'use strict';\n\nvar path = process.cwd();\nvar Graphriend = require(path + '/app/controllers/Graphriend.server.js');\nvar sess;\n\nmodule.exports = function (app) {\n\n\tfunction isLoggedIn (req, res, n...
javascript
chosen
[ { "from": "system", "value": "Use helper to create test strings\n" }, { "from": "human", "value": "import fs from 'fs'\nimport test from 'tape'\nimport sinon from 'sinon'\nimport index, {formats} from '../src/commit-msg'\n\ntest('index', t => {\n t.equal(typeof index, 'object', 'default export ...
javascript
chosen
[ { "from": "system", "value": "Make column numbers in Location mandatory\n" }, { "from": "human", "value": "\nvar esprima = require('esprima');\n\n\n/**\n * Position in the source file.\n *\n * @see [SpiderMonkey Parser API]\n * {@link https://developer.mozilla.org/en-US/docs/Mozilla/Projects/S...
javascript
chosen
[ { "from": "system", "value": "Add full date and time to the cell value titles\n" }, { "from": "human", "value": "import moment from 'moment'\nimport React from 'react'\nimport PropTypes from 'prop-types'\n\nfunction format (value) {\n if (value.isAfter(moment().startOf('year'))) {\n return v...
javascript
chosen
[ { "from": "system", "value": "Disable background image for now\n" }, { "from": "human", "value": "import React from 'react';\r\nimport moment from 'moment';\r\nimport { Link } from 'react-router-dom';\r\n\r\nimport { getEventDescriptions } from '../utilities/event';\r\n\r\nconst UpcomingEventHer...
javascript
chosen
[ { "from": "system", "value": "Remove keystone mongoose logging in fields test helper\n" }, { "from": "human", "value": "var fs = require('fs'),\n\tkeystone = require('../index');\n\nexports.init = function (shouldRunTests) {\n\tkeystone.init();\n\n\tvar typesLoc = __dirname + '/../fields/types';...
javascript
chosen
[ { "from": "system", "value": "Make some vars lets for strictness purposes.\n" }, { "from": "human", "value": "var expect = require('chai').expect;\nvar parse = require('../src/commands/parse');\n\ndescribe('YAML-to-commands parser', () => {\n var filename = 'test/test.usher.yml';\n var result ...
javascript
chosen
[ { "from": "system", "value": "Add terrible stub of a test\n" }, { "from": "human", "value": "'use strict';\n\nconst assert = require('assert');\n\nconst prepareContext = require('../lib/prepareContext');\nconst render = require('../lib/render');\nconst { nunjucksEnv } = require('../constants');\...
javascript
chosen
[ { "from": "system", "value": "Add first test; needs debugging\n" }, { "from": "human", "value": "var io = require('socket.io-client');\nvar socketUrl = 'http://0.0.0.0.3000';\n\nvar options = {\n transports: ['websocket'],\n 'force new connection': true\n}\n\nvar chatUser1 = { username: \"Cari...
javascript
chosen
[ { "from": "system", "value": "Add s->c message to unit test.\n" }, { "from": "human", "value": "var assert = require('assert');\nvar sys = require('sys');\nvar WebSocket = require('websocket').WebSocket;\nvar WebSocketServer = require('ws').Server;\n\nvar PORT = 1024 + Math.floor(Math.random() *...
javascript
chosen
[ { "from": "system", "value": "Use sinon to stub method\n" }, { "from": "human", "value": "describe('slides', function () {\n\n var Dashboard = require('performanceplatform-client.js');\n var Q = require('q');\n var slides = require('../../src/js/slides.js');\n var container = document.create...
javascript
chosen
[ { "from": "system", "value": "Prepend logs with date timestamp\n" }, { "from": "human", "value": "'use strict';\n\n/**\n * Imports.\n */\nconst express = require('express');\nconst winston = require('winston');\n\n/**\n * Constants declarations.\n */\nconst LISTEN_PORT = process.env.LISTEN_PORT ...
javascript
chosen
[ { "from": "system", "value": "Load detected react-intl locale data" }, { "from": "human", "value": "import path from \"path\"\nimport {readdir} from \"fs\"\n\nimport {addLocaleData} from \"react-intl\"\nimport fr from \"react-intl/locale-data/fr\"\nimport en from \"react-intl/locale-data/en\"\n\...
javascript
chosen
[ { "from": "system", "value": "Move all jquerry actions to document.ready\n" }, { "from": "human", "value": "$(document).ready(\n function () {\n $('.autoload').each(function () {\n $(this).load($(this).attr('data-url'));\n });\n setInterval(function () {\n ...
javascript
chosen
[ { "from": "system", "value": "Revert \"Try commiting straight to gh-pages this time\"\n\nThis reverts commit 1ecb01bebf80335b891683c24b2e2dda92cbd28e.\n" }, { "from": "human", "value": "(function(){\n var app = angular.module(\"site\", [\"ngRoute\"]);\n\n app.controller(\"NavController\", func...
javascript
chosen
[ { "from": "system", "value": "Use gzip on records dataset\n\n- Didn't know fetch/AJAX natively supported gzip (needs investigation on\n other browsers)\n" }, { "from": "human", "value": "fetch('/records2.json')\n\t.then(response => response.json())\n\t.then(records => {\n\t\trenderData(records)...
javascript
chosen
[ { "from": "system", "value": "Reduce calendar range to 1 day\n" }, { "from": "human", "value": "import request from 'request';\nimport config from '../config/config';\n\nexport default {\n getFromConfig(callback) {\n let now = new Date();\n let later = new Date();\n later...
javascript
chosen
[ { "from": "system", "value": "Add error sound to s3\n" }, { "from": "human", "value": "\"use strict\";\n\nfunction audio(url) {\n return new Audio(url);\n}\n\nconst red = audio(\"https://s3.amazonaws.com/freecodecamp/simonSound1.mp3\");\nconst blue = audio(\"https://s3.amazonaws.com/freecodecam...
javascript
chosen
[ { "from": "system", "value": "Add valid prop to React Higher Order Component\n" }, { "from": "human", "value": "/* @flow */\nimport React from 'react'\n\nimport createErrorComponent from './createErrorComponent'\nimport createValidation from '../createValidation'\nimport {\n assoc,\n assocPath...
javascript
chosen
[ { "from": "system", "value": "Check for prefixed versions of requestAnimationFrame\n\nFirefox has mozRequestAnimationFrame, while Safari 6.0 and older Chrome\nuses webkitRequestAnimationFrame. This checks for the prefixed versions.\nThis is enough to get the game working in for me in Firefox 22.0a2\n(Aurora...
javascript
chosen
[ { "from": "system", "value": "FIX: Remove userid from vote function\n\nuserid does not need to be passed explicitly as it is contained in the\nusercookie\n" }, { "from": "human", "value": "\"use strict\";\n\nfunction logout() {\n $.ajax({\n url: '/logout',\n type: 'POST',\n ...
javascript
chosen
[ { "from": "system", "value": "Disable eslint console warnings in test files\n" }, { "from": "human", "value": "// Cascading config (merges with parent config)\n// http://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy\nmodule.exports = {\n \"env\": {\n \"mo...
javascript
chosen