jiebi/CodeConvo huggingface dataset:
{ <del> "node": true </del> <ins> /* * ENVIRONMENTS * ================= */ // Define globals exposed by Node.js. "node": true, /* * ENFORCING OPTIONS * ================= */ // Force all variable names to use either camelCase style or UPPER_CASE // with underscores. "camelcase": true, // Prohibit use of == and != in favor of === and !==. "eqeqeq": true, // Suppress warnings about == null comparisons. "eqnull": true, // Enforce tab width of 2 spaces. "indent": 2, // Prohibit use of a variable before it is defined. "latedef": true, // Require capitalized names for constructor functions. "newcap": true, // Enforce use of single quotation marks for strings. "quotmark": "single", // Prohibit trailing whitespace. "trailing": true, // Prohibit use of explicitly undeclared variables. "undef": true, // Warn when variables are defined but never used. "unused": true, // Enforce line length to 80 characters "maxlen": 80 </ins> }
<ins> { /* * ENVIRONMENTS * ================= */ // Define globals exposed by modern browsers. "browser": true, // Define globals exposed by jQuery. "jquery": true, /* * ENFORCING OPTIONS * ================= */ // Force all variable names to use either camelCase style or UPPER_CASE // with underscores. "camelcase": true, // Prohibit use of == and != in favor of === and !==. "eqeqeq": true, // Suppress warnings about == null comparisons. "eqnull": true, // Enforce tab width of 2 spaces. "indent": 2, // Prohibit use of a variable before it is defined. "latedef": true, // Require capitalized names for constructor functions. "newcap": true, // Enforce use of single quotation marks for strings. "quotmark": "single", // Prohibit trailing whitespace. "trailing": true, // Prohibit use of explicitly undeclared variables. "undef": true, // Warn when variables are defined but never used. "unused": true, // Enforce line length to 80 characters "maxlen": 80, // Enforce placing 'use strict' at the top function scope "strict": true' } </ins>
## Byzantine Fault Tolerance Imagine the scenario where there is an empire and there are three generals with their respective armies at different positions. All of them must attack in order to win the fight or they can choose to retreat. Their only means of communications are through pigeon posts. But there is a problem, the generals can't trust each other or ensure that the message has not been corrupted along the way. How do they solve this problem? Blockchain essentially does so by listening to information broadcasted by other people, reaching to a consensus of which information is deemed true. As such, this model asssumes that the amount of "traitors" do not exceed more than 1/3 of the entire network. <ins> ## Modern Use Cases of Blockchain - Asset Tokenization : Using blockchain technology, previously illiquid assets can now be converted into its tokenized form and cheaply and efficiently fractionalized, traded and settled on chain (rather than go through the lengthy process of clearing and settlement process through third parties like clearing houses) - Supply Chain Management : Blockchains allow multiple parties to access a database to act as the single source of truth. Recorded transactions are immutable, are append only and provide a time stamped audit trail. - Digital Identity : A self sovereign ID can be used to verify identity without needing an individual to produce numerous documents and paperwork each time they need their identity verified. This could be done with a single key that can be matched against an immutable ledger. The digital ID can also collect other online information about a user’s identity like social security information, medical records and social media credentials and have that stored securely on the blockchain. - Energy Market : Blockchain technology can enable the smart metering of electricity generated through an individual’s solar panels to be recorded, traded and settled on a ledger. - Healthcare : Using blockchain technology to record patient information on a distributed ledger can allow different stakeholders conditional access to a single source of truth where each interaction with a patient’s health data can be recorded on a ledger as a transaction with a time stamped audit trail. </ins> ## Issues Whilst blockchain technology is undoubtedly elegant, there are several problems that its presence brings, the main one being use my malicious third parties. Due to the extremely secure nature of blockchain, its technologies are often used by criminals to carry out transactions, which are impossible for governments to track.
"description": [ "Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array." ], <del> "challengeSeed": "function chunk(arr, size) {n  // Break it up.rn  return arr;rn}nnchunk((['a', 'b', 'c', 'd'], 2));", </del> <ins> "challengeSeed": "function chunk(arr, size) {n  // Break it up.rn  return arr;rn}nnchunk(['a', 'b', 'c', 'd'], 2);", </ins> "tests": [ "assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');", "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
"description": [ "Return the remaining elements of an array after chopping off n elements from the head." ], <del> "challengeSeed": "function slasher(arr) {n  // it doesn't allways pay to be firstrn  return arr;rn}nnslasher([1, 2, 3], 2);", </del> <ins> "challengeSeed": "function slasher(arr, howMany) {n  // it doesn't allways pay to be firstrn  return arr;rn}nnslasher([1, 2, 3], 2);", </ins> "tests": [ "assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');", "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements when n < 1');",
] }, { <ins> "_id":"a8e512fbe388ac2f9198f0fa", "name":"Where art thou", "difficulty":"1.55", "description":[ "Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument)." ], "challengeEntryPoint":"where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });", "challengeSeed":"function where(collection, source) {n  var arr = [];rn  // What's in a name?rn  return arr;rn}", "tests":[ "assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');", "assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');" ] }, { </ins> "_id":"a39963a4c10bc8b4d4f06d7e", "name":"Seek and Destroy", "difficulty":"1.60",
"name":"Seek and Destroy", "difficulty":"1.60", "description":[ <del> "Remove all values (last argument(s)) from an array (first argument) and return as a new array." </del> <ins> "You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments." </ins> ], "challengeSeed": "function destroyer(arr) {n  // Remove all the valuesrn  return arr;rn}nndestroyer([1, 2, 3, 1, 2, 3], 2, 3);", "tests": [ "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');", "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');" ], <del> "MDNlinks" : ["Array.filter()"] </del> <ins> "MDNlinks" : ["Arguments object","Array.filter()"] </ins> }, { "_id": "a24c1a4622e3c05097f71d67",
<del> var moment = require('moment'), </del> <ins> /* eslint-disable no-catch-shadow, no-unused-vars */ var R = require('ramda'), debug = require('debug')('freecc:cntr:story'), Story = require('./../models/Story'), Comment = require('./../models/Comment'), User = require('./../models/User'), moment = require('moment'), resources = require('./resources'), </ins> mongodb = require('mongodb'), <del> nodemailer = require('nodemailer'), sanitizeHtml = require('sanitize-html'), </del> MongoClient = mongodb.MongoClient, <del> resources = require('./resources'), </del> secrets = require('../config/secrets'), <del> Story = require('./../models/Story'), Comment = require('./../models/Comment'), User = require('./../models/User'); </del> <ins> nodemailer = require('nodemailer'), sanitizeHtml = require('sanitize-html'); </ins> function hotRank(timeValue, rank) { /*
); story.markModified('rank'); story.save(); <del> User.find({ '_id': story.author.userId }, function(err, user) { </del> <ins> User.findOne({'_id': story.author.userId}, function(err, user) { </ins> if (err) { return next(err); } <del> user = user.pop(); </del> user.progressTimestamps.push(Date.now() || 0); <del> user.save(function (err) { req.user.save(function (err) { </del> <ins> user.save(function (err, user) { req.user.save(function (err, user) { </ins> if (err) { return next(err); }
if (link.search(/^https?:///g) === -1) { link = 'http://' + link; } <del> Story.count( { storyLink: new RegExp('^' + storyLink + '(?: [0-9]+)?$', 'i') }, function (err, storyCount) { if (err) { return res.status(500); } </del> <ins> Story.count({ storyLink: new RegExp('^' + storyLink + '(?: [0-9]+)?$', 'i')}, function (err, storyCount) { if (err) { return res.status(500); } </ins> <del> // if duplicate storyLink add unique number storyLink = (storyCount === 0) ? storyLink : storyLink + ' ' + storyCount; </del> <ins> // if duplicate storyLink add unique number storyLink = (storyCount === 0) ? storyLink : storyLink + ' ' + storyCount; </ins> <del> var link = data.link; if (link.search(/^https?:///g) === -1) { link = 'http://' + link; </del> <ins> var link = data.link; if (link.search(/^https?:///g) === -1) { link = 'http://' + link; } var story = new Story({ headline: sanitizeHtml(data.headline, { allowedTags: [], allowedAttributes: [] }).replace(/&quot;/g, '"'), timePosted: Date.now(), link: link, description: sanitizeHtml(data.description, { allowedTags: [], allowedAttributes: [] }).replace(/&quot;/g, '"'), rank: 1, upVotes: [({ upVotedBy: req.user._id, upVotedByUsername: req.user.profile.username })], author: { picture: req.user.profile.picture, userId: req.user._id, username: req.user.profile.username, email: req.user.email }, comments: [], image: data.image, storyLink: storyLink, metaDescription: data.storyMetaDescription, originalStoryAuthorEmail: req.user.email }); story.save(function (err) { if (err) { return res.status(500); </ins> } <del> var story = new Story({ headline: sanitizeHtml(data.headline, { allowedTags: [], allowedAttributes: [] }).replace(/&quot;/g, '"'), timePosted: Date.now(), link: link, description: sanitizeHtml(data.description, { allowedTags: [], allowedAttributes: [] }).replace(/&quot;/g, '"'), rank: 1, upVotes: [({ upVotedBy: req.user._id, upVotedByUsername: req.user.profile.username })], author: { picture: req.user.profile.picture, userId: req.user._id, username: req.user.profile.username, email: req.user.email }, comments: [], image: data.image, storyLink: storyLink, metaDescription: data.storyMetaDescription, originalStoryAuthorEmail: req.user.email }); story.save(function (err) { </del> <ins> req.user.progressTimestamps.push(Date.now() || 0); req.user.save(function (err, user) { </ins> if (err) { <del> return res.status(500); </del> <ins> return next(err); </ins> } <del> req.user.progressTimestamps.push(Date.now() || 0); req.user.save(function (err) { if (err) { return next(err); } }); res.send(JSON.stringify({ storyLink: story.storyLink.replace(/s/g, '-').toLowerCase() })); </del> }); <del> } ); </del> <ins> res.send(JSON.stringify({ storyLink: story.storyLink.replace(/s/g, '-').toLowerCase() })); }); }); </ins> }; exports.commentSubmit = function(req, res, next) {
try { // Based on the context retrieve the parent // object of the comment (Story/Comment) <del> Context.find( { '_id': data.associatedPost }, function (err, associatedContext) { </del> <ins> Context.find({'_id': data.associatedPost}, function (err, associatedContext) { if (err) { return next(err); } associatedContext = associatedContext.pop(); if (associatedContext) { associatedContext.comments.push(data._id); associatedContext.save(function (err) { if (err) { return next(err); } res.send(true); }); } // Find the author of the parent object User.findOne({'profile.username': associatedContext.author.username}, function(err, recipient) { </ins> if (err) { return next(err); } <del> associatedContext = associatedContext.pop(); if (associatedContext) { associatedContext.comments.push(data._id); associatedContext.save(function (err) { if (err) { return next(err); </del> <ins> // If the emails of both authors differ, // only then proceed with email notification if ( typeof data.author !== 'undefined' && data.author.email && typeof recipient !== 'undefined' && recipient.email && (data.author.email !== recipient.email) ) { var transporter = nodemailer.createTransport({ service: 'Mandrill', auth: { user: secrets.mandrill.user, pass: secrets.mandrill.password </ins> } <del> res.send(true); </del> }); <del> } // Find the author of the parent object User.findOne( { 'profile.username': associatedContext.author.username }, function(err, recipient) { </del> <ins> var mailOptions = { to: recipient.email, from: 'Team@freecodecamp.com', subject: data.author.username + ' replied to your post on Camper News', text: [ 'Just a quick heads-up: ', data.author.username, ' replied to you on Camper News.', 'You can keep this conversation going.', 'Just head back to the discussion here: ', 'http://freecodecamp.com/news/', data.originalStoryLink, '- the Free Code Camp Volunteer Team' ].join('n') }; transporter.sendMail(mailOptions, function (err) { </ins> if (err) { <del> return next(err); </del> <ins> return err; </ins> } <del> // If the emails of both authors differ, // only then proceed with email notification if ( typeof data.author !== 'undefined' && data.author.email && typeof recipient !== 'undefined' && recipient.email && (data.author.email !== recipient.email) ) { var transporter = nodemailer.createTransport({ service: 'Mandrill', auth: { user: secrets.mandrill.user, pass: secrets.mandrill.password } }); var mailOptions = { to: recipient.email, from: 'Team@freecodecamp.com', subject: data.author.username + ' replied to your post on Camper News', text: [ 'Just a quick heads-up: ', data.author.username, ' replied to you on Camper News.', 'You can keep this conversation going.', 'Just head back to the discussion here: ', 'http://freecodecamp.com/news/', data.originalStoryLink, '- the Free Code Camp Volunteer Team' ].join('n') }; transporter.sendMail(mailOptions, function (err) { if (err) { return err; } }); } } ); } ); </del> <ins> }); } }); }); </ins> } catch (e) { <ins> // delete comment </ins> return next(err); } });
"Add them as a new contact in Screen Hero, then click the monitor-looking button to attempt to share your screen with them.", "Once the Screen Hero session starts, your screen's margins will glow orange. You are now sharing your screen.", "Your pair will have their own cursor, and will be able to type text on his or her and keyboard.", <del> "Now it's time to tackle our Bonfires.", "Go to <a href='http://freecodecamp.com/bonfires' target='_blank'>http://freecodecamp.com/bonfires</a> and start working through our Bonfire challenges.", </del> <ins> "Now it's time to tackle our Bonfires. You can begin them by advancing to the next challenge.", </ins> "Once you you finish pair programming, end the session in Screen Hero session.", "Congratulations! You have completed your first pair programming session.", "Pair program as much as possible with different campers until you've completed all the Bonfire challenges. This is a big time investment, but the JavaScript practice you get will be well worth it!",
"tests": [ "assert($('ul').length > 0, 'You should have an <code>ul</code> element on your webpage.')", "assert($('ol').length > 0, 'You should have an <code>ol</code> element on your webpage.')", <del> "assert($('li').length > 5, 'You should have three <code>li</code> elements on within your <code>ul</code> element.')", "assert($('li').length > 5, 'You should have three <code>li</code> elements on within your <code>ol</code> element.')" </del> <ins> "assert($('li').length > 5, 'You should have three <code>li</code> elements within your <code>ul</code> element.')", "assert($('li').length > 5, 'You should have three <code>li</code> elements within your <code>ol</code> element.')" </ins> ], "challengeSeed": [ "<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"For example, if you wanted to make a text input field required, you can just add the word "required" within your <code>input</code> element use: <code>&#60;input type='text' required&#62;</code>" ], "tests": [ <del> "assert($('input').prop('required'), 'Your text field have the property of being required.')", "assert($('[placeholder]').length > 0, 'Your text field should have the placeholder text of "cat photo URL".')" </del> <ins> "assert($('input').prop('required'), 'Your text field should have the property of being required.')", "assert(new RegExp('cat photo URL').test($('input').prop('placeholder')), 'Your text field should have the placeholder text of "cat photo URL".')" </ins> ], "challengeSeed": [ "<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"Put the "like", "Info" and "Delete" buttons side-by-side by wrapping all three of them within one <code>&#60;div class="row"&#62;</code> element, then each of them within a <code>&#60;div class="col-xs-4"&#62;</code> element.", "Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a <code>div</code> element.", "Here's a diagram of how Bootstrap's 12-column grid layout works:", <del> "<img class='img-responsive' src='https://www.evernote.com/l/AHTwlE2XCLhGFYJzoye_QfsF3ho6y87via4B/image.png'>", </del> <ins> "<a href='http://getbootstrap.com/css/#grid-example-basic' target='_blank'><img class='img-responsive' src='https://www.evernote.com/l/AHTwlE2XCLhGFYJzoye_QfsF3ho6y87via4B/image.png'></a>", </ins> "Note that in this illustration, we use the <code>col-md-*</code> class. Here, "md" means "medium", and "*" is a number specifying how many columns wide the element should be. In this case, we're specifying how many columns wide an element should be on a medium-sized screen, such as a laptop.", "In the Cat Photo App that we're building, we'll use <code>col-xs-*</code>, where "*" is the number of columns wide the element should be, and "xs" means "extra small", like an extra-small mobile phone screen.", "The <code>row</code> class is applied to a <code>div</code>, and the buttons themselves can be wrapped within it."
"name": "Waypoint: Line up Form Elements Responsively with Bootstrap", "difficulty" : 0.062, "description": [ <del> "Wrap both your form's text input field and submit button within a div with the class "row". Wrap your form's text input field within a div with the class of "col-xs-7". Wrap your form's submit button the in a div with the class "col-xs-5".", </del> "Now let's get your form input and your submission button on the same line. We'll do this the same way we have previously: by using a "row" element with "col-xs-*" elements withing it.", <ins> "Wrap both your form's text input field and submit button within a div with the class "row". Wrap your form's text input field within a div with the class of "col-xs-7". Wrap your form's submit button the in a div with the class "col-xs-5".", </ins> "This is the last challenge we'll do for our Cat Photo App for now. We hope you've enjoyed learning Font Awesome, Bootstrap, and responsive design!" ], "tests": [ <del> "assert($('.row').length > 4, 'Wrap your all of your checkboxes inside one div with the class "row".')", </del> <ins> "assert($('.row').length > 4, 'Wrap your form submission button and text area in a div with class "row".')", </ins> "assert($('.col-xs-5').length > 0, 'Wrap your form submission button in a div with the class "col-xs-5".')", "assert($('.col-xs-7').length > 0, 'Wrap your form text area in a div with the class "col-xs-7".')" ],
"description": [ "Delete your <code>h2</code> element's <code>style</code> tag and write the CSS to make all <code>h2</code> elements blue.", "With CSS, there are hundreds of <code>CSS attributes</code> that you can use to change the way an element looks on a web page.", <del> "When you entered <code>&#60;h2 style="color: red"&#62;CatPhotoApp&#60;h2&#62;</code>, you were giving that individual h2 element an <code>inline style</code>", </del> <ins> "When you entered <code>&#60;h2 style="color: red"&#62;CatPhotoApp&#60;/h2&#62;</code>, you were giving that individual h2 element an <code>inline style</code>", </ins> "That's one way to add style to an element, but a better way is by using <code>Cascading Style Sheets (CSS)</code>.", "At the top of your code, create a <code>style tag</code> like this: <code>&#60;style&#62;&#60;/style&#62;</code>", "Inside that style element, you can create a <code>css selector</code> for all <code>h2</code> elements. For example, if you wanted all <code>h2</code> elements to be red, your style element would look like this: <code>&#60;style&#62;h2 {color: red;}&#60;/style&#62;</code>",
"Here's the anatomy of a CSS class:", "<img class='img-responsive' alt='a diagram of how style tags are composed, which is also described in detail on the following lines.' src='https://www.evernote.com/l/AHSCzZV0l_dDLrqD8r9JsHaBWfEzdN0OpRwB/image.png'/>", "You can see that we've created a CSS class called "blue-text" within the <code>&#60;style&#62;</code> tag.", <del> "You can apply a class to an HTML element like this: <code>&#60;h2 class="blue-text"&#62;CatPhotoApp&#60;h2&#62;</code>", </del> <ins> "You can apply a class to an HTML element like this: <code>&#60;h2 class="blue-text"&#62;CatPhotoApp&#60;/h2&#62;</code>", </ins> "Note that in your CSS <code>style</code> element, classes should start with a period. In your HTML elements' class declarations, classes shouldn't start with a period.", "Instead of creating a new Style tag, try removing the h2 style declaration from the existing style element, and replace it with the class declaration for ".red-text"." ],
"description": [ "Wrap your <code>img</code> element inside an anchor element with a dead link.", "You can make elements into links by wrapping them in an <code>anchor tag</code>.", <del> "Wrap your image in an <code>anchor tag</code>. Here's an example: <code>&#60;a href='#'&#62;&#60;img src='http://bit.ly/fcc-kittens2'&#62;&#60;/a&#62;</code>", </del> <ins> "Wrap your image in an <code>anchor tag</code>. Here's an example: <code>&#60;a href='#'&#62;&#60;img src='http://bit.ly/fcc-kittens2'/&#62;&#60;/a&#62;</code>", </ins> "Remember to use the hash symbol as your <code>anchor tag</code>'s <code>href</code> property in order to turn it into a dead link.", "Once you've done this, hover over your image with your cursor. Your cursor's normal pointer should become the link clicking pointer. The photo is now a link." ],
"Replace the paragraph elements with an unordered list of three things that cats love.", "HTML has a special element for creating unordered lists, or bullet point-style lists.", "Unordered lists start with a <code>&#60;ul&#62;</code> element. Then they contain some number of <code>&#60;li&#62;</code> elements.", <del> "For example: <code>&#60;ul&#62;&#60;li&#62;milk&#60;/li&#62;&#60;li&#62;cheese&#60;/li&#62;&#60;ul&#62;</code> would create a bulleted list of "milk" and "cheese"." </del> <ins> "For example: <code>&#60;ul&#62;&#60;li&#62;milk&#60;/li&#62;&#60;li&#62;cheese&#60;/li&#62;&#60;/ul&#62;</code> would create a bulleted list of "milk" and "cheese"." </ins> ], "tests": [ "assert($('ul').length > 0, 'Create a <code>ul</code> element.')",