diff --git "a/freeCodeCamp/c2i/dev/queries.jsonl" "b/freeCodeCamp/c2i/dev/queries.jsonl" new file mode 100644--- /dev/null +++ "b/freeCodeCamp/c2i/dev/queries.jsonl" @@ -0,0 +1,200 @@ +{"_id":"q-en-freeCodeCamp-041cba1b7cd3d5f997ec0136904192b242243dd171b490fed76db494c2396a4b","text":"

Cat Form

--fcc-editable-region--
--fcc-editable-region--
--fcc-editable-region-- "} +{"_id":"q-en-freeCodeCamp-06dc9d56140e7db7b7cc39cef142b808078e99dfe8d4f1c4cba723a952109ecd","text":"// eslint-disable-next-line max-len it('Worker executor should successfully execute 3 tasks and use 1 worker', async () => { mockWorker(); const testWorker = createWorker('test', { concurrency: 1 }); const testWorker = createWorker('test', { maxWorkers: 1 }); const task1 = testWorker.execute('test1'); const task2 = testWorker.execute('test2');"} +{"_id":"q-en-freeCodeCamp-07fd307db27b710d7bfd504dfcccf395943a9cf8d8ae7014ba3c1f112ba3ea87","text":"import { bindActionCreators } from 'redux'; import EditorTabs from './EditorTabs'; import { showUpcomingChanges } from '../../../../../config/env.json'; import i18next from 'i18next'; const mapStateToProps = createStructuredSelector({ currentTab: currentTabSelector"} +{"_id":"q-en-freeCodeCamp-08313f954e1cb9b1600d869a27a10a625520fa826a719b61cdc1e4aa12fd2933","text":"\"workshop-blog-page\": { \"title\": \"Build a Cat Blog Page\", \"intro\": [ \"In this workshop, you will learn how to build an HTML only blog page using semantic elements including the main, nav, article and footer elements.\" \"In this workshop, you will learn how to build an HTML only blog page using semantic elements including the main, nav, article and footer elements.\" ] }, \"szcd\": { \"title\": \"13\", \"intro\": [] },"} +{"_id":"q-en-freeCodeCamp-0a690555f4574a9f26f49e467599491aa1dcf99310e2acc182b846eb1cb3daa2","text":"
style=\"padding: 15px 0px; height: 1px;\" style=\"padding: 15px 0px;\" />
style=\"padding: 15px 0px; height: 1px;\" style=\"padding: 15px 0px;\" />
function ChallengeDescription({ description, instructions, section }) { return (
{instructions && (
)}
); class ChallengeDescription extends Component { componentDidMount() { // Just in case 'current' has not been created, though it should have been. if (this.instructionsRef.current) { Prism.highlightAllUnder(this.instructionsRef.current); } } constructor(props) { super(props); this.instructionsRef = React.createRef(); } render() { const { description, instructions, section } = this.props; return (
{instructions && (
)}
); } } ChallengeDescription.displayName = 'ChallengeDescription';"} +{"_id":"q-en-freeCodeCamp-0baa0e4b137b9770de232b01a51cd1926089ff8dd639c25320dfb6c2634bb48a","text":"# --description-- Add an `else` block to handle the current song's position in the playlist. Add an `else` block to handle the song's current playback time. This allows you to resume the current song at the point where it was paused. Within the `else` block, set the `currentTime` property of the `audio` object to the value stored in `userData?.songCurrentTime`."} +{"_id":"q-en-freeCodeCamp-0c80847d2949356f8ccf83e602d8d52a37cada5cf93ebd46f437838662b7c23e","text":"# --description-- Set `monsterHealth` to `monsterHealth` minus the power of the player's current weapon. Remember you have the `currentWeapon` variable and the `power` property. Set `monsterHealth` to `monsterHealth` minus the power of the player's current weapon. Remember that you can access the power of the player's current weapon using `weapons[currentWeapon].power`. # --hints--"} +{"_id":"q-en-freeCodeCamp-0d53c2b93b86e82ad6f8e058af05ae9dd2b24205ecf304b24fbc80c81667979e","text":"const propTypes = { canFocusEditor: PropTypes.bool, children: PropTypes.any, editorRef: PropTypes.object, executeChallenge: PropTypes.func, innerRef: PropTypes.any, introPath: PropTypes.string,"} +{"_id":"q-en-freeCodeCamp-0dd8983e161f6a720c148073ab26651d1ed8bfce643c4aa965b7baea20f5a2e5","text":"# --description-- In programming, it is standard practice to prefix a variable with `is` or `has` to indicate that the variable is a boolean. ```js let isRunning = true; let hasCompleted = false; ``` Declare an `isError` variable and set it to `false`, but use `let` so you can reassign it later. # --hints--"} +{"_id":"q-en-freeCodeCamp-0dd95176ba2a05fa5fad495cb6b0d0b0b05176982f6192e59fd7a02dbbf9f752","text":"\"difficulty\": 0.13, \"challengeSeed\": \"125671865\", \"description\": [ \"jQuery is a powerful tool for manipulating HTML elements.\", \"It's a lot easier to use than JavaScript itself, so we'll learn it first.\", \"jQuery is a powerful library built in Javascript for manipulating HTML elements.\", \"It's a lot easier to use than Javascript itself, so we'll learn it first.\", \"It's also extremely popular with employers, so we're going to learn it well.\", \"Codecademy has an excellent free course that will walk us through the basics of jQuery.\", \"Go to http://www.codecademy.com/courses/web-beginner-en-bay3D/0/1 and complete the first section.\""} +{"_id":"q-en-freeCodeCamp-12ca481e404b14f25313dd9e063726060520b3e1899034b9641b592d3ba78613","text":"Three circles of equal radius are placed inside a larger circle such that each pair of circles is tangent to one another and the inner circles do not overlap. There are four uncovered \"gaps\" which are to be filled iteratively with more tangent circles. \"a \"a At each iteration, a maximally sized circle is placed in each gap, which creates more gaps for the next iteration. After 3 iterations (pictured), there are 108 gaps and the fraction of the area which is not covered by circles is 0.06790342, rounded to eight decimal places."} +{"_id":"q-en-freeCodeCamp-13ef632bbb17c57d5202ab50f7e0c36bcb3b0ba16f1d754dc89c0c1f7a3539b4","text":"
  • laser pointers
  • lasagna
  • --fcc-editable-region--
    \"A --fcc-editable-region--
    --fcc-editable-region--
    "} +{"_id":"q-en-freeCodeCamp-15dd1f542d897d604d9e3085332523d262d790010e74757824dd8512b27cd7e0","text":"if (typeof test.remove !== 'function') { return false; } test.add(15); test.add(30); return test.remove(100) == null; })() );"} +{"_id":"q-en-freeCodeCamp-160ed495487e683385e056f1ed1afaa38d9cff3c53aeefaa93710c1533abd705","text":"Chain the `join()` method to your `map()` method and pass in an empty string for the separator. To chain multiple methods together, you can call the `join()` method on the result of the `map()` method. For example: ```js array.map().join(); ``` # --hints-- You should add `join(\"\")` to the existing code."} +{"_id":"q-en-freeCodeCamp-1b2319353cf9bcb86372faec97096cf423914bbb4192d8bb257cd08210db9b7f","text":"\"expect(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');\", \"expect(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');\", \"assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');\", \"assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 80.00], ['TEN', 10.00], ['FIVE', 5], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');\", \"assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');\", \"assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), 'Insufficient Funds', 'insufficient funds');\", \"assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), \"Closed\", 'cash-in-drawer equals change');\" ]"} +{"_id":"q-en-freeCodeCamp-1c27683284abf324350c268a5de4657e82b6d3a858813feadfaa3550cdd67cdf","text":"You should not call the `changeBackgroundColor` function. Instead, assign the function reference to the `onclick` property. ```js assert.strictEqual(typeof btn.onclick, 'function'); assert.strictEqual(typeof changeBackgroundColor, 'function'); assert.strictEqual(btn.onclick, changeBackgroundColor); ```"} +{"_id":"q-en-freeCodeCamp-1c8c7c95f785f3ca023e57f710e36441401f4caef5305e60b0c13ac060cbc915","text":"# --description-- Inside `pick`, use `let` to initialize a variable named `numbers` and set it to an empty array. Inside `pick`, use `const` to initialize a variable named `numbers` and set it to an empty array. # --hints--"} +{"_id":"q-en-freeCodeCamp-1d083fbd5b752b463f1a73846bdfe2e66fd87c32eed7263ded2168f1ff7f3f26","text":"} onReady={this.videoIsReady} opts={{ rel: 0, playerVars: { rel: 0 }, width: '960px', height: '540px' }}"} +{"_id":"q-en-freeCodeCamp-1e6bb292f5a6562afb5eac23ba882eff93881064a94ced7938f1b72a720f9806","text":"
    The sort method sorts the elements of an array according to the callback function. For example:
    function ascendingOrder(arr) {
      return arr.sort(function(a, b) {
        return a - b;
      });
    }
    ascendingOrder([1, 5, 2, 3, 4]);
    // Returns [1, 2, 3, 4, 5]

    function reverseAlpha(arr) {
      return arr.sort(function(a, b) {
        return a < b;
      });
    }
    reverseAlpha(['l', 'h', 'z', 'b', 's']);
    // Returns ['z', 's', 'l', 'h', 'b']
    function ascendingOrder(arr) {
      return arr.sort(function(a, b) {
        return a - b;
      });
    }
    ascendingOrder([1, 5, 2, 3, 4]);
    // Returns [1, 2, 3, 4, 5]

    function reverseAlpha(arr) {
      return arr.sort(function(a, b) {
        return a === b ? 0 : a < b ? : 1 : -1;
      });
    }
    reverseAlpha(['l', 'h', 'z', 'b', 's']);
    // Returns ['z', 's', 'l', 'h', 'b']
    Note: It's encouraged to provide a callback function to specify how to sort the array items. JavaScript's default sorting method is by string Unicode point value, which may return unexpected results.
    "} +{"_id":"q-en-freeCodeCamp-1f15643fcfc7d6474137968bd56c0dc61f1a608a1382910a18b371ceeea7551f","text":"1. When you click on the `#check-btn` element without entering a value into the `#text-input` element, an alert should appear with the text `Please input a value` 1. When the `#text-input` element only contains the letter `A` and the `#check-btn` element is clicked, the `#result` element should contain the text `A is a palindrome` 1. When the `#text-input` element contains the text `eye` and the `#check-btn` element is clicked, the `#result` element should contain the text `eye is a palindrome` 1. When the `#text-input` element contains the text `_eye` and the `#check-btn` element is clicked, the `#result` element should contain the text `eye is a palindrome` 1. When the `#text-input` element contains the text `_eye` and the `#check-btn` element is clicked, the `#result` element should contain the text `_eye is a palindrome` 1. When the `#text-input` element contains the text `race car` and the `#check-btn` element is clicked, the `#result` element should contain the text `race car is a palindrome` 1. When the `#text-input` element contains the text `not a palindrome` and the `#check-btn` element is clicked, the `#result` element should contain the text `not a palindrome is not a palindrome` 1. When the `#test-input` element contains the text `A man, a plan, a canal. Panama` and the `#check-btn` element is clicked, the `#result` element should contain the text `A man, a plan, a canal. Panama is a palindrome`"} +{"_id":"q-en-freeCodeCamp-20204c1f057cc2e56e495cef06a9ece31b3da0b727d51c6b0cd87c67e0c2eee5","text":"
    style=\"padding: 15px 0px; height: 1px;\" style=\"padding: 15px 0px;\" />
    "} +{"_id":"q-en-freeCodeCamp-20400bc3f163301f0e7843a3a52598e02bcf805a4c14ff54ceb77de8acdf56e1","text":"# --description-- Inside your `while` loop, push a random number between 0 and 10 to the end of the `numbers` array. You can create this random number with `Math.floor(Math.random() * 11)`. Inside your `while` loop, push a random number between `0` and `10` to the end of the `numbers` array. You can create this random number with `Math.floor(Math.random() * 11)`. # --hints--"} +{"_id":"q-en-freeCodeCamp-22ef9c21fa3a3e2289de8986c8da7650c0a5b86e0c478fce071e5f24a4eadbf6","text":"`Thermostat` should be a `class` with a defined `constructor` method. ```js assert( typeof Thermostat === 'function' && typeof Thermostat.constructor === 'function' ); assert.isFunction(Thermostat); assert.isFunction(Thermostat?.constructor); ``` `class` keyword should be used. The `class` keyword should be used. ```js assert(code.match(/class/g)); assert.match(code, /class/); ``` `Thermostat` should be able to be instantiated. ```js assert( (() => { const t = new Thermostat(122); return typeof t === 'object'; })() ); const _t = new Thermostat(122); assert.isObject(_t); ``` When instantiated with a Fahrenheit value, `Thermostat` should set the correct `temperature`. ```js assert( (() => { const t = new Thermostat(122); return t.temperature === 50; })() ); const _t = new Thermostat(122); assert.strictEqual(_t?.temperature, 50); ``` A `getter` should be defined. ```js assert( (() => { const desc = Object.getOwnPropertyDescriptor( Thermostat.prototype, 'temperature' ); return !!desc && typeof desc.get === 'function'; })() ); const _desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature'); assert.isFunction(_desc?.get); ``` A `setter` should be defined. ```js assert( (() => { const desc = Object.getOwnPropertyDescriptor( Thermostat.prototype, 'temperature' ); return !!desc && typeof desc.set === 'function'; })() ); const _desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature'); assert.isFunction(_desc?.set); ``` Calling the `setter` with a Celsius value should set the `temperature`. ```js assert( (() => { const t = new Thermostat(32); t.temperature = 26; const u = new Thermostat(32); u.temperature = 50; return t.temperature === 26 && u.temperature === 50; })() ); const _t = new Thermostat(32); _t.temperature = 26; const _u = new Thermostat(32); _u.temperature = 50; assert.approximately(_t.temperature, 26, 0.1); assert.approximately(_u.temperature, 50, 0.1); ``` # --seed--"} +{"_id":"q-en-freeCodeCamp-2315b4ef19497b79fd9072d00d9bc6e7302f128045298c338ff3f5afb606a3fb","text":"# --description-- Add a `title` and a `meta` element to the `head`. Give your project a title of `Registration Form`, and give a `charset` attribute with a value of `UTF-8` to your `meta` element. Add a `title` and `meta` element inside the `head` element. Give your project a title of `Registration Form`, and add the `charset` attribute with a value of `utf-8` to your `meta` element. # --hints--"} +{"_id":"q-en-freeCodeCamp-23f29802737e12e1dd80d475aa916ae57225c76684fdf17188e6a1be1e852905","text":">

    Super Block One Certification (300 hours) Super Block One Certification (300 hours)

    "} +{"_id":"q-en-freeCodeCamp-2682e3d62713d381f94e1f17b03ee44cef853650b42b667fa66df696313b7645","text":"## Instructions
    Write a remove method that takes an element and removes it from the linked list. Note The length of the list should decrease by one every time an element is removed from the linked list. Note: The length of the list should decrease by one every time an element is removed from the linked list.
    ## Tests"} +{"_id":"q-en-freeCodeCamp-27e2990f887bf9234015676789fde56949759d858006da04a1716d9d21e7bafc","text":"```js function whatIsInAName(collection, source) { const arr = []; // Only change code below this line // Only change code above this line return arr; } whatIsInAName([{ first: \"Romeo\", last: \"Montague\" }, { first: \"Mercutio\", last: null }, { first: \"Tybalt\", last: \"Capulet\" }], { last: \"Capulet\" });"} +{"_id":"q-en-freeCodeCamp-2827c84e094fa2ac4d9ba81c7de2f99b3fabea54240f53eb83a076d63fc2d272","text":"# --description-- Add one last conditional statement that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position plus the platform's width minus one-third of the player's width. Add one last boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position plus the platform's width minus one-third of the player's width. # --hints-- You should have a conditional statement that checks if the player's `x` position is lesser than or equal to the platform's `x` position plus the platform's width minus the player's width divided by `3`. You should have a boolean expression that checks if the player's `x` position is lesser than or equal to the platform's `x` position plus the platform's width minus the player's width divided by `3`. ```js assert.match(code, /player.position.xs*<=s*platform.position.xs*+s*platform.widths*-s*player.widths*/s*3,?/)"} +{"_id":"q-en-freeCodeCamp-285a02e58a42bbe95ab5a94f9e55812e49ad2511951e982e946db1df03e34be6","text":"# --seed-- ## --after-user-code-- ```js let rules=[[\"A -> apple\",\"B -> bag\",\"S -> shop\",\"T -> the\",\"the shop -> my brother\",\"a never used -> .terminating rule\"], [\"A -> apple\",\"B -> bag\",\"S -> .shop\",\"T -> the\",\"the shop -> my brother\",\"a never used -> .terminating rule\"], [\"A -> apple\",\"WWWW -> with\",\"Bgage -> ->.*\",\"B -> bag\",\"->.* -> money\",\"W -> WW\",\"S -> .shop\",\"T -> the\",\"the shop -> my brother\",\"a never used -> .terminating rule\"], [\"_+1 -> _1+\",\"1+1 -> 11+\",\"1! -> !1\",\",! -> !+\",\"_! -> _\",\"1*1 -> x,@y\",\"1x -> xX\",\"X, -> 1,1\",\"X1 -> 1X\",\"_x -> _X\",\",x -> ,X\",\"y1 -> 1y\",\"y_ -> _\",\"1@1 -> x,@y\",\"1@_ -> @_\",\",@_ -> !_\",\"++ -> +\",\"_1 -> 1\",\"1+_ -> 1\",\"_+_ -> \"], [\"A0 -> 1B\",\"0A1 -> C01\",\"1A1 -> C11\",\"0B0 -> A01\",\"1B0 -> A11\",\"B1 -> 1B\",\"0C0 -> B01\",\"1C0 -> B11\",\"0C1 -> H01\",\"1C1 -> H11\"]]; let tests=[\"I bought a B of As from T S.\", \"I bought a B of As from T S.\", \"I bought a B of As W my Bgage from T S.\", \"_1111*11111_\", \"000000A000000\"]; let outputs=[\"I bought a bag of apples from my brother.\", \"I bought a bag of apples from T shop.\", \"I bought a bag of apples with my money from T shop.\", \"11111111111111111111\", \"00011H1111000\"] ``` ## --seed-contents-- ```js"} +{"_id":"q-en-freeCodeCamp-297b69bb7b3c51fff169cb56edceecfe7be868fdd9c994fd12df4272f9f4ab45","text":"# --description-- **Objective:** Build an app that is functionally similar to this: https://codepen.io/freeCodeCamp/full/JEXgeY. **Objective:** Build an app that is functionally similar to this: https://heat-map.freecodecamp.rocks. Fulfill the below user stories and get all of the tests to pass. Use whichever libraries or APIs you need. Give it your own personal style."} +{"_id":"q-en-freeCodeCamp-2a72719a2104a4cee5555fbf17dff0a336258cf4564f15fce9c22ad5a9517f19","text":"# --description-- Use the `setAttribute` method on the `playButton` element to set an attribute named `\"aria-label\"`. For the value, use a `ternary` to set `song?.title` to `Play ${song.title}` or `\"Play\"` if there's no `song.title` available. The `setPlayButtonAccessibleText` function will set the `aria-label` attribute to the current song, or to the first song in the playlist. And if the playlist is empty, it sets the `aria-label` to `\"Play\"`. Use the `setAttribute` method on the `playButton` element to set an attribute named `\"aria-label\"`. For the value, use a ternary to `set song?.title` to `Play ${song.title}` or `\"Play\"` if there's no `song.title` available. Don't forget you need template interpolation here, so you need to use backticks."} +{"_id":"q-en-freeCodeCamp-2b2c176102b1d699bdc1ea7a3782a7b3c0ed3ec9a33248dfa76aa586fc23d000","text":"import rateLimit from 'express-rate-limit'; // @ts-expect-error - no types import MongoStoreRL from 'rate-limit-mongo'; import isEmail from 'validator/lib/isEmail'; import { AUTH0_DOMAIN, MONGOHQ_URL } from '../utils/env'; import { auth0Client } from '../plugins/auth0'; import { createAccessToken } from '../utils/tokens'; import { findOrCreateUser } from './helpers/auth-helpers'; const getEmailFromAuth0 = async (req: FastifyRequest) => { const getEmailFromAuth0 = async ( req: FastifyRequest ): Promise => { const auth0Res = await fetch(`https://${AUTH0_DOMAIN}/userinfo`, { headers: { Authorization: req.headers.authorization ?? '' } }); if (!auth0Res.ok) { req.log.error(auth0Res); throw new Error('Invalid Auth0 Access Token'); } if (!auth0Res.ok) return null; const { email } = (await auth0Res.json()) as { email: string }; return email; // For now, we assume the response is a JSON object. If not, we can't proceed // and the only safe thing to do is to throw. const { email } = (await auth0Res.json()) as { email?: string }; return typeof email === 'string' ? email : null; }; /**"} +{"_id":"q-en-freeCodeCamp-2befa04a9ebad71829127b7f36778b945e60b88c01711e9236739950d4dbd6af","text":"align-items: center; min-height: 100vh; flex-direction: column; padding: 50px; } .certificate-outer-wrapper .donation-section { padding: 20px 0px; padding-bottom: 100px; } .certificate-outer-wrapper .donation-section hr {"} +{"_id":"q-en-freeCodeCamp-2eb6ed3a8a1478d59ebf0c832b101c0c9b704f2663d6ff247368dff73bd7ccaa","text":"--fcc-editable-region-- function pick(guess) { let numbers = []; const numbers = []; while (numbers.length < 10) { }"} +{"_id":"q-en-freeCodeCamp-2f29df22e4eb50768d2861b9cb18bbca2956ce74fde9757b902232619a8c5035","text":"? 'vs-custom' : editorSystemTheme; const isFailedChallengeTest = (test: Test): test is ChallengeTest => !!test.err && 'text' in test; const firstFailedTest = props.tests.find(test => isFailedChallengeTest(test) ); const firstFailedTest = props.tests.find(test => !!test.err); return ( }>"} +{"_id":"q-en-freeCodeCamp-2f5b468ed07241648aedda2b26a96bf2ad574a0d7d6609aa69d5c1a9ae0801e5","text":"} const Spacer = ({ size, children }: SpacerProps): JSX.Element => (
    {children}
    );"} +{"_id":"q-en-freeCodeCamp-2f76e5db21973ab06f5613c43e50addfdfc840f0dacd000e705b296c33481e1f","text":"type Story = StoryObj; export const Basic: Story = { args: { className: '', label: '' } args: {} }; export default story;"} +{"_id":"q-en-freeCodeCamp-307bef6d68af988395c178aa0b207819a537157d82682fc49d6d83d626160a11","text":"on: workflow_dispatch: schedule: # runs every weekday at 12:15 PM UTC - cron: '15 12 * * 1-5' # runs Monday and Wednesday at 12:15 PM UTC - cron: '15 12 * * 1,3' env: GITHUB_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}"} +{"_id":"q-en-freeCodeCamp-30ce38d34f5d6ef81e99e63cafed8d26d9bedb450a228fae661c58c597fc2c1d","text":"if (!codeUri.enabled) { return null; } location.hash = '?solution=' + codeUri.encode(encodeFcc(solution)); if (history && typeof history.replaceState === 'function') { history.replaceState( history.state, null, '?solution=' + codeUri.encode(encodeFcc(solution)) ); } else { location.hash = '?solution=' + codeUri.encode(encodeFcc(solution)); } return solution; },"} +{"_id":"q-en-freeCodeCamp-32d6a38a805eab9ae386ddfa001065b415fa319f5eac9f906df266db1735ea2c","text":"padding-bottom: 18px; background: transparent; border: none; text-align: left; } button.map-title:hover {"} +{"_id":"q-en-freeCodeCamp-3455f2d86b6c294419a19dfb9bb5ec7538045c513bb00afd04d0cd2b669018d7","text":"const searchButton = document.getElementById('search-button'); let alertMessage; window.alert = (message) => alertMessage = message; // Override alert and store message const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' const numbers = '0123456789'; const charactersLength = letters.length; const numbersLength = numbers.length; const firstLetter = letters.charAt(Math.floor(Math.random() * charactersLength)); const secondLetter = letters.charAt(Math.floor(Math.random() * charactersLength)); const thirdLetter = letters.charAt(Math.floor(Math.random() * charactersLength)); const fourthLetter = letters.charAt(Math.floor(Math.random() * charactersLength)); const randomNumber1 = numbers.charAt(Math.floor(Math.random() * numbersLength)); const randomNumber2 = numbers.charAt(Math.floor(Math.random() * numbersLength)); const badName = firstLetter + secondLetter + thirdLetter + fourthLetter + randomNumber1 + randomNumber2; const randomInvalidPokeId = badName; const randomInvalidPokeId = crypto.randomUUID().substring(0, 6); searchInput.value = randomInvalidPokeId; searchInput.dispatchEvent(new Event('change')); searchButton.click(); const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/' + randomInvalidPokeId.toString()); // Fetch from proxy to simulate network delay const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/' + randomInvalidPokeId); // Fetch from proxy to simulate network delay if (!res.ok) { await new Promise(resolve => setTimeout(resolve, 1000)); // Additional delay to allow the alert to trigger await new Promise(resolve => setTimeout(resolve, 2000)); // Additional delay to allow the alert to trigger assert.include(['pokémon not found', 'pokemon not found'], alertMessage.trim().replace(/[.,?!]+$/g, '').toLowerCase()); }"} +{"_id":"q-en-freeCodeCamp-347a7940f854f7324fd4e909a05d998bf8be66469bb0ec1c3832069086cf610b","text":"\"cert-map-estimates\": { \"certs\": \"认证(300 小时)\", \"coding-prep\": \"(数千小时的挑战)\" }, \"editor-tabs\": { \"info\": \"信息\", \"code\": \"码\", \"tests\": \"测验\", \"preview\": \"预习\" } }, \"donate\": {"} +{"_id":"q-en-freeCodeCamp-3545893c2df6f9b040b8909d06e6fb895d9134b148827f1219ece97c12772adf","text":"], \"tests\": [ \"assert(typeof timesFive === 'function', 'message: timesFive should be a function');\", \"assert(code.match(/timesFive(s*d+s*)/g), 'message: function timesFive should be called with a number');\", \"assert(code.match(/timesFive(s*d+s*)/g), 'message: function timesFive should be called with a number');\", \"assert(timesFive(5) === 25, 'message: timesFive(5) should return 25');\", \"assert(timesFive(2) === 10, 'message: timesFive(2) should return 10');\", \"assert(timesFive(0) === 0, 'message: timesFive(0) should return 0');\""} +{"_id":"q-en-freeCodeCamp-3a87b0cd876460cd27adf81e67874274ab3966f15fa0512a3761bd9437e9c244","text":"} .map-challenge-title { display: flex; margin-bottom: 0.25rem; max-width: calc(100% - 80px); max-width: calc(100% - 105px); } @media (max-width: 640px) { .map-ui .block ul { padding-inline-start: 6px; font-size: 0.9rem; } button.map-title { width: 100%; } .map-ui ul { padding-inline-start: 15px; } .map-ui > ul { padding-inline-start: 0; } .map-challenge-title { max-width: 100%; } .map-title-completed { flex-shrink: 0; padding-left: 15px; } } .block a { text-decoration: none; } /* 14px is the width of the expansion arrow */ .superblock { max-width: calc(100% - 14px); } "} +{"_id":"q-en-freeCodeCamp-3aad62b436343cbcc00b73544849cd53dc61cf070f06c96b83849a907da34c7e","text":"on: workflow_dispatch: schedule: # runs every weekday at 12:30 PM UTC - cron: '30 12 * * 1-5' # runs Monday and Wednesday at 12:15 PM UTC - cron: '15 12 * * 1,3' env: GITHUB_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}"} +{"_id":"q-en-freeCodeCamp-3bcdb5aa93cc8dfb9654d4775a542f35d4bef606a83bbcaec69b48a400b1aa59","text":"} = this.props; return ( editorRef={this.editorRef}
    executeChallenge={executeChallenge} innerRef={this.containerRef} introPath={introPath}"} +{"_id":"q-en-freeCodeCamp-3ca2c401db519a146ac9f21245ea028ff9cea21d434c024585d8dfbfa50c92a3","text":"# --description-- Below that conditional statement, add another conditional statement that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. Below that boolean expression, add another boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. # --hints-- You should have a conditional statement that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. You should have a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. ```js assert.match(code, /consts+collisionDetectionRuless*=s*[s*player.position.ys*+s*player.heights*<=s*platform.position.ys*,s*player.position.ys*+s*player.heights*+s*player.velocity.ys*>=s*platform.position.ys*,s*player.position.xs*>=s*platform.position.xs*-s*player.widths*/s*2,?s*]s*;?/);"} +{"_id":"q-en-freeCodeCamp-3e8314bd106f548181efd51c90017419bdddf10028d9d2187da22ad13fb86e82","text":"{ type: 'info', message: dedent` ${username} has chosen to make their profile private. They will need to make their profile public ${username} has chosen to make their portfolio private. They will need to make their portfolio public in order for others to be able to view their certification. ` }"} +{"_id":"q-en-freeCodeCamp-40f8330bf3622f0bd2aec93ed434bb105ec645d2a8a4c59e5a57591c638d6062","text":".tool-panel-group-mobile .btn-block + .btn-block { margin: 0 2px 0 0; padding-left: 8px; padding-right: 8px; }"} +{"_id":"q-en-freeCodeCamp-422c827e30abd36531088e0115a23146ee17b5b8ac516b68efed5e95abfc241c","text":"} return bookListCopy; } const newBookList = add(bookList, 'A Brief History of Time'); const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies'); const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies'); ```"} +{"_id":"q-en-freeCodeCamp-451b340ae8bc4cc14485952a5b23cbb6bf40cd2254c1d5d143a43718e20f4451","text":"\"Nest one div element with the class well within each of your col-xs-6 div elements.\" ], \"tests\": [ \"assert($(\"div\").length > 4, 'Add two div elements inside your div class=\"well\"> element both with the class col-xs-6')\", \"assert($(\"div\").length > 4, 'Add a div element with the class well inside each of your div class=\"col-xs-6\"> elements')\", \"assert($(\"div.col-xs-6\").children(\"div.well\").length > 1, 'Nest both of your div class=\"col-xs-6\" elements within your div class=\"row\" element.')\", \"assert(editor.match(/
    /g) && editor.match(/
    /g).length === editor.match(/
    div elements have closing tags.')\" ],"} +{"_id":"q-en-freeCodeCamp-48a451fa0147098f193b7ea4c2da6ec075a725f329fddf11a5e0de4bfd761489","text":"# --description-- Turn the words `cat photos` located inside `p` element into a link by replacing the words with the anchor element added previously. The `p` element should show the same text in the browser, but the words `cat photos` should now be a link. There should only be one link showing in the app. Turn the words `cat photos` located inside `p` element into a link using the same value for the `href` attribute as the link below the `p` element. The `p` element should show the same text in the browser, but the words `cat photos` should now be a link. Make sure to remove the `a` element with the text `cat photos` on the line below the `p` element. # --hints--"} +{"_id":"q-en-freeCodeCamp-4949220c061c39885f16b3ddb5c6c8bf630bde52451a5fcacaada343da7361ae","text":"} function pick(guess) { let numbers = []; const numbers = []; while (numbers.length < 10) { numbers.push(Math.floor(Math.random() * 11)); }"} +{"_id":"q-en-freeCodeCamp-498391d79773ae235a9284828de3c4ae5f0890d85ade2e27147b27a8d67d9d0a","text":".find('.map-title') .find('h4') .text() ).toBe('Super Block One Certification (300 hours)'); ).toBe('Super Block One Certification (300xa0hours)'); expect(enzymeWrapper.find('ul').length).toBe(0); enzymeWrapper.find('.map-title').simulate('click');"} +{"_id":"q-en-freeCodeCamp-498a167568bc9ebc4c1e6352b435d6bf61343d8e90e98be0ae826d61cb155f22","text":"'cert-map-estimates': { certs: 'Certification (300u00A0hours)', 'coding-prep': '(Thousands of hours of challenges)' }, 'editor-tabs': { info: 'Info', code: 'Code', tests: 'Tests', preview: 'Preview' } }, donate: {"} +{"_id":"q-en-freeCodeCamp-4a1e493a089a6d75ac6497646215d0985d474083de1dadc7c5134c61cda1a366","text":"Use the addition operator to concatenate a blank space `\" \"` to the beginning and end of your repeated `character` string. Remember that you can use the `+` operator to concatenate strings like this: ```js \" \" + \"string\" ``` # --hints-- You should concatenate an empty space to the beginning of your returned value."} +{"_id":"q-en-freeCodeCamp-4a3d4e5c4afc94fc3be8f59102136815d389a69d5c538c048c1f7d6e08a7ceac","text":"# --description-- **Objective:** Build an app that is functionally similar to this: https://codepen.io/freeCodeCamp/full/bgpXyK. **Objective:** Build an app that is functionally similar to this: https://scatterplot-graph.freecodecamp.rocks. Fulfill the below user stories and get all of the tests to pass. Use whichever libraries or APIs you need. Give it your own personal style."} +{"_id":"q-en-freeCodeCamp-4b824de3196c9ccb17e4a79d60dbac3c27b273219daf73135cc469a124079951","text":"); renderIsHonestAgreed = () => ( ); render() {"} +{"_id":"q-en-freeCodeCamp-4e56bb6832d49069e15e5909a2fde69cdb8d140db7f58d157fb7660dee521b99","text":" /** * Adapted from: * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML * Based on https://github.com/chriskempson/tomorrow-theme * @author Rose Pritchard */ .night code[class*='language-'], .night pre[class*='language-'] { color: #ccc; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; font-size: 1em; text-align: left; white-space: pre; word-spacing: normal; word-break: normal; word-wrap: normal; line-height: 1.5; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; hyphens: none; text-shadow: none; } .night pre[class*='language-'] code[class*='language-'] { color: #d4d4d4; } /* Code blocks */ .night pre[class*='language-'] { padding: 1em; margin: 0.5em 0; overflow: auto; } .night :not(pre) > code[class*='language-'], .night pre[class*='language-'] { background: #242424; } /* Inline code */ .night :not(pre) > code[class*='language-'] { padding: 0.1em; border-radius: 0.3em; white-space: normal; } .night .token.comment, .night .token.block-comment, .night .token.prolog, .night .token.doctype, .night .token.cdata { color: #608b4e; } .night .token.punctuation { color: #ffff00; } .night .token.tag, .night .token.attr-name, .night .token.namespace, .night .token.deleted { color: #e2777a; } .night .token.function-name { color: #d4d4d4; } .night .token.boolean, .night .token.number, .night .token.function { color: #569cd6; } .night .token.property, .night .token.class-name, .night .token.constant, .night .token.symbol { color: #f8c555; } .night .token.selector, .night .token.important, .night .token.atrule, .night .token.keyword, .night .token.builtin { color: #569cd6; } .night .token.string, .night .token.char, .night .token.attr-value, .night .token.regex, .night .token.variable { color: #7ec699; } .night .token.operator, .night .token.entity, .night .token.url { color: #67cdcc; background: none; } .night .token.important, .night .token.bold { font-weight: bold; } .night .token.italic { font-style: italic; } .night .token.entity { cursor: help; } .night .token.inserted { color: green; } "} +{"_id":"q-en-freeCodeCamp-50ee95a0dfcc65e7d578c7d93e18a3f73821def821763b555be3d60d090fb14d","text":"}; const mapStateToProps = createSelector( isDonationModalOpenSelector, userSelector, ({ theme = 'night' }) => ({ theme }) (open, { theme = 'night' }) => ({ canFocus: !open, theme }) ); const mapDispatchToProps = dispatch =>"} +{"_id":"q-en-freeCodeCamp-5140150bcf3149e6fa78c3dd7e715bb659de5ae81f50e569e449d9c7fa85c978","text":".find('.map-title') .find('h4') .text() ).toBe('Super Block One Certification (300 hours)'); ).toBe('Super Block One Certification (300xa0hours)'); expect(enzymeWrapper.find('ul').length).toBe(1); });"} +{"_id":"q-en-freeCodeCamp-516e2789e59d8bcaecb63eaa4fd205662b33807a11ed0a1cd4e22fc2d1999e0c","text":"editorDidMount = (editor, monaco) => { this._editor = editor; this._editor.focus(); if (this.props.canFocus) this._editor.focus(); this._editor.addAction({ id: 'execute-challenge', label: 'Run tests',"} +{"_id":"q-en-freeCodeCamp-53f9e32b634ce0abdf49373b032ea05585439dff628a16bc7dae1e5e2b5a51a5","text":"Your `` element should be nested in your `<head>` element. ```js <del> assert(code.match(/<head>s*<title>.*s*/i)); assert(code.match(/s*.*s*/si)); ``` Your `` element should have the text `Camper Cafe Menu`. You may need to check your spelling. ```js <del> assert(code.match(/<title>camperscafesmenu/i)); assert.match(document.querySelector('title')?.innerText, /camper cafe menu/i); ``` # --seed--"} +{"_id":"q-en-freeCodeCamp-540867b40d8e563c0bc53f2ed7b8cbc822e97a34b4d344ea88cf1acc6935ec66","text":"When a method returns a value, you can think of it as giving the value back to you, making it available for use in other parts of your code. Declare a `popped` variable, and assign it the result of `rows.pop()`. Then, log your `popped` variable. Create a new variable called `popped` and assign it the result of `rows.pop()`. Then, log `popped` to the console. # --hints-- You should declare a `popped` variable. You should declare a variable called `popped`. ```js assert.match(code, /popped/); ``` You should use `let` to declare your `popped` variable. You should use `let` to declare your variable called `popped`. ```js assert.match(code, /lets+popped/);"} +{"_id":"q-en-freeCodeCamp-544a74a169114e16ccd7737fe6a891713801008aad1eb0e4ddcf76158a960eca","text":"```js const splitter = code.split(\"if (this.position.x < this.width) {\") assert.match(splitter[1], /this.heights*=s*proportionalSize(s*d+s*)s*;?/); ``` You should assign `proportionalSize(40)` to the `height` property. ```js const splitter = code.split(\"if (this.position.x < this.width) {\") assert.match(splitter[1], /this.heights*=s*proportionalSize(s*40s*)s*;?/); ```"} +{"_id":"q-en-freeCodeCamp-54844e96bb6814ed64e45b87b40cc46d880e5aa9f334537683ff8d751eef456a","text":"if (element.type === FourOhFourPage) { return {element}; } if (/^/certification(/.*)*/.test(pathname)) { if (//certification//.test(pathname)) { return ( {element} ); } if (/^/guide(/.*)*/.test(pathname)) { if (//guide//.test(pathname)) { console.log('Hitting guide for some reason. Need a redirect.'); } const splitPath = pathname.split('/'); const splitPathThree = splitPath.length > 2 ? splitPath[3] : ''; const isSuperBlock = (splitPath.length === 3 && splitPath[1]) || (splitPath.length === 4 && splitPath[2]); const isNotSuperBlockIntro = splitPath.length > 3 && splitPathThree.length > 1; if (/^/learn(/.*)*/.test(pathname) && isNotSuperBlockIntro) { if (//learn//.test(pathname) && !isSuperBlock) { return ( {element}"} +{"_id":"q-en-freeCodeCamp-553ab982190dd44fb60b2bdcf14def37e543ece44d5de514361a064884f63613","text":"export function transformEditorLink(url) { return url .replace( /(?<=//)(?[^.]+).(?[^.]+).repl.co/?/, 'replit.com/@$/$' /(//)(?[^.]+).(?[^.]+).repl.co/?/, '//replit.com/@$/$' ) .replace( /(?<=//)(?[^.]+).glitch.me/?/, 'glitch.com/edit/#!/$' /(//)(?[^.]+).glitch.me/?/, '//glitch.com/edit/#!/$' ); }"} +{"_id":"q-en-freeCodeCamp-57b0017ddf357e664216a04023809217849ee8b405580cb146727d22f8dae46d","text":"assert.strictEqual(resultEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'eye is a palindrome'); ``` When the `#text-input` element contains the text `_eye` and the `#check-btn` element is clicked, the `#result` element should contain the text `eye is a palindrome`. When the `#text-input` element contains the text `_eye` and the `#check-btn` element is clicked, the `#result` element should contain the text `_eye is a palindrome`. ```js const inputEl = document.getElementById('text-input');"} +{"_id":"q-en-freeCodeCamp-5a9da76d4d3e91f9636b2d3a1ae6014421924b267867ad432f5fc0d127bf771d","text":"# --description-- Use `const` and arrow syntax to define a function called `setPlayButtonAccessibleText`. To make the application more accessible, it is important that the play button describes the current song or the first song in the playlist. This function will set the `aria-label` attribute to the current song, or to the first song in the playlist. And if the playlist is empty, it sets the `aria-label` to `\"Play\"`. Start by creating an empty arrow function called `setPlayButtonAccessibleText`. # --hints--"} +{"_id":"q-en-freeCodeCamp-5b0a204278c61e2359127b90f69757fe3751f8ba8543549f5a247ac29e448d18","text":"// all auth routes. fastify.addHook('onRequest', fastify.redirectIfSignedIn); fastify.get('/mobile-login', async req => { fastify.get('/mobile-login', async (req, reply) => { const email = await getEmailFromAuth0(req); await findOrCreateUser(fastify, email); if (!email) { return reply.status(401).send({ message: 'We could not log you in, please try again in a moment.', type: 'danger' }); } if (!isEmail(email)) { return reply.status(400).send({ message: 'The email is incorrectly formatted', type: 'danger' }); } const { id } = await findOrCreateUser(fastify, email); reply.setAccessTokenCookie(createAccessToken(id)); }); done();"} +{"_id":"q-en-freeCodeCamp-5ca4607b86ac9d67d795cf5016ab401437e8efb7809e1b03550a35496028649a","text":".table > tfoot > tr > td { border: none; } .modal { overflow-y: auto; } "} +{"_id":"q-en-freeCodeCamp-5ca69c2f35a2742cf0a2d83f8cb8df0d99b7d99f67a6b5f7fb9f75688d5e5cc0","text":"// eslint-disable-next-line max-len it('Worker executor should successfully execute 3 tasks in parallel and use 3 workers', async () => { mockWorker(); const testWorker = createWorker('test', { concurrency: 3 }); const testWorker = createWorker('test', { maxWorkers: 3 }); const task1 = testWorker.execute('test1'); const task2 = testWorker.execute('test2');"} +{"_id":"q-en-freeCodeCamp-5cdfcc127684a1b331d967ae6aa386f5fb0022f8f0090da1efd330acbe7e0c57","text":"Here you'll build a cash register app that will return change to the customer based on the price of the item, the amount of cash provided by the customer, and the amount of cash in the cash drawer. You'll also need to show different messages to the user in different scenarios, such as when the customer provides too little cash or when the cash drawer doesn't have enough to issue the correct change. There are a few variables you'll need to use in your code: In the `script.js` file, you have been provided with the `price` and `cid` variables. The `price` variable is the price of the item, and the `cid` variable is the cash-in-drawer, which is a 2D array listing the available currency in the cash drawer. - `price`: the price of the item as a floating point number. - `cash`: the amount of cash provided by the customer for the item, which is provided via an `input` element on the page. - `cid`: cash-in-drawer, a 2D array listing available currency in the cash drawer. The other variable you will need add is the `cash` variable, which is the amount of cash provided by the customer for the item, which is provided via an `input` element on the page. If you'd like to test your application with different values for `price` and `cid`, make sure to declare them with the `let` keyword so they can be reassigned by our tests."} +{"_id":"q-en-freeCodeCamp-5d2f1cac474bf2142efa1c407b0584cf764bb893d13b375142cfdd205557cd49","text":"

    {username} has not made their profile public. {username} has not made their portfolio public.

    {username} needs to change their privacy setting in order for you to view their profile. view their portfolio.

    "} +{"_id":"q-en-freeCodeCamp-5e9184a85489f8e293b9ccc795161b1e0a8d3ec64795244cf38d4ebde353d607","text":"#challenge-page-tabs .nav-tabs > li > a { padding: 5px 10px; text-decoration: none; font-size: 0.8em; } #challenge-page-tabs .tab-content {"} +{"_id":"q-en-freeCodeCamp-5f3fa8d85f11898d591bef2d7e015e69eb1a4ee7328e5b5e0334d6a6afb5622a","text":"var test = new LinkedList(); test.add('cat'); test.add('dog'); return test.head().next.element === 'dog'; test.add('fish'); return test.head().next.element === 'dog' && test.head().next.next.element === 'fish'; })() ); ```"} +{"_id":"q-en-freeCodeCamp-61524963d9213b1ac39671c6491473321f23ef9c438aceae9eebc88ff2c4e764","text":"} .form-control { color: var(--theme-color); color: var(--primary-color); outline: none; border-color: var(--quaternary-background); background-color: var(--primary-background); -webkit-box-shadow: none !important; -moz-box-shadow: none !important; box-shadow: none !important;"} +{"_id":"q-en-freeCodeCamp-61aa1d6fe0327e8f49bcc8c2379eb2f0e837050569e31c3531096d3fd20399da","text":"openHelpModal={props.openHelpModal} openResetModal={props.openResetModal} tryToExecuteChallenge={tryToExecuteChallenge} hint={firstFailedTest?.text} hint={firstFailedTest?.message} testsLength={props.tests.length} attempts={attemptsRef.current} challengeIsCompleted={challengeIsComplete()}"} +{"_id":"q-en-freeCodeCamp-629a7dd0100564ea347696aad9c0c05b6cf454547499fe1363396fffefdc4882","text":" // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` snapshot when isHonest is false: Honesty 1`] = `
    Academic Honesty Policy
    `; exports[` snapshot when isHonest is true: HonestyAccepted 1`] = `
    Academic Honesty Policy
    `;
    "} +{"_id":"q-en-freeCodeCamp-633d1246569e890793bdc2a0e8913c9d13d07982c8e37018ff838a4e70e85475","text":"This will open the user management tools, you will be able to see the list of all the users. Search for the user that will become contributor. Use the three dots menu on the user row to open a menu and select \"Add to team\". The proofreader teams have a standard name of `Proof Readers ()`, you can search the team using the language name. Once you have selected the team, use the \"ADD\" button at the bottom of the page to finalize the thing. Search for the user that will become proofreader. Use the three dots menu on the user row to open a menu and select \"Add to team\". The proofreader teams have a standard name of `Proof Readers ()`, you can search the team using the language name. Once you have selected the team, use the \"ADD\" button at the bottom of the page to finalize the thing. The user is now a proofreader."} +{"_id":"q-en-freeCodeCamp-6751a6f292c6c56bccabd46abe6d9336e65bfdb6cd6db6508d1fceadff9123fd","text":"id='challenge-page-tabs' onSelect={moveToTab} > {instructions} "} +{"_id":"q-en-freeCodeCamp-68bedfe13eaf777533544616749de5a42a8ce86fa84f3d68ffcdb5a7e601a531","text":"Which starting number, under the given `limit`, produces the longest chain? **Note:** Once the chain starts the terms are allowed to go above one million. **Note:** Once the chain starts the terms are allowed to go above `limit`. # --hints--"} +{"_id":"q-en-freeCodeCamp-6b9b29dbb37f7cdad106a8553d815de68e5cc9d9f72eba798e39d72efba8a7cf","text":"height: 100%; overflow: hidden; } #challenge-page-tabs a { text-decoration: none; } #challenge-page-tabs a:hover { color: var(--secondary-background); #challenge-page-tabs .nav-tabs > li.active > a { color: var(--quaternary-color); background-color: var(--quaternary-background); }"} +{"_id":"q-en-freeCodeCamp-6c6d546c6eb1b68a0a300eddd5a4c59ea7c973405fa140fef390226cb52a370f","text":".map-title-completed { margin-left: auto; width: 100px; min-width: 100px; padding-left: 20px; }"} +{"_id":"q-en-freeCodeCamp-6ce19a389989e8872e917d8a93ce246cd4be2e643d7bf487d2ecddbd00543017","text":"id='challenge-page-tabs' onSelect={moveToTab} > {instructions} {showUpcomingChanges && } {editor} {testOutput} {hasPreview && ( {preview} )}"} +{"_id":"q-en-freeCodeCamp-6d3a600723d1929e68ad748cbf975327ffbdaed7be0d7e9c27b694c516fd88aa","text":"# --hints-- There should be an `img` element right above the second `section` element's closing tag. There should be an `img` element right after the closing `` tag. ```js assert($('section')[1].lastElementChild.nodeName === 'IMG');"} +{"_id":"q-en-freeCodeCamp-6e83255159092eecf61dde89628c24c347e5a6381a530fb8abe220c777572048","text":".scene-wrapper { overflow: hidden; position: relative; color: var(--gray-00); } .scene-start-screen {"} +{"_id":"q-en-freeCodeCamp-6ede35176b133bed5548bc2c54e5ba82c0fe01faad083ac5ab39f33c6f7eda33","text":"id: 587d778b367417b2b2512aa8 title: Add an Accessible Date Picker challengeType: 0 videoUrl: 'https://scrimba.com/c/cD9DJHr' videoUrl: 'https://scrimba.com/c/cR3bRbCV' --- ## Description"} +{"_id":"q-en-freeCodeCamp-6f8c9d014df3f93aa04d1d8c6f156a0cce36944ed5ca31b7f9d87998ab6fb899","text":"} } focusOnEditor() { this._editor.focus(); } onChange = editorValue => { const { updateFile, fileKey } = this.props; updateFile({ key: fileKey, editorValue });"} +{"_id":"q-en-freeCodeCamp-704828b50424d3decb27a0e7f79576f4af5d0563e0c86bcf6db0c8c3de5d2261","text":"return (

    Before we issue our verified certification to a camper, he or she must accept our Academic Honesty Pledge, which reads: Before you can claim a verified certification, you must accept our Academic Honesty Pledge, which reads:

    \"I understand that plagiarism means copying someone else’s work and"} +{"_id":"q-en-freeCodeCamp-721dada2aca92efc07f0b73f8912fddeceee56cdce285fdf7cc4a732c1882c62","text":"}, timeout); worker.onmessage = e => { if (e.data && e.data.type) { clearTimeout(timeoutId); // data.type is undefined when the message has been processed // successfully and defined when something else has happened (e.g. // an error occurred) if (e.data?.type) { this.emit(e.data.type, e.data.data); return; } else { this.emit('done', e.data); } clearTimeout(timeoutId); this.emit('done', e.data); }; worker.onerror = e => {"} +{"_id":"q-en-freeCodeCamp-7247e86453a7e100b5758504925d65575f9196183c23c89bf68c52425f02f100","text":"assert.match(calculateCalories.toString(), /document.querySelectorAll(s*('|\")#breakfast input[s*type=numbers*]s*1s*)/); ``` You should assign the result of your `odocument.querySelectorAll()` call to `breakfastNumberInputs`. You should assign the result of your `document.querySelectorAll()` call to `breakfastNumberInputs`. ```js assert.match(calculateCalories.toString(), /breakfastNumberInputss*=s*document.querySelectorAll(s*('|\")#breakfast input[s*type=numbers*]s*1s*)/);"} +{"_id":"q-en-freeCodeCamp-72c7af0aab29a7c5784d4c077e5c7cf824e3f534bbb2bb380658f7a53cdc8b1c","text":"class WorkerExecutor { constructor( workerName, { location = '/js/', concurrency = 2, terminateWorker = false } = {} { location = '/js/', maxWorkers = 2, terminateWorker = false } = {} ) { this._workerName = workerName; this._workers = []; this._queue = []; this._running = 0; this._concurrency = concurrency; this._workerPool = []; this._taskQueue = []; this._workersInUse = 0; this._maxWorkers = maxWorkers; this._terminateWorker = terminateWorker; this._location = location; this._scriptURL = `${location}${workerName}.js`; this._getWorker = this._getWorker.bind(this); } async _getWorker() { let worker; if (this._workers.length) { worker = this._workers.shift(); } else { worker = await new Promise((resolve, reject) => { const worker = new Worker(`${this._location}${this._workerName}.js`); worker.onmessage = e => { if (e.data && e.data.type && e.data.type === 'contentLoaded') { resolve(worker); } }; worker.onerror = err => reject(err); }); } return worker; return this._workerPool.length ? this._workerPool.shift() : this._createWorker(); } _pushTask(task) { this._queue.push(task); this._next(); _createWorker() { return new Promise((resolve, reject) => { const newWorker = new Worker(this._scriptURL); newWorker.onmessage = e => { if (e.data?.type === 'contentLoaded') { resolve(newWorker); } }; newWorker.onerror = err => reject(err); }); } _handleTaskEnd(task) { return () => { this._running--; if (task._worker) { const worker = task._worker; this._workersInUse--; const worker = task._worker; if (worker) { if (this._terminateWorker) { worker.terminate(); } else { worker.onmessage = null; worker.onerror = null; this._workers.push(worker); this._workerPool.push(worker); } } this._next(); this._processQueue(); }; } _next() { while (this._running < this._concurrency && this._queue.length) { const task = this._queue.shift(); _processQueue() { while (this._workersInUse < this._maxWorkers && this._taskQueue.length) { const task = this._taskQueue.shift(); const handleTaskEnd = this._handleTaskEnd(task); task._execute(this._getWorker).done.then(handleTaskEnd, handleTaskEnd); this._running++; this._workersInUse++; } }"} +{"_id":"q-en-freeCodeCamp-7674d29d821eff830e67145efc202723b4e922df854cc62f7af427aecf33b761","text":"The `rem` unit stands for `root em`, and is relative to the font size of the `html` element. Create an `.small-text` selector and set the `font-size` to `0.85rem`, which would calculate to be roughly `13.6px` (remember that you set your `html` to have a `font-size` of `16px`). Create a `.small-text` selector and set the `font-size` to `0.85rem`, which would calculate to roughly `13.6px` (remember that you set your `html` to have a `font-size` of `16px`). # --hints--"} +{"_id":"q-en-freeCodeCamp-77e93586eda19a711b3f60d1b26499c484c767dea680546261ae5ed7dbd905e1","text":"# --description-- Add another conditional statement that checks if the sum of the player's `y` position, height, and `y` velocity is greater than or equal to the platform's `y` position. Add another boolean expression that checks if the sum of the player's `y` position, height, and `y` velocity is greater than or equal to the platform's `y` position. # --hints-- You should have a conditional statement that checks if the sum of the player's `y` position, height, and `y` velocity is greater than or equal to the platform's `y` position. You should have a boolean expression that checks if the sum of the player's `y` position, height, and `y` velocity is greater than or equal to the platform's `y` position. ```js"} +{"_id":"q-en-freeCodeCamp-792fdc96e5461e88faa66584efb2e12ef40dd20282532e6e4ef086625e565bd7","text":"\"Try creating one of each.\" ], \"tests\":[ \"assert(editor.getValue().match(/(//)...../g), 'Create a // style comment that contains at least five letters');\", \"assert(editor.getValue().match(/(/*)...../g), 'Create a /* */ style comment that contains at least five letters.');\", \"assert(editor.getValue().match(/(*/)/g), 'Make sure that you close the comment with a */');\" \"assert(editor.getValue().match(/(//)...../g), 'Create a // style comment that contains at least five letters');\", \"assert(editor.getValue().match(/(/*)[wW]{5,}(?=*/)/gm), 'Create a /* */ style comment that contains at least five letters.');\", \"assert(editor.getValue().match(/(*/)/g), 'Make sure that you close the comment with a */');\" ], \"challengeSeed\":[ ],"} +{"_id":"q-en-freeCodeCamp-7936788ce1f56f21685551815bfd3108e2e3c361d3e333fd1bc9ffe56a8a9cf5","text":" /* global expect jest */ import React from 'react'; import ShallowRenderer from 'react-test-renderer/shallow'; import TestRenderer from 'react-test-renderer'; import Honesty from './Honesty'; import { Button } from '@freecodecamp/react-bootstrap'; describe('', () => { const renderer = new ShallowRenderer(); const updateIsHonestMock = jest.fn(); test(' snapshot when isHonest is false', () => { const componentToRender = ( ); const component = renderer.render(componentToRender); expect(component).toMatchSnapshot('Honesty'); }); test(' snapshot when isHonest is true', () => { const componentToRender = ( ); const component = renderer.render(componentToRender); expect(component).toMatchSnapshot('HonestyAccepted'); }); test('should call updateIsHonest method on clicking agree button', () => { const root = TestRenderer.create( ).root; root.findByType(Button).props.onClick(); expect(updateIsHonestMock).toHaveBeenCalledWith({ isHonest: true }); }); }); "} +{"_id":"q-en-freeCodeCamp-7d8f7825da7c622951b5d05717deffc139080a810700edc258d24aa5298c6ef7","text":"

    In the situations where we discover instances of unambiguous plagiarism, we will replace the camper in question’s certification with a message we will replace the person in question’s certification with a message that \"Upon review, this account has been flagged for academic dishonesty.\"

    "} +{"_id":"q-en-freeCodeCamp-7e7293c1ab06f77fd0b042c9e8fc1d6ec68fa6cab7c3f020e61ef0ec2434cc9f","text":"`); } catch (err) { if (__userCodeWasExecuted) { // rethrow error, since test failed. throw err; } else { // report errors to dev console (not the editor console, since the test // may still pass) __utils.oldLog(err); } testResult = eval(e.data.testString); }"} +{"_id":"q-en-freeCodeCamp-7fbe1712d4107e79c1ea2a3de494a4b91d8db96f471b9d2a37b54b5fbe50e37f","text":"function Hotkeys({ canFocusEditor, children, editorRef, executeChallenge, introPath, innerRef,"} +{"_id":"q-en-freeCodeCamp-7fbf740543d7f284d0d0212a3479eeb247329026fdf5ee85ddbc06f4f34f1ab5","text":"`myVar = myVar - 1;` should be changed. ```js assert( /lets*myVars*=s*11;s*/*.*s*([-]{2}s*myVar|myVars*[-]{2});/.test(code) ); assert(!code.match(/myVars*=s*myVars*[-]s*1.*?;?/)); ``` You should not assign `myVar` with `10`. ```js assert(!code.match(/myVars*=s*10.*?;?/)); ``` You should use the `--` operator on `myVar`."} +{"_id":"q-en-freeCodeCamp-8045111be225a1d07a8c573e7d1088e45ad12396c91e9907c8c798f7a3c7098e","text":"# --description-- Use the `join()` method to combine the `songsHTML` markup into a single string. Right now the `songsHTML` is an array. If you tried to display this as is, you would see the songs separated by commas. This is not the desired outcome because you want to display the songs as a list. To fix this, you will need to join the array into a single string by using the join() method. The `join()` method is used to concatenate all the elements of an array into a single string. It takes an optional parameter called `separator` which is used to separate each element of the array. For example: The `join()` method is used to concatenate all the elements of an array into a single string. It takes an optional parameter called a `separator` which is used to separate each element of the array. For example: ```js const exampleArr = [\"This\", \"is\", \"a\", \"sentence\"];"} +{"_id":"q-en-freeCodeCamp-84e91f4ad69ef998f4909e4a27d93e73cc2522aa841579595ca1fea1938618f5","text":"--fcc-editable-region-- function pick(guess) { let numbers = []; const numbers = []; while (numbers.length < 10) { numbers.push(Math.floor(Math.random() * 11)); }"} +{"_id":"q-en-freeCodeCamp-8751883c9e6d79d55e0c5d6fc77790dcce695a120d27418e01253a7be408129b","text":".once('error', err => reject(err.message)); }); this._pushTask(task); this._taskQueue.push(task); this._processQueue(); return task; } } // Error and completion handling const eventify = self => { self._events = {};"} +{"_id":"q-en-freeCodeCamp-87a48cacd457c74c5f0c0dd8d3dabd20a47fe742b34591cd968f65c4734186db","text":"
    此指南可阅读的语言版本 Read these guidelines in English 中文 русский عربي Español 中文 Português Русский Español Ελληνικά
    "} +{"_id":"q-en-freeCodeCamp-88d870c03f4b510a9fc91c5497ccfc62a7abc9f06fca5425acd87443abb72029","text":"\"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');\", \"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return cthe last chunk as remaining elements');\" \"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');\" ] }, {"} +{"_id":"q-en-freeCodeCamp-890cd2e7eec375d5481b3ea55371c5609b935c8d42d4c5b73cdf7badfcb241fd","text":"## --sentence-- `_ to _ you all. I'm David, the project _ from FCC _.` `_ to _ you all. I'm David, the project _ from FCC _` ## --blanks--"} +{"_id":"q-en-freeCodeCamp-8c663fbc2424d49ffceda18cccda30999f75260b2a20d71eda722b46e182e100","text":"className=\"spacer\" style={ { \"height\": \"1px\", \"padding\": \"5px 0\", } }"} +{"_id":"q-en-freeCodeCamp-8dd68b874a9bd5c36fe29d682013497115f9d58176c92caccc7e44eccc592d4d","text":"\"// Only change code above this line.\", \"// We use this function to show you the value of your variable in your output box.\", \"// You'll learn about functions soon.\", \"if(typeof(myArray) !== \"undefined\" && typeof(data) !== \"undefined\"){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', data = ' + JSON.stringify(z));})(myArray, data);}\" \"if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z));})(myArray, myData);}\" ], \"type\": \"waypoint\", \"challengeType\": 1"} +{"_id":"q-en-freeCodeCamp-8dde42ad3474ee8e84c570d51111fedc67514919f6bed769abdf64becd5d5740","text":"# --description-- Within the arrow function of the event listener, add an `if` to check if `userData?.currentSong` is `falsey`. Within the arrow function of the event listener, add an `if` to check if `userData?.currentSong` is `null`. Inside the `if` block, call the `playSong()` function with the `id` of the first song in the `userData?.songs` array. This will ensure the first song in the playlist is played first. # --hints-- You should create an `if` statement with the condition `!userData?.currentSong`. You should create an `if` statement with the condition `userData?.currentSong === null`. ```js assert.match(code, /ifs*((s*!userData?.currentSongs*|s*userData?.currentSongs*===s*nulls*|s*userData?.currentSongs*===s*undefineds*))s*{/) assert.match(code, /ifs*(s*userData?.currentSongs*===s*nulls*)s*{/); ``` You should call the `playSong` function with `userData?.songs[0].id` inside your `if` block. ```js assert.match(code, /ifs*((s*!userData?.currentSongs*|s*userData?.currentSongs*===s*nulls*|s*userData?.currentSongs*===s*undefineds*))s*{s*playSong(s*userData?.songss*[s*0s*]s*.ids*)s*;?s*}/) assert.match(code, /ifs*(s*userData?.currentSongs*===s*nulls*)s*{s*playSong(s*userData?.songss*[s*0s*]s*.ids*)s*;?s*}/); ``` # --seed--"} +{"_id":"q-en-freeCodeCamp-92f53e34cb3889d635801afaf0fd636f701d594a8ac8a4afc9a0f74bb098f2d8","text":">

    Super Block One Certification (300 hours) Super Block One Certification (300 hours)

      "} +{"_id":"q-en-freeCodeCamp-93bbbb6646f18cb87b721b5526fa566a204792738692b6c676d6b26bf5d7fecf","text":"You also need to get the value of your `#budget` input. You already queried this at the top of your code, and set it to the `budgetNumberInput` variable. However, you used `getElementById`, which returns an `Element`, not a `NodeList`. A `NodeList` is an array-like, which means you can iterate through it and it shares some common methods with an array. For your `getCaloriesFromInputs` function, an array will work for the argument just as well as a `NodeList` does. A `NodeList` is an array-like object, which means you can iterate through it and it shares some common methods with an array. For your `getCaloriesFromInputs` function, an array will work for the argument just as well as a `NodeList` does. Declare a `budgetCalories` variable and set it to the result of calling `getCaloriesFromInputs` – pass an array containing your `budgetNumberInput` as the argument."} +{"_id":"q-en-freeCodeCamp-944439d31b666a831932cbfc42c5991ef287f232766dfa9a8e69170643094290","text":"padding-top: 15px; } .honesty-policy .agreed { display: flex; justify-content: center; align-items: center; background-color: var(--quaternary-color); color: #fff; } div .agreed p { color: white; } .honesty-policy .agreed p { .honesty-policy .disabled-agreed p { margin-top: 0; margin-bottom: 0; }"} +{"_id":"q-en-freeCodeCamp-9853f84866eb2ba8b031d87436f3a62045bf393730bdaea843ee94b4bbbb4a14","text":"Editor.displayName = 'Editor'; Editor.propTypes = propTypes; // NOTE: withRef gets replaced by forwardRef in react-redux 6, // https://github.com/reduxjs/react-redux/releases/tag/v6.0.0 export default connect( mapStateToProps, mapDispatchToProps mapDispatchToProps, null, { withRef: true } )(Editor);"} +{"_id":"q-en-freeCodeCamp-99b10fdd27764e9a299e15c70857343514545c6703f27110e1f04896650b6da2","text":"}; ``` When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the `#types` element should contain two inner elements with the text values `GHOST` and `POISON`, respectively. Make sure the `#type` element content is cleared between searches. When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the `#types` element should contain two inner elements with the text values `GHOST` and `POISON`, respectively. Make sure the `#types` element content is cleared between searches. ```js async () => {"} +{"_id":"q-en-freeCodeCamp-9a0b7a65d9f8ab83d19d1271c926c80adaf2b03d4c22d8cd163fd2e1d6311c3f","text":"challengeFile && ( ref={this.editorRef} {...challengeFile} fileKey={challengeFile.key} />"} +{"_id":"q-en-freeCodeCamp-9bf42eabd9cd044ff84bc96833a33fbcef7e8ab459a3252766367123545ba6c6","text":"on: workflow_dispatch: schedule: # runs every weekday at 12:00 noon UTC - cron: '0 12 * * 1-5' # runs Monday and Wednesday at 12:15 PM UTC - cron: '15 12 * * 1,3' env: GITHUB_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}"} +{"_id":"q-en-freeCodeCamp-9e3c60a71e6983977784146ff6f09e24344a004be9766870052c10d924a04c80","text":"export type Test = { pass?: boolean; err?: string; message?: string; } & (ChallengeTest | CertTest); export type ChallengeTest = {"} +{"_id":"q-en-freeCodeCamp-a025f1281a4228a281593c9d19f5e57548e8d6b0b5d445be8215fe1c5e75ee89","text":"}; ``` When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the `#types` element should contain a single inner element with the value `ELECTRIC`. Make sure the `#type` element content is cleared between searches. When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the `#types` element should contain a single inner element with the value `ELECTRIC`. Make sure the `#types` element content is cleared between searches. ```js async () => {"} +{"_id":"q-en-freeCodeCamp-a2c0f37dc9a2a4f481386b3a48d730f9264847a2cf2124690ffd2fb52f531ae7","text":".tool-panel-group-mobile button, .tool-panel-group-mobile a { font-size: 16px; font-size: 0.8rem; } .tool-panel-group-mobile {"} +{"_id":"q-en-freeCodeCamp-a6332f034708b7b2bcf4b37500b8065f237921be604fd8cc807aeef3c0cc2e11","text":"Inside the callback function, create a new `const` variable called `collisionDetectionRules` and assign it an empty array. Inside that array, add a conditional statement that checks if the player's `y` position plus the player's height is less than or equal to the platform's `y` position. Inside that array, add a boolean expression that checks if the player's `y` position plus the player's height is less than or equal to the platform's `y` position. # --hints--"} +{"_id":"q-en-freeCodeCamp-a9fcf30048364f5f6d1fd803694e41189c85239ec4e78268aa438b3e6aa45002","text":"/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { setupServer, superRequest } from '../../jest.utils'; import { setupServer, superRequest, createSuperRequest } from '../../jest.utils'; import { AUTH0_DOMAIN } from '../utils/env'; const mockedFetch = jest.fn(); jest.spyOn(globalThis, 'fetch').mockImplementation(mockedFetch); const newUserEmail = 'a.n.random@user.com'; const mockAuth0NotOk = () => ({ ok: false }); const mockAuth0InvalidEmail = () => ({ ok: true, json: () => ({ email: 'invalid-email' }) }); const mockAuth0ValidEmail = () => ({ ok: true, json: () => ({ email: newUserEmail }) }); jest.mock('../utils/env', () => { // eslint-disable-next-line @typescript-eslint/no-unsafe-return return {"} +{"_id":"q-en-freeCodeCamp-aa114097567e0ac023bc97f25fe1725038da06a6b075497b4b0292e6abbb437c","text":"export const handleRequest = (makeRequest: () => Promise) => () => { makeRequest() .then(res => res.json() as Promise<{ stdout: string; stderr: string }>) .then(data => alert(JSON.stringify(data))) .then( res => res.json() as Promise<{ stdout?: string; stderr?: string; message?: string; }> ) .then(data => { if (data.message) { alert(data.message); } else { alert(JSON.stringify(data)); } }) .catch(err => console.error(err)); };"} +{"_id":"q-en-freeCodeCamp-aa500c433f71ec9aa011f911966598d871695b0bfae55cd0a02fecbf2d333678","text":"], \"tests\": [ [ \"Algorithms expressed exponentially like O(N^2) can work well in certain situations, so you shouldn't avoid them completely.\", \"Algorithms expressed exponentially like O(C^N), where C is a constant can work well in certain situations, so you shouldn't avoid them completely.\", false, \"While they can work in certain small scale situations, they aren't good practice because they will not work larger scale.\" ],"} +{"_id":"q-en-freeCodeCamp-ac8478440e9836c7cbf6763c48c25b0b2e7dabe8dd770cb647a077b4376b3bef","text":"
    style=\"padding: 15px 0px; height: 1px;\" style=\"padding: 15px 0px;\" />
    this.editorRef = React.createRef(); } onResize() { this.setState({ resizing: true });"} +{"_id":"q-en-freeCodeCamp-af1a927d1cb777360644472e238a0b9e13cee901b7fe92db853834b4b819eca4","text":" import React, { Fragment } from 'react'; import React, { Fragment, Component } from 'react'; import Prism from 'prismjs'; import PropTypes from 'prop-types'; import './challenge-description.css';"} +{"_id":"q-en-freeCodeCamp-af1af77476f5d443845029242e0caf671c10b3f7110edb4f85baea25e3c5689b","text":"} const onChange = (editorValue: string) => { const { updateFile, fileKey } = props; const { updateFile, fileKey, isResetting } = props; if (isResetting) return; // TODO: now that we have getCurrentEditableRegion, should the overlays // follow that directly? We could subscribe to changes to that and redraw if // those imply that the positions have changed (i.e. if the content height"} +{"_id":"q-en-freeCodeCamp-af740a40e8e683fc8cd53f86af7034b575f2b8b200d8dbbecbdf65d95cd5ad3d","text":"function createSuperBlockTitle(str) { return codingPrepRE.test(str) ? `${str} (Thousands of hours of challenges)` : `${str} Certification (300 hours)`; : `${str} Certification (300xa0hours)`; } export class SuperBlock extends Component {"} +{"_id":"q-en-freeCodeCamp-b094147798517de9ee92d01edea5c97befc5dabc7e1b08b3a1ff2b94a70b1396","text":"# --description-- **Objective:** Build an app that is functionally similar to this: https://codepen.io/freeCodeCamp/full/KaNGNR. **Objective:** Build an app that is functionally similar to this: https://treemap-diagram.freecodecamp.rocks. Fulfill the below user stories and get all of the tests to pass. Use whichever libraries or APIs you need. Give it your own personal style."} +{"_id":"q-en-freeCodeCamp-b0c2c3555e79a1da7f275b5e22c4e839d074a957b6d26ae0c962deafecaa4f45","text":"\"assert.strictEqual(Enzyme.mount(React.createElement(MagicEightBall)).children().childAt(2).name(), 'button', 'message: MagicEightBall's third child should be a button element.');\", \"assert(Enzyme.mount(React.createElement(MagicEightBall)).state('randomIndex') === '' && Enzyme.mount(React.createElement(MagicEightBall)).state('userInput') === '', 'message: MagicEightBall's state should be initialized with a property of userInput and a property of randomIndex both set to a value of an empty string.');\", \"assert(Enzyme.mount(React.createElement(MagicEightBall)).find('p').length === 1 && Enzyme.mount(React.createElement(MagicEightBall)).find('p').text() === '', 'message: When MagicEightBall is first mounted to the DOM, it should return an empty p element.');\", \"async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const comp = Enzyme.mount(React.createElement(MagicEightBall)); const simulate = () => { comp.find('input').simulate('change', { target: { value: 'test?' }}); comp.find('button').simulate('click'); }; const result = () => comp.find('p').text(); const _1 = () => { simulate(); return waitForIt(() => result()) }; const _2 = () => { simulate(); return waitForIt(() => result()) }; const _3 = () => { simulate(); return waitForIt(() => result()) }; const _4 = () => { simulate(); return waitForIt(() => result()) }; const _5 = () => { simulate(); return waitForIt(() => result()) }; const _6 = () => { simulate(); return waitForIt(() => result()) }; const _7 = () => { simulate(); return waitForIt(() => result()) }; const _8 = () => { simulate(); return waitForIt(() => result()) }; const _9 = () => { simulate(); return waitForIt(() => result()) }; const _10 = () => { simulate(); return waitForIt(() => result()) }; const _1_val = await _1(); const _2_val = await _2(); const _3_val = await _3(); const _4_val = await _4(); const _5_val = await _5(); const _6_val = await _6(); const _7_val = await _7(); const _8_val = await _8(); const _9_val = await _9(); const _10_val = await _10(); const actualAnswers = [_1_val, _2_val, _3_val, _4_val, _5_val, _6_val, _7_val, _8_val, _9_val, _10_val]; const hasIndex = actualAnswers.filter((answer, i) => possibleAnswers.indexOf(answer) !== -1); const notAllEqual = new Set(actualAnswers); assert(notAllEqual.size > 1 && hasIndex.length === 10, 'message: When text is entered into the input element and the button is clicked, the MagicEightBall component should return a p element that contains a random element from the possibleAnswers array.'); \" \"async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const comp = Enzyme.mount(React.createElement(MagicEightBall)); const simulate = () => { comp.find('input').simulate('change', { target: { value: 'test?' }}); comp.find('button').simulate('click'); }; const result = () => comp.find('p').text(); const _1 = () => { simulate(); return waitForIt(() => result()) }; const _2 = () => { simulate(); return waitForIt(() => result()) }; const _3 = () => { simulate(); return waitForIt(() => result()) }; const _4 = () => { simulate(); return waitForIt(() => result()) }; const _5 = () => { simulate(); return waitForIt(() => result()) }; const _6 = () => { simulate(); return waitForIt(() => result()) }; const _7 = () => { simulate(); return waitForIt(() => result()) }; const _8 = () => { simulate(); return waitForIt(() => result()) }; const _9 = () => { simulate(); return waitForIt(() => result()) }; const _10 = () => { simulate(); return waitForIt(() => result()) }; const _1_val = await _1(); const _2_val = await _2(); const _3_val = await _3(); const _4_val = await _4(); const _5_val = await _5(); const _6_val = await _6(); const _7_val = await _7(); const _8_val = await _8(); const _9_val = await _9(); const _10_val = await _10(); const actualAnswers = [_1_val, _2_val, _3_val, _4_val, _5_val, _6_val, _7_val, _8_val, _9_val, _10_val]; const hasIndex = actualAnswers.filter((answer, i) => possibleAnswers.indexOf(answer) !== -1); const notAllEqual = new Set(actualAnswers); assert(notAllEqual.size > 1 && hasIndex.length === 10, 'message: When text is entered into the input element and the button is clicked, the MagicEightBall component should return a p element that contains a random element from the possibleAnswers array.');}\" ], \"solutions\": [ \"nconst inputStyle = {n width: 235,n margin: 5n}nnclass MagicEightBall extends React.Component {n constructor(props) {n super(props);n this.state = {n userInput: '',n randomIndex: ''n }n this.ask = this.ask.bind(this);n this.handleChange = this.handleChange.bind(this);n }n ask() {n if (this.state.userInput) {n this.setState({n randomIndex: Math.floor(Math.random() * 20),n userInput: ''n });n }n }n handleChange(event) {n this.setState({n userInput: event.target.valuen });n }n render() {n const possibleAnswers = [n \"It is certain\", \"It is decidedly so\", \"Without a doubt\",n \"Yes, definitely\", \"You may rely on it\", \"As I see it, yes\",n \"Outlook good\", \"Yes\", \"Signs point to yes\", \"Reply hazy try again\",n \"Ask again later\", \"Better not tell you now\", \"Cannot predict now\",n \"Concentrate and ask again\", \"Don't count on it\", \"My reply is no\",n \"My sources say no\", \"Outlook not so good\",\"Very doubtful\", \"Most likely\"n ];n const answer = possibleAnswers[this.state.randomIndex];n return (n
    n
    n
    n

    Answer:

    n

    n {answer}n

    n
    n );n }n};\""} +{"_id":"q-en-freeCodeCamp-b0f8df4110ac5f7ac7c09c78121396fd6e7b1152bda7321bf98fa5114376fb40","text":"// Change code above this line } } const newBookList = add(bookList, 'A Brief History of Time'); const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies'); const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies'); console.log(bookList); ``` # --solutions--"} +{"_id":"q-en-freeCodeCamp-b2175afa92276d0dc7d048ddbe0780d9f87ea42f39fe6cacac3c81dc5a2796ca","text":" --- title: Gatsby.js --- ## Gatsby.js [Gatsby](https://www.gatsbyjs.org) is a static site generator for [React](https://guide.freecodecamp.org/react), powered by [GraphQL](https://graphql.org/). Gatsby loads only the critical HTML, CSS, data, and JavaScript so your site loads as fast as possible. Once loaded, Gatsby prefetches resources for other pages so clicking around the site feels incredibly fast. The Gatsby environment provides several \"starters\" to help configure static sites quickly. Starters can be found here: [Starter Library](https://www.gatsbyjs.org/starters/). ### How Gatsby works Gatsby builds sites with the data provided by the developer, regardless of the source. #### Data sources Gatsby accepts the data behind the site in various formats, such as: 1. CMSs: Wordpress, Contentful, Drupal, etc. 2. Markdown: Documentation, posts, etc. 3. Data: APIs, Databases, JSON, CSV, etc. #### Build Gatsby's build is powered by GraphQL and rendered through HTML, CSS, and React. Since Gatsby is built on React you straight away get all the things we love about React, like composability, one-way binding, reusability, great environment and allows you to query your data however you want! #### Deploy Gatsby deploys the site on a static web host such as Amazon S3, Netlify, GitHub Pages, Surge.sh and many more. ### Installation and using the Gatsby CLI * Node: `npm install --global gatsby-cli` * Get started with the official Gatsby starter: `gatsby new gatsby-site https://github.com/gatsbyjs/gatsby-starter-default` * After that change to the newly created directory `cd gatsby-site` * `gatsby develop` starts a hot-reloading development server at `localhost:8000`. The site will reload when changes in `src/pages` will be saved. * To generate the static HTML pages use `gatsby build` * `gatsby serve` will start a local server that will present your built site. ### Querying data You are accessing all data by writing GraphQL queries. GraphQL allows you to pull only the data you need into your components, unlike when fetching data from REST API. A detailed walkthrough is available at https://www.gatsbyjs.org/tutorial/part-four/?no-cache=1#how-gatsbys-data-layer-uses-graphql-to-pull-data-into-components. #### More Information: For tutorials and more information check out the Gatsby.js official site: [Gatsby.js official site](https://www.gatsbyjs.org/tutorial/) "} +{"_id":"q-en-freeCodeCamp-b23652f10fd30db1037e5be50691eedd9f72e1e8f50663289a677663e3df8d54","text":"# --description-- **Objective:** Build an app that is functionally similar to this: https://codepen.io/freeCodeCamp/full/GrZVaM. **Objective:** Build an app that is functionally similar to this: https://bar-chart.freecodecamp.rocks. Fulfill the below user stories and get all of the tests to pass. Use whichever libraries or APIs you need. Give it your own personal style."} +{"_id":"q-en-freeCodeCamp-b322dc97157bd3130a1bea1b9f4d2cfbe0dd031642502b14554fb3a42d9a64f7","text":"- text: functionWithArgs(7,9) should output 16 testString: if(typeof functionWithArgs === \"function\") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16); - text: Call functionWithArgs with two numbers after you define it. testString: assert(/^s*functionWithArgss*(s*d+s*,s*d+s*)s*;/m.test(code)); testString: assert(/^s*functionWithArgss*(s*d+s*,s*d+s*)s*/m.test(code)); ```"} +{"_id":"q-en-freeCodeCamp-b32799d67d32b17452d1e13e717598ad211f62f0a5a00e91da4c4d6a5a828ff7","text":"\"All related radio buttons should have the same name attribute.\", \"Here's an example of a radio button:\", \"<label><input type=\"radio\" name=\"indoor-outdoor\"> Indoor</label>\", \"Add to your form a pair of radio buttons. Each radio button should be nested within its own label element. They should share a common name attribute. One should have the option of indoor and the other should have the option of outdoor.\" \"Add a pair of radio buttons to your form. One should have the option of indoor and the other should have the option of outdoor.\" ], \"tests\": [ \"assert($('input[type=\"radio\"]').length > 1, 'Your page should have two radio button elements.')\","} +{"_id":"q-en-freeCodeCamp-b644598aaa0a8e2004be60827fe16a5c3945dc16e3f02c6bc440e3aacf250af3","text":"return `
  • --fcc-editable-region--
  • # --instructions--"} +{"_id":"q-en-freeCodeCamp-cfad913f5a252a93a0ebead4382986a11846404c5fab67af548bf667b43ce998","text":"assert.exists(title); ``` The `title` element should be within the `head` element. Your `title` element should be within the `head` element. ```js assert.exists(document.querySelector('head > title')); ``` Your project should have a title of `Registration Form`. Your project should have a title of `Registration Form`. Remember, the casing and spelling matters for the title. ```js const title = document.querySelector('title'); assert.equal(title.text.toLowerCase(), 'registration form') assert.equal(title.text, 'Registration Form'); ``` Remember, the casing and spelling matters for the title. You should create a `meta` element within the `head` element. ```js const title = document.querySelector('title'); assert.equal(title.text, 'Registration Form'); assert.exists(document.querySelector('head > meta')); ``` You should give the `meta` element a `charset` attribute with the value of `utf-8`. ```js assert.equal(document.querySelector('head > meta')?.getAttribute('charset')?.toLowerCase(), 'utf-8'); ``` Your `meta` element should be a void element, it does not have an end tag ``. ```js assert.notMatch(code, /?/i); ``` # --seed--"} +{"_id":"q-en-freeCodeCamp-cff4b3531ea755cde5d7edd336795ed4235e9213ffa170cd165544641c22d97c","text":"id: 587d778d367417b2b2512aaa title: Make Elements Only Visible to a Screen Reader by Using Custom CSS challengeType: 0 videoUrl: 'https://scrimba.com/c/c8azdfM' videoUrl: 'https://scrimba.com/c/cJ8QGkhJ' --- ## Description"} +{"_id":"q-en-freeCodeCamp-d09bcb171c007272320e6e5fb0c091d34f280dac05ef90a53b08091304a5015f","text":"\"Aside from using open source libraries such as jQuery and Bootstrap, and short snippets of code which are clearly attributed to their original author, 100% of the code in my projects was written by me, or along with another camper with whom I was pair programming in real time.\" along with another person going through the freeCodeCamp curriculum with whom I was pair programming in real time.\"

    \"I pledge that I did not plagiarize any of my freeCodeCamp.org work. I"} +{"_id":"q-en-freeCodeCamp-d187dca0878bafa11219167399cafff29b361df7c344b4a84f56fdf2b13bc3b1","text":"], \"MDNlinks\": [ \"Comparison Operators\", \"String.slice()\", \"Array.slice()\", \"Array.filter()\", \"Array.indexOf()\", \"String.concat()\" \"Array.concat()\" ], \"type\": \"bonfire\", \"challengeType\": 5,"} +{"_id":"q-en-freeCodeCamp-d20266f7abbf07fae19c03b9e7b710be2a2ecc1286ec769bb8b40c83a67935df","text":"The `

    ` tag is a container which is used for navigational links or introductory content. It may typically include heading elements, such as `

    `, `

    `, but may also include other elements such as a search form, logo, author information etc.

    corresponds to the most important heading. As we move to other tags like

    ,

    , etc the degree of importance decreases. `

    ` corresponds to the most important heading. As we move to other tags like `

    `, `

    `, etc the degree of importance decreases. Although not required, the `
    ` tag is intended to contain the surrounding sections heading. It may also be used more than once in an HTML document. It is important to note that the `
    ` tag does not introduce a new section, but is simply the head of a section. Here's an example using the `
    ` tag:"} +{"_id":"q-en-freeCodeCamp-d3dfd43fb25ed0e79bc19edd1c9ccb3480958598c116986fb0edf3045c383c15","text":"\"

    Hello Paragraph

    \" ], \"tests\": [ \"assert.isTrue((/Kitty(s)+ipsum(s)+dolor/gi).test($(\"p\").text()), 'message: Your p element should contain the first few words of the provided kitty ipsum text.');\" \"assert.isTrue((/Kitty(s)+ipsum/gi).test($(\"p\").text()), 'message: Your p element should contain the first few words of the provided kitty ipsum text.');\" ], \"challengeType\": 0, \"nameEs\": \"Llena espacios con texto de relleno\","} +{"_id":"q-en-freeCodeCamp-d4bb4f092032cdf50d762b6b0cdfc69373e976ea0b572dcc4ccd8af9c729b520","text":"const res = await fetch(url + '/api/users', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: `username=fcc_test_${Date.now()}`.substingr(0, 29) body: `username=fcc_test_${Date.now()}`.substring(0, 29) }); if (res.ok) { const { _id, username } = await res.json();"} +{"_id":"q-en-freeCodeCamp-d4edd648275c7a525695055ff2e201dddfcfb23f8eec699f8e4a26ff0c09b05d","text":"\"In the game of golf each hole has a par meaning the average number of strokes a golfer is expected to make in order to sink the ball in a hole to complete the play. Depending on how far above or below par your strokes are, there is a different nickname.\", \"Your function will be passed par and strokes arguments. Return the correct string according to this table which lists the strokes in order of priority; top (highest) to bottom (lowest):\", \"
    StrokesReturn
    1\"Hole-in-one!\"
    <= par - 2\"Eagle\"
    par - 1\"Birdie\"
    par\"Par\"
    par + 1\"Bogey\"
    par + 2\"Double Bogey\"
    >= par + 3\"Go Home!\"
    \", \"par and strokes will always be numeric and positive.\" \"par and strokes will always be numeric and positive. We have added an array of all the names for your convenience.\" ], \"releasedOn\": \"January 1, 2016\", \"challengeSeed\": [ \"var names = [\"Hole-in-one!\", \"Eagle\", \"Birdie\", \"Par\", \"Bogey\", \"Double Bogey\", \"Go Home!\"];\", \"function golfScore(par, strokes) {\", \" // Only change code below this line\", \" \","} +{"_id":"q-en-freeCodeCamp-d51878266dfda2768f4c741e7759a3066bbab70a947a4862542136e0f1d7eb21","text":"--fcc-editable-region-- function pick(guess) { let numbers = []; const numbers = []; } --fcc-editable-region--"} +{"_id":"q-en-freeCodeCamp-d6112fcf56d6c2a623fcb0114992497673d1ed97b1390009d1cfdea7fc50f2d4","text":"- text: Clicking the decrement button should decrement the count by 1. testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(Counter)); const first = () => { mockedComponent.setState({ count: 0 }); return waitForIt(() => mockedComponent.state(''count'')); }; const second = () => { mockedComponent.find(''.dec'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const firstValue = await first(); const secondValue = await second(); assert(firstValue === 0 && secondValue === -1, ''Clicking the decrement button should decrement the count by 1.''); }; ' - text: Clicking the reset button should reset the count to 0. testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(Counter)); const init = () => { mockedComponent.setState({ count: 0 }); return waitForIt(() => mockedComponent.state(''count'')); }; const increment = () => { mockedComponent.find(''.inc'').simulate(''click''); mockedComponent.find(''.inc'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const decrement = () => { mockedComponent.find(''.dec'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const reset = () => { mockedComponent.find(''.reset'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const firstValue = await init(); const secondValue = await increment(); const thirdValue = await decrement(); const fourthValue = await reset(); assert(firstValue === 0 && secondValue === 2 && thirdValue === 1 && fourthValue === 0, ''Clicking the reset button should reset the count to 0.''); }; ' testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(Counter)); const init = () => { mockedComponent.setState({ count: 0 }); return waitForIt(() => mockedComponent.state(''count'')); }; const increment = () => { mockedComponent.find(''.inc'').simulate(''click''); mockedComponent.find(''.inc'').simulate(''click''); mockedComponent.find(''.inc'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const decrement = () => { mockedComponent.find(''.dec'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const reset = () => { mockedComponent.find(''.reset'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const firstValue = await init(); const secondValue = await increment(); const thirdValue = await decrement(); const fourthValue = await reset(); assert(firstValue === 0 && secondValue === 3 && thirdValue === 2 && fourthValue === 0, ''Clicking the reset button should reset the count to 0.''); }; ' ```"} +{"_id":"q-en-freeCodeCamp-d717b063282dbe85247156870cc8ce3e40c6f7776c21eaf2eae6500d4f231c13","text":"return ( );"} +{"_id":"q-en-freeCodeCamp-d73f0d96478b4acc751e0037996a851f5f510f1018bfcda8c91ba2ef430e73fd","text":"Your `letters.forEach()` callback function should be nested inside the `range(1, 99).forEach(number => {}` callback function. ```js assert.match(code, /ranges*(s*1s*,s*99s*)s*.forEachs*(s*((s*numbers*)|number)s*=>s*{s*[^}]*letters.forEach(s*((s*letters*)|letter)s*=>s*{s*}s*)s*}s*)/) assert.match(code, /ranges*(s*1s*,s*99s*)s*.forEachs*(s*((s*numbers*)|number)s*=>s*{s*[^}]*letters.forEach(s*((s*letters*)|letter)s*=>s*{s*}s*)s*;?s*}s*)/) ``` # --seed--"} +{"_id":"q-en-freeCodeCamp-db1c9df9c0c337f7d48756e79b0be9c9322ce40d1a00cf386b87896d5a87b472","text":"); ``` Trying to remove an element from an empty tree should return `null`. ```js assert( (function () { var test = false; if (typeof BinarySearchTree !== 'undefined') { test = new BinarySearchTree(); } else { return false; } if (typeof test.remove !== 'function') { return false; } return test.remove(100) == null; })() ); ``` Trying to remove an element that does not exist should return `null`. ```js"} +{"_id":"q-en-freeCodeCamp-db368fbd1011e65e2ed6a2b9e6b67d6b82a55ebb75d9e19e45aa20d0e7d3372f","text":"} from '../../../redux/selectors'; import { ChallengeFiles, ChallengeTest, Dimensions, FileKey, ResizeProps,"} +{"_id":"q-en-freeCodeCamp-dc6ad898471f2ead0d7f3fe14a9bde386e5cab0e714298aeaf4ba1d46114eebb","text":"} return { postResult postResult, oldLog }; })();"} +{"_id":"q-en-freeCodeCamp-e05c4b4fcdc6aa35b9e15ee1f1026d3882cf15eeb028501af76043b79c4b7a47","text":"isResetting: boolean, isSignedIn: boolean, { theme }: { theme: Themes }, tests: [{ text: string; testString: string }], tests: [{ text: string; testString: string; message?: string }], isChallengeCompleted: boolean ) => ({ attempts,"} +{"_id":"q-en-freeCodeCamp-e3d1258418d7ca30a562b15bdd5c10f92cc73e52168344059a527169866535f7","text":"\"He aquí un ejemplo:\", \"<p>Aquí está un <a href=\"https://freecodecamp.org\"> enlace a freeCodeCamp</a> para que lo sigas.</p>\", \"
    \", \"Crea un elemento a que se vincule a http://freecatphotoapp.com y tenga como texto de ancla \"fotos de gatos\".\" \"Crea un elemento a que se vincule a http://freecatphotoapp.com y tenga como texto de ancla \"cat photos\".\" ] }, \"pt-br\": {"} +{"_id":"q-en-freeCodeCamp-e40eee4f0b504afabe97893452f534ddc5c7f9704595ddf541cff4465226282a","text":"--- # --description-- The `em` element makes text italic. It also semantically places emphasis on the text, which again may affect things like screen readers. To define an emphasized element you wrap text content in a `` tag. The `em` element makes text italic. It also semantically places emphasis on the text, which again may affect things like screen readers. To define an emphasized element you wrap text content in an `` tag. To use `em` on its own: "} +{"_id":"q-en-freeCodeCamp-e6509666bf197d45f14e9e996007f43e72770e6da56fa12e682e4fde437c4b4e","text":"const keyMap = { NAVIGATION_MODE: 'escape', EXECUTE_CHALLENGE: ['ctrl+enter', 'command+enter'], FOCUS_EDITOR: 'e', NAVIGATE_PREV: ['p'], NAVIGATE_NEXT: ['n'] };"} +{"_id":"q-en-freeCodeCamp-e879febdc916dc6774cf05e3513438ce015af1a93acd30af002eb2fbda622309","text":"assert.match(code, /consts+collisionDetectionRuless*=s*[s*(?:[^]]*s*)*];?/); ``` You should have a conditional statement that checks if the player's `y` position plus the player's height is less than or equal to the platform's `y` position. You should have a boolean expression that checks if the player's `y` position plus the player's height is less than or equal to the platform's `y` position. ```js assert.match(code, /consts+collisionDetectionRuless*=s*[s*player.position.ys++s*player.heights*<=s*platform.position.y,?s*]s*;?/);"} +{"_id":"q-en-freeCodeCamp-e8b48ad34ea805bb531ad982ad828ac2558c4da486a357ec5e3670f07775f18d","text":"} return test; } // tail: let rules=[[\"A -> apple\",\"B -> bag\",\"S -> shop\",\"T -> the\",\"the shop -> my brother\",\"a never used -> .terminating rule\"], [\"A -> apple\",\"B -> bag\",\"S -> .shop\",\"T -> the\",\"the shop -> my brother\",\"a never used -> .terminating rule\"], [\"A -> apple\",\"WWWW -> with\",\"Bgage -> ->.*\",\"B -> bag\",\"->.* -> money\",\"W -> WW\",\"S -> .shop\",\"T -> the\",\"the shop -> my brother\",\"a never used -> .terminating rule\"], [\"_+1 -> _1+\",\"1+1 -> 11+\",\"1! -> !1\",\",! -> !+\",\"_! -> _\",\"1*1 -> x,@y\",\"1x -> xX\",\"X, -> 1,1\",\"X1 -> 1X\",\"_x -> _X\",\",x -> ,X\",\"y1 -> 1y\",\"y_ -> _\",\"1@1 -> x,@y\",\"1@_ -> @_\",\",@_ -> !_\",\"++ -> +\",\"_1 -> 1\",\"1+_ -> 1\",\"_+_ -> \"], [\"A0 -> 1B\",\"0A1 -> C01\",\"1A1 -> C11\",\"0B0 -> A01\",\"1B0 -> A11\",\"B1 -> 1B\",\"0C0 -> B01\",\"1C0 -> B11\",\"0C1 -> H01\",\"1C1 -> H11\"]]; let tests=[\"I bought a B of As from T S.\", \"I bought a B of As from T S.\", \"I bought a B of As W my Bgage from T S.\", \"_1111*11111_\", \"000000A000000\"]; let outputs=[\"I bought a bag of apples from my brother.\", \"I bought a bag of apples from T shop.\", \"I bought a bag of apples with my money from T shop.\", \"11111111111111111111\", \"00011H1111000\"]; ```"} +{"_id":"q-en-freeCodeCamp-e9196c09d5cb847522d97e9607516d222db6710072c7ed2ff38c58b6c5e4055e","text":"); ``` `newestBookList` should equal `[\"The Hound of the Baskervilles\", \"Philosophi�� Naturalis Principia Mathematica\", \"Disquisitiones Arithmeticae\", \"A Brief History of Time\"]`. `remove(add(bookList, \"A Brief History of Time\"), \"On The Electrodynamics of Moving Bodies\");` should equal `[\"The Hound of the Baskervilles\", \"Philosophiæ Naturalis Principia Mathematica\", \"Disquisitiones Arithmeticae\", \"A Brief History of Time\"]`. ```js assert( JSON.stringify(newestBookList) === JSON.stringify(remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies')) === JSON.stringify([ 'The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica',"} +{"_id":"q-en-freeCodeCamp-e9ae86693e537085f6ea767608db9510676c29be39db7b885c9dcf2a3f3da7c2","text":"], \"description\": [ \"You can add the fa-paper-plane Font Awesome icon by adding <i class=\"fa fa-paper-plane\"></i> within your submit button element.\", \"Give your form's text input field a class of form-control. Give your form's submit button the classes btn btn-primary. Also give this button the Font Awesome icon of fa-paper-plane.\" \"Give your form's text input field a class of form-control. Give your form's submit button the classes btn btn-primary. Also give this button the Font Awesome icon of fa-paper-plane.\", \"All textual <input>, <textarea>, and <select> elements with the class .form-control have a width of 100%.\" ], \"challengeSeed\": [ \"\","} +{"_id":"q-en-freeCodeCamp-ea055b63335f8e2eab5375fd3a10ccde66d3a41e124f4a99e8e088cd27c62429","text":"} } @media (max-width: 767px) { .certificate-outer-wrapper .donation-section { padding: 20px 20px; } } @media screen and (max-width: 992px) { .certification-namespace header { height: 160px;"} +{"_id":"q-en-freeCodeCamp-ea3930f8351595c69b620dc544140e6d77d97e8a2b12301bd6e6be6816352e0b","text":"- text: All elements from the first array should be added to the second array in their original order. testString: assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]); - text: The first array should remain the same after the function runs. testString: frankenSplice(testArr1, testArr2); assert.deepEqual(testArr1, [1, 2]); testString: frankenSplice(testArr1, testArr2, 1); assert.deepEqual(testArr1, [1, 2]); - text: The second array should remain the same after the function runs. testString: frankenSplice(testArr1, testArr2); assert.deepEqual(testArr2, [\"a\", \"b\"]); testString: frankenSplice(testArr1, testArr2, 1); assert.deepEqual(testArr2, [\"a\", \"b\"]); ```"} +{"_id":"q-en-freeCodeCamp-ea6c1ef79edae71498aa3a7a3173126d12499973580ec22131d66c4dbe79a1fb","text":"import DonateModal from '../Donation'; import 'prismjs/themes/prism.css'; import './prism.css'; import './prism-night.css'; import 'react-reflex/styles.css'; import './learn.css';"} +{"_id":"q-en-freeCodeCamp-eb26c80256ce7dec136630e7e4525175769da86676bd0dd02edc865eb3dfa0e7","text":"); ``` `newerBookList` should equal `[\"The Hound of the Baskervilles\", \"Philosophiæ Naturalis Principia Mathematica\", \"Disquisitiones Arithmeticae\"]`. `remove(bookList, \"On The Electrodynamics of Moving Bodies\")` should return `[\"The Hound of the Baskervilles\", \"Philosophiæ Naturalis Principia Mathematica\", \"Disquisitiones Arithmeticae\"]`. ```js assert( JSON.stringify(newerBookList) === JSON.stringify(remove(bookList, 'On The Electrodynamics of Moving Bodies')) === JSON.stringify([ 'The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica',"} +{"_id":"q-en-freeCodeCamp-eb6758ace99fe0ced3233a6cd67268abeeea2bb1b2ffa288dff7e99f3e137ac2","text":"} .certification-namespace .information { margin-top: -20px; height: 380px; text-align: center; background-color: var(--gray-05);"} +{"_id":"q-en-freeCodeCamp-ebd4c83ff4c1e3aeb0fc0300ea644408ae250d99fba8ff6bbaaa84aaabefc7f3","text":"You should use a `for...of` loop to iterate through the `arr` array. ```js assert.match(code, /consts+detectFullHouses*=s*((s*arrs*)|arr)s*=>s*{.*s*fors*(s*consts+nums+ofs+arrs*)s*{s*.*}/s); assert.match(code, /consts+detectFullHouses*=s*((s*arrs*)|arr)s*=>s*{.*s*fors*(s*(const|let|var)s+nums+ofs+arrs*)s*{s*.*}/s); ``` # --seed--"} +{"_id":"q-en-freeCodeCamp-ec437e69e4d85797ebee8646d53383ad8887003e7e6d542bf9773750d6f74cc3","text":"); ``` `newBookList` should equal `[\"The Hound of the Baskervilles\", \"On The Electrodynamics of Moving Bodies\", \"Philosophiæ Naturalis Principia Mathematica\", \"Disquisitiones Arithmeticae\", \"A Brief History of Time\"]`. `add(bookList, \"A Brief History of Time\")` should return `[\"The Hound of the Baskervilles\", \"On The Electrodynamics of Moving Bodies\", \"Philosophiæ Naturalis Principia Mathematica\", \"Disquisitiones Arithmeticae\", \"A Brief History of Time\"]`. ```js assert( JSON.stringify(newBookList) === JSON.stringify(add(bookList, \"A Brief History of Time\")) === JSON.stringify([ 'The Hound of the Baskervilles', 'On The Electrodynamics of Moving Bodies',"} +{"_id":"q-en-freeCodeCamp-ed10a33452af196ceca5f25d187dcb2a90e2a9d7d602810e4266c10b4eefc2f2","text":"const getMultiple = await $.get(url + '?created_by=Alice&assigned_to=Bob'); assert.isArray(getMultiple); assert.lengthOf(getMultiple, 2); const copyId = getMultiple[0]._id; const getById = await $.get(url + `?_id=${copyId}`); assert.isArray(getById); assert.lengthOf(getById, 1); assert.equal(getById[0]._id, copyId, 'should be able to query a document by _id') } catch (err) { throw new Error(err.responseText || err.message); }"} +{"_id":"q-en-freeCodeCamp-ee947bcf01e78cf8f2644faae49d5c81f77b05324d2f50e1bf9076dc294a7324","text":"req.flash('info', { msg: dedent` Once you have completed all of our challenges, you should join our Half Way Club and start getting join our Half Way Club and start getting ready for our nonprofit projects. `.split('n').join(' ') });"} +{"_id":"q-en-freeCodeCamp-ef3cd4a426d3a7c8a76bbf21b64f9703cfecafc217b2ece019643c12873805b1","text":"Your `h2` tag should have a `width` of 80vw. ```js assert(code.match(/h2s*?{s*?width:s*?80vw;s*?}/g)); assert( __helpers .removeCssComments(code) .match(/h2s*?{s*?width:s*?80vw;s*?}/g) ); ``` Your `p` tag should have a `width` of 75vmin. ```js assert(code.match(/ps*?{s*?width:s*?75vmin;s*?}/g)); assert( __helpers .removeCssComments(code) .match(/ps*?{s*?width:s*?75vmin;s*?}/g) ); ``` # --seed--"} +{"_id":"q-en-freeCodeCamp-f099c8f2a1929360775ba86f7939f27b78086dfd0320ee6239d8d8bdf0750f13","text":"e.preventDefault(); if (executeChallenge) executeChallenge(); }, FOCUS_EDITOR: e => { e.preventDefault(); if (editorRef && editorRef.current) { editorRef.current.getWrappedInstance().focusOnEditor(); } }, NAVIGATION_MODE: () => setEditorFocusability(false), NAVIGATE_PREV: () => { if (!canFocusEditor) navigate(prevChallengePath);"} +{"_id":"q-en-freeCodeCamp-f0a3bf71d9fe0cf8c94df9a9b7be0c13cbceb6a477a3130de50bc651a875733e","text":"id: bad87fee1348bd9aede08817 title: Nest an Anchor Element within a Paragraph challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cb6k8Cb' forumTopicId: 18244 dashedName: nest-an-anchor-element-within-a-paragraph ---"} +{"_id":"q-en-freeCodeCamp-f145d9add067bef98909f1fc53dd84b45858c1cd760bf627ccbb6174a5c861d5","text":"The `console.log(array[0])` prints `50`, and `data` has the value `60`. **Note:** There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code. # --instructions-- Create a variable called `myData` and set it to equal the first value of `myArray` using bracket notation."} +{"_id":"q-en-freeCodeCamp-f41458f481a3465c0cfd78379b1c90476d6c4c004d28c2400c8e8454477f6a2e","text":"```yml tests: - text: resolve should be executed when the if condition is true. - text: resolve should be called with the expected string when the if condition is true. testString: assert(removeJSComments(code).match(/ifs*(s*responseFromServers*)s*{s*resolves*(s*('|\"|`)We got the data1s*)(s*|s*;s*)}/g)); - text: reject should be executed when the if condition is false. - text: reject should be called with the expected string when the if condition is false. testString: assert(removeJSComments(code).match(/}s*elses*{s*rejects*(s*('|\"|`)Data not received1s*)(s*|s*;s*)}/g)); ```"} +{"_id":"q-en-freeCodeCamp-f678d913a9c384b61db3b7855ce4bdcebf5ce5ed24a956fee9e3cc649c8333ae","text":"Moving on to the final `fieldset`. What if you wanted to allow a user to upload a profile picture? Well, the `input` type `file` allows just that. Add a `label` with the text `Upload a profile picture: `, and add an `input` accepting a file upload. Well, the `input` type `file` allows just that. Add a `label` with the text `Upload a profile picture: `, and nest an `input` accepting a file upload. # --hints--"} +{"_id":"q-en-freeCodeCamp-f91cb96a087728d5b4bffee4a3bc23f6899eae494e4ed3658ebb04bda159c42a","text":" --- title: Static Site Generators --- ## Static web page Static web pages are often HTML documents stored as files in the file system and made available by the web server over HTTP (nevertheless URLs ending with \".html\" are not always static). However, loose interpretations of the term could include web pages stored in a database, and could even include pages formatted using a template and served through an application server, as long as the page served is unchanging and presented essentially as stored. Static web pages are suitable for the contents that never or rarely need to be updated, though modern static site generators are changing. Maintaining large numbers of static pages as files can be impractical without automated tools, such as Static site generators described in the Web template system. Another way to manage static pages include Online compiled source code playgrounds, e.g. GatsbyJS and GitHub may be utilized for migrating a WordPress site into static web pages. Any personalization or interactivity has to run client-side, which is restricting. ## Static Site Generators A Static Site Generator is a program, that generates an HTML website as an output. This HTML website is then served through your web server, just like the olden days. This is usually achieved using template languages and code that separates out the layout of the website from its content and styles. ## How static sites work The proposition of a static site is to shift the heavy load from the moment visitors request the content to the moment content actually changes. Going back to our news kiosk metaphor, think of a scenario where it's the news agencies who call the kiosk whenever something newsworthy happens. The kiosk operators and scribbles will then compile, format and style the stories and produce a finished newspaper right away, even though nobody ordered one yet. They will print out a huge number of copies (infinite, actually) and pile them up by the storefront. When customers arrive, there's no need to wait for an operator to become available, place the phone call, pass the results to the scribble and wait for the final product. The newspaper is already there, waiting in a pile, so the customer can be served instantly. And that is how static site generators work. They take the content, typically stored in flat files rather than databases, apply it against layouts or templates and generate a structure of purely static HTML files that are ready to be delivered to the users. ## Advantages of static 1) Speed Perhaps the most immediately noticeable characteristic of a static site is how fast it is. As mentioned above, there are no database queries to run, no templating and no processing whatsoever on every request. Web servers are really good at delivering static pages quickly, and the entire site consists of static HTML files that are sitting on the server, waiting to be served, so a request is served back to the user pretty much instantly. 2) Version control for content You can't even imagine working on a project without version control anymore, can you? Having a repository where people can collaboratively work on files, control exactly who does what and rollback changes when something goes wrong is essential in any software project, no matter how small. But what about the content? That's the keystone of any site and yet it usually sits in a database somewhere else, completely separated from the codebase and its version control system. In a static site, the content is typically stored in flat files and treated as any other component of the codebase. In a blog, for example, that means being able to have the actual posts stored in a GitHub repository and allowing your readers to file an issue when something is wrong or to add a correction with a pull request — how cool is that? 3) Security Platforms like WordPress are used by millions of people around the world, meaning they're common targets for hackers and malicious attacks — no way around it. Wherever there's user input/authentication or multiple processes running code on every request, there's a potential security hole to exploit. To be on top of the situation, site administrators need to keep patching their systems with security updates, constantly playing cat and mouse with attackers, a routine that may be overlooked by less experienced users. Static sites keep it simple since there's not much to mess up when there's only a web server serving plain HTML pages. 4) Less hassle with the server Installing and maintaining the infrastructure required to run a dynamic site can be quite challenging, especially when multiple servers are involved or when something needs to be migrated. There's packages, libraries, modules and frameworks with different versions and dependencies, there are different web servers and database engines in different operating systems. Sure, a static site generator is a software package with its dependencies as well, but that's only relevant at build time when the site is generated. Ultimately, the end result is a collection of HTML files that can be served anywhere, scaled and migrated as needed regardless of the server-side technologies. As for the site generation process, that can be done from an environment that you control locally and not necessarily on the web server that will run the site — heck, you can build an entire site on your laptop and push the result to the web when it's done. 5) Traffic surges Unexpected traffic peaks on a website can be a problem, especially when it relies intensively on database calls or heavy processing. Introducing caching layers such as Varnish or Memcached surely helps, but that ends up introducing more possible points of failure in the system. A static site is generally better prepared for those situations, as serving static HTML pages consumes a very small amount of server resources. ## Disadvantages of static (and potential solutions) 1) No real-time content With a static site, you lose the ability to have real-time data, such as indication about which stories have been trending for the past hour, or content that dynamically changes for each visitor, like a \"recommended articles for you\" kind of thing. Static is static and will be the same for everyone. There's not really a solution for this, I'm afraid. It's the ultimate price to pay for using a static site, so it's important that you ask yourself the question \"how real-time does my site need to be?\" — if its concept is based around delivering real-time information then perhaps a static site isn't the right choice. A dangerous solution: There's an easy exit for whenever you're faced with the challenge of dynamically updating content on a static site: \"I can do it with JavaScript\". Doing processing on the client-side and appending the results to the page after it's been served can be the right approach for some cases, but must not be seen as the magic solution that turns your static site into a fully dynamic one. It can prevent some users from seeing the injected content, hurt your SEO and introduce other problems, potentially taking away the ease of mind and sense of control that comes with using a static site. 2) No user input Adding user-generated content to a static site is a bit of a challenge. Take a commenting system for a blog, for example — how do you process user comments and append them to a post using just plain HTML pages? You don't. "} +{"_id":"q-en-freeCodeCamp-fc2937b615feb9f987f664ab2b4c56d05a65fe972eff2b5071ad109a8c26fcef","text":"className=\"spacer\" style={ { \"height\": \"1px\", \"padding\": \"15px 0\", } }"} +{"_id":"q-en-freeCodeCamp-fcc562902cc8fd9be52ca3c6467f6cccdf2c5b5ffc0cb94a1898511b0a02e310","text":"expect(redirectUrl.pathname).toBe('/authorize'); }); }); describe('GET /mobile-login', () => { let superGet: ReturnType; beforeAll(() => { superGet = createSuperRequest({ method: 'GET' }); }); beforeEach(async () => { await fastifyTestInstance.prisma.userRateLimit.deleteMany({}); await fastifyTestInstance.prisma.user.deleteMany({ where: { email: newUserEmail } }); }); it('should be rate-limited', async () => { await Promise.all( [...Array(10).keys()].map(() => superGet('/mobile-login')) ); const res = await superGet('/mobile-login'); expect(res.status).toBe(429); }); it('should return 401 if the authorization header is invalid', async () => { mockedFetch.mockResolvedValueOnce(mockAuth0NotOk()); const res = await superGet('/mobile-login').set( 'Authorization', 'Bearer invalid-token' ); expect(res.body).toStrictEqual({ type: 'danger', message: 'We could not log you in, please try again in a moment.' }); expect(res.status).toBe(401); }); it('should return 400 if the email is not valid', async () => { mockedFetch.mockResolvedValueOnce(mockAuth0InvalidEmail()); const res = await superGet('/mobile-login').set( 'Authorization', 'Bearer valid-token' ); expect(res.body).toStrictEqual({ type: 'danger', message: 'The email is incorrectly formatted' }); expect(res.status).toBe(400); }); it('should set the jwt_access_token cookie if the authorization header is valid', async () => { mockedFetch.mockResolvedValueOnce(mockAuth0ValidEmail()); const res = await superGet('/mobile-login').set( 'Authorization', 'Bearer valid-token' ); expect(res.status).toBe(200); expect(res.get('Set-Cookie')).toEqual( expect.arrayContaining([expect.stringMatching(/jwt_access_token=/)]) ); }); it('should create a user if they do not exist', async () => { mockedFetch.mockResolvedValueOnce(mockAuth0ValidEmail()); const existingUserCount = await fastifyTestInstance.prisma.user.count(); const res = await superGet('/mobile-login').set( 'Authorization', 'Bearer valid-token' ); const newUserCount = await fastifyTestInstance.prisma.user.count(); expect(existingUserCount).toBe(0); expect(newUserCount).toBe(1); expect(res.status).toBe(200); }); it('should redirect to returnTo if already logged in', async () => { mockedFetch.mockResolvedValueOnce(mockAuth0ValidEmail()); const firstRes = await superGet('/mobile-login').set( 'Authorization', 'Bearer valid-token' ); expect(firstRes.status).toBe(200); const res = await superRequest('/mobile-login', { method: 'GET', // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment setCookies: firstRes.get('Set-Cookie') }) .set('Authorization', 'Bearer does-not-matter') .set('Referer', 'https://www.freecodecamp.org/back-home'); expect(res.status).toBe(302); expect(res.headers.location).toBe( 'https://www.freecodecamp.org/back-home' ); }); }); });"} +{"_id":"q-en-freeCodeCamp-fd8b249c2347d135fd2d3050e5c3aca0b6eef75e8affebff2173fe037a7e3a67","text":"# --description-- **Objective:** Build an app that is functionally similar to this: https://codepen.io/freeCodeCamp/full/EZKqza. **Objective:** Build an app that is functionally similar to this: https://choropleth-map.freecodecamp.rocks. Fulfill the below user stories and get all of the tests to pass. Use whichever libraries or APIs you need. Give it your own personal style."} +{"_id":"q-en-freeCodeCamp-fd906c28872e89fc1e47aa71f80b0ee359a1d58a64c32d40138a87e0155ee4ab","text":"assert(document.querySelectorAll('table')?.[1]?.querySelector('tbody')?.querySelectorAll('tr')?.[3]?.querySelector('th')); ``` Your text `Total Liabilities` should not include period `.`. ```js assert(document.querySelectorAll('table')?.[1]?.querySelector('tbody')?.querySelectorAll('tr')?.[3]?.querySelector('th')?.innerText !== 'Total Liabilities.'); ``` Your `th` element should have the text `Total Liabilities`. ```js"} +{"_id":"q-en-freeCodeCamp-fe5a60b1d83f6ff3e8929ce83848fb4af2fc0374a880a29b3987e7ffe5802900","text":"\"cert-map-estimates\": { \"certs\": \"Certification (300u00A0hours)\", \"coding-prep\": \"(Thousands of hours of challenges)\" }, \"editor-tabs\": { \"info\": \"Info\", \"code\": \"Code\", \"tests\": \"Tests\", \"preview\": \"Preview\" } }, \"donate\": {"}