███████ ████████ ███████ ███ ██ ██████ ██ ██
██ ██ ██ ████ ██ ██ ██ ██
███████ ██ █████ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ███████ ██ ████ ██████ ██ ███████
Overview
Whether you are studying for technical interviews, or just starting your coding journey, pattern recognition and memorization are absolutely necessary. It doesn't take a valedictorian to figure that out, but how exactly are you supposed to do that? Between data structures, algorithms, and design patterns, the task of incrementally committing enough of that information to memory can feel impossible. You could spend hours studying fully implemented algorithms only to draw a blank when staring at an empty code editor.
Most people when they attempt to memorize something study the full text and then attempt to regurgitate it on a blank page. Shocking, I know... but what if there was a step in between? What if memorization and pattern recognition weren't all or nothing games? This is where Stencil comes in.
Stencil is a language-agnostic memorization tool that strips code files down to their first letters while preserving spacing, capitalization, and punctuation. The "stencil" of the file is designed to act as a bridge between having something partially memorized and fully memorized. Below is an example of Stencil in action using LeetCode problem 335 "Self Crossing":
Example
Solution
class Solution:
def isSelfCrossing(self, distance: List[int]) -> bool:
b = c = d = e = 0
for a in distance:
if d >= b > 0 and (
a >= c or a >= c - e > 0 and
f >= d - b):
return True
b, c, d, e, f = a, b, c, d, e
return False
Solution with Stencil
c S:
d i(s, d: L[i]) -> b:
b = c = d = e = 0
f a i d:
i d >= b > 0 a (
a >= c o a >= c - e > 0 a
f >= d - b):
r T
b, c, d, e, f = a, b, c, d, e
r F
Local Installation
To install Stencil locally, run the following command in the terminal of your directory:
npm install @scurrlin/stencil
Once installed, you can run it with the following command:
npx stencil path/to/your/file.py --start <start_line> --end <end_line>
Global Installation
If you prefer to install Stencil globally, run the following command in your terminal:
npm install -g @scurrlin/stencil
Once installed, you can run it with the following command:
stencil path/to/your/file.py --start <start_line> --end <end_line>