{"schemaVersion":1,"contentVersion":"3.4.0","id":"intermediate.7","languages":{"javascript":{"id":"intermediate.7","title":"Reshape without retyping","moduleName":"Boundaries and reusable text","tips":"","concept":"<p class=\"lead\">Join lines, indent them or make text upper case without touching the lines around them.</p><p><strong>Before this lesson:</strong> Operators and counts.</p><p>J joins the next line onto this one, usually with a space between them. gU takes a motion or text object and makes that text upper case. &gt;&gt; moves a line right, and a count moves several lines. Indenting only changes the layout here, so check the result against the target.</p><h3>Example</h3><p>J turns “Read the” and “guide.” into “Read the guide.” Then gUiw on guide changes just that word to GUIDE.</p><p>Use Start over to try again.</p>","teaches":["operator:>","join","operator:gU"],"introduces":["J","gU",">",">>","count","textobject"],"constraints":[],"drills":[{"task":"This call fits on one line. Join the two lines.","hint":"J joins the next line onto this one, with one space between.","mode":"jsx","start":"import { createOrder } from \"../api/orders\";\n\n// Turns the cart into an order. The payment step comes after this.\nexport async function placeOrder(cart, customer) {\n  const order = await createOrder(cart,\n    customer);\n  return order.id;\n}","startCursor":{"line":4,"ch":2},"paths":[{"keys":["J"],"tier":"idiomatic","technique":"join","core":["join"],"note":"J also removes the next line's indent, so you get exactly one space."}],"target":"import { createOrder } from \"../api/orders\";\n\n// Turns the cart into an order. The payment step comes after this.\nexport async function placeOrder(cart, customer) {\n  const order = await createOrder(cart, customer);\n  return order.id;\n}","language":"javascript","evidence":"guided","canonicalKey":"intermediate.7#0","canonicalFingerprint":"16h2z2n"},{"task":"The <code>return</code> belongs inside the <code>if</code>. Indent it.","hint":">> moves the line right by one indent.","mode":"jsx","start":"import { redirect } from \"../router\";\n\n// Pages that need a signed-in customer call this first.\nexport function requireUser(session) {\n  if (!session.user) {\n  return redirect(\"/sign-in?next=\" + encodeURIComponent(location.pathname));\n  }\n  return session.user;\n}","startCursor":{"line":4,"ch":2},"paths":[{"keys":["j",">",">"],"tier":"idiomatic","technique":"operator:>","core":["operator:>"],"note":">> adds one indent, two spaces here, wherever the cursor is on the line."}],"target":"import { redirect } from \"../router\";\n\n// Pages that need a signed-in customer call this first.\nexport function requireUser(session) {\n  if (!session.user) {\n    return redirect(\"/sign-in?next=\" + encodeURIComponent(location.pathname));\n  }\n  return session.user;\n}","language":"javascript","evidence":"guided","canonicalKey":"intermediate.7#1","canonicalFingerprint":"1vsjwjp"},{"task":"Environment variables are upper case. Fix the name of the Stripe key.","hint":"gUiw makes the whole word upper case, from anywhere inside it.","mode":"jsx","start":"import Stripe from \"stripe\";\n\n// The server's Stripe client. The key comes from the deploy settings.\nexport const stripe = new Stripe(process.env.stripe_secret_key, {\n  apiVersion: \"2026-10-28\",\n});\n\nexport const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;","startCursor":{"line":2,"ch":0},"paths":[{"keys":["j","f","_","g","U","i","w"],"tier":"idiomatic","technique":"operator:gU","core":["operator:gU"],"note":"The underscores are part of the word, so gUiw changes the whole name."}],"target":"import Stripe from \"stripe\";\n\n// The server's Stripe client. The key comes from the deploy settings.\nexport const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {\n  apiVersion: \"2026-10-28\",\n});\n\nexport const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;","language":"javascript","evidence":"guided","canonicalKey":"intermediate.7#2","canonicalFingerprint":"1btug5"}]},"python":{"id":"intermediate.7","title":"Reshape without retyping","moduleName":"Boundaries and reusable text","tips":"","concept":"<p class=\"lead\">Join lines, indent them or make text upper case without touching the lines around them.</p><p><strong>Before this lesson:</strong> Operators and counts.</p><p>J joins the next line onto this one, usually with a space between them. gU takes a motion or text object and makes that text upper case. &gt;&gt; moves a line right, and a count moves several lines. Indenting only changes the layout here, so check the result against the target.</p><h3>Example</h3><p>J turns “Read the” and “guide.” into “Read the guide.” Then gUiw on guide changes just that word to GUIDE.</p><p>Use Start over to try again.</p>","teaches":["operator:>","join","operator:gU"],"introduces":["J","gU",">",">>","count","textobject"],"constraints":[],"drills":[{"task":"This call fits on one line. Join the two lines.","hint":"J joins the next line onto this one, with one space between.","mode":"python","start":"from shop.orders.api import create_order\n\n\ndef place_order(cart, customer):\n    \"\"\"Turns the cart into an order. The payment step comes after this.\"\"\"\n    order = create_order(cart,\n                         customer)\n    return order.id","startCursor":{"line":5,"ch":4},"paths":[{"keys":["J"],"tier":"idiomatic","technique":"join","core":["join"],"note":"J also removes the next line's indent, so you get exactly one space."}],"target":"from shop.orders.api import create_order\n\n\ndef place_order(cart, customer):\n    \"\"\"Turns the cart into an order. The payment step comes after this.\"\"\"\n    order = create_order(cart, customer)\n    return order.id","language":"python","evidence":"guided","canonicalKey":"intermediate.7#0","canonicalFingerprint":"16h2z2n"},{"task":"The <code>return</code> is two spaces short of the <code>if</code> block's indent. Indent it.","hint":">> moves the line right by one indent.","mode":"python","start":"from django.contrib.auth.views import redirect_to_login\n\n\ndef require_user(request):\n    \"\"\"Views that need a signed-in customer call this first.\"\"\"\n    if not request.user.is_authenticated:\n      return redirect_to_login(request.get_full_path())\n    return request.user","startCursor":{"line":5,"ch":4},"paths":[{"keys":["j",">",">"],"tier":"idiomatic","technique":"operator:>","core":["operator:>"],"note":">> adds one indent, two spaces here, wherever the cursor is on the line."}],"target":"from django.contrib.auth.views import redirect_to_login\n\n\ndef require_user(request):\n    \"\"\"Views that need a signed-in customer call this first.\"\"\"\n    if not request.user.is_authenticated:\n        return redirect_to_login(request.get_full_path())\n    return request.user","language":"python","evidence":"guided","canonicalKey":"intermediate.7#1","canonicalFingerprint":"1vsjwjp"},{"task":"Environment variables are upper case. Fix the name of the Stripe key.","hint":"gUiw makes the whole word upper case, from anywhere inside it.","mode":"python","start":"import os\n\nfrom stripe import StripeClient\n\n# The server's Stripe client. The key comes from the deploy settings.\nclient = StripeClient(os.environ[\"stripe_secret_key\"])\nWEBHOOK_SECRET = os.environ[\"STRIPE_WEBHOOK_SECRET\"]","startCursor":{"line":4,"ch":0},"paths":[{"keys":["j","f","_","g","U","i","w"],"tier":"idiomatic","technique":"operator:gU","core":["operator:gU"],"note":"The underscores are part of the word, so gUiw changes the whole name."}],"target":"import os\n\nfrom stripe import StripeClient\n\n# The server's Stripe client. The key comes from the deploy settings.\nclient = StripeClient(os.environ[\"STRIPE_SECRET_KEY\"])\nWEBHOOK_SECRET = os.environ[\"STRIPE_WEBHOOK_SECRET\"]","language":"python","evidence":"guided","canonicalKey":"intermediate.7#2","canonicalFingerprint":"1btug5"}]},"text":{"id":"intermediate.7","title":"Reshape without retyping","moduleName":"Boundaries and reusable text","tips":"","concept":"<p class=\"lead\">Join lines, indent them or make text upper case without touching the lines around them.</p><p><strong>Before this lesson:</strong> Operators and counts.</p><p>J joins the next line onto this one, usually with a space between them. gU takes a motion or text object and makes that text upper case. &gt;&gt; moves a line right, and a count moves several lines. Indenting only changes the layout here, so check the result against the target.</p><h3>Example</h3><p>J turns “Read the” and “guide.” into “Read the guide.” Then gUiw on guide changes just that word to GUIDE.</p><p>Use Start over to try again.</p>","teaches":["operator:>","join","operator:gU"],"introduces":["J","gU",">",">>","count","textobject"],"constraints":[],"drills":[{"task":"The sentence got split over two lines. Join them.","hint":"J joins the next line onto this one, with one space between.","mode":"text/plain","start":"Subject: Delivery booked for your sofa\n\nHi {{name}},\n\nYour sofa will arrive on\nThursday between 8:00 and 12:00.\nThe driver calls you half an hour before.\n\nNorthwind home delivery","startCursor":{"line":4,"ch":0},"paths":[{"keys":["J"],"tier":"idiomatic","technique":"join","core":["join"],"note":"J puts exactly one space between the two halves."}],"target":"Subject: Delivery booked for your sofa\n\nHi {{name}},\n\nYour sofa will arrive on Thursday between 8:00 and 12:00.\nThe driver calls you half an hour before.\n\nNorthwind home delivery","language":"text","evidence":"guided","canonicalKey":"intermediate.7#0","canonicalFingerprint":"16h2z2n"},{"task":"Checking the payment page is part of the smoke test. Make it a sub-item of the step above.","hint":">> moves the line right by one indent.","mode":"text/plain","start":"# Release steps\n\n1. Merge the release branch.\n2. Run the smoke test.\n  - Sign in and add something to the cart.\n- Check that the payment page loads.\n3. Tell support the release is out.","startCursor":{"line":3,"ch":0},"paths":[{"keys":["2","j",">",">"],"tier":"idiomatic","technique":"operator:>","core":["operator:>"],"note":">> adds one indent, two spaces here, so the line lines up with the other sub-item."}],"target":"# Release steps\n\n1. Merge the release branch.\n2. Run the smoke test.\n  - Sign in and add something to the cart.\n  - Check that the payment page loads.\n3. Tell support the release is out.","language":"text","evidence":"guided","canonicalKey":"intermediate.7#1","canonicalFingerprint":"1vsjwjp"},{"task":"Environment variables are upper case. Write the Stripe key's name the way the deploy settings have it.","hint":"gUiw makes the whole word upper case, from anywhere inside it.","mode":"text/plain","start":"# Deploying\n\nPayments need two secrets in the deploy settings.\nIf checkout fails right after a deploy, check that the settings still have stripe_secret_key and STRIPE_WEBHOOK_SECRET.\nBoth are in the shared vault, under Payments.\n\nNever paste them into a ticket.","startCursor":{"line":2,"ch":0},"paths":[{"keys":["j","f","_","g","U","i","w"],"tier":"idiomatic","technique":"operator:gU","core":["operator:gU"],"note":"The underscores are part of the word, so gUiw changes the whole name."}],"target":"# Deploying\n\nPayments need two secrets in the deploy settings.\nIf checkout fails right after a deploy, check that the settings still have STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET.\nBoth are in the shared vault, under Payments.\n\nNever paste them into a ticket.","language":"text","evidence":"guided","canonicalKey":"intermediate.7#2","canonicalFingerprint":"1btug5"}]}},"concepts":{"javascript":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Operators and counts.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Join lines, indent them or make text upper case without touching the lines around them.</p><p>J joins the next line onto this one, usually with a space between them. gU takes a motion or text object and makes that text upper case. &gt;&gt; moves a line right, and a count moves several lines. Indenting only changes the layout here, so check the result against the target.</p><h2 class=\"prose-subhead\">Example</h2><p>J turns “Read the” and “guide.” into “Read the guide.” Then gUiw on guide changes just that word to GUIDE.</p><p>Use Start over to try again.</p></div></details>"},"python":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Operators and counts.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Join lines, indent them or make text upper case without touching the lines around them.</p><p>J joins the next line onto this one, usually with a space between them. gU takes a motion or text object and makes that text upper case. &gt;&gt; moves a line right, and a count moves several lines. Indenting only changes the layout here, so check the result against the target.</p><h2 class=\"prose-subhead\">Example</h2><p>J turns “Read the” and “guide.” into “Read the guide.” Then gUiw on guide changes just that word to GUIDE.</p><p>Use Start over to try again.</p></div></details>"},"text":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Operators and counts.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Join lines, indent them or make text upper case without touching the lines around them.</p><p>J joins the next line onto this one, usually with a space between them. gU takes a motion or text object and makes that text upper case. &gt;&gt; moves a line right, and a count moves several lines. Indenting only changes the layout here, so check the result against the target.</p><h2 class=\"prose-subhead\">Example</h2><p>J turns “Read the” and “guide.” into “Read the guide.” Then gUiw on guide changes just that word to GUIDE.</p><p>Use Start over to try again.</p></div></details>"}}}