Pigułka wiedzy
Masz 30 sekund? Super, tyle właśnie wystarczy, by nauczyć się czegoś nowego!
Recovering a Deleted Git Branch
Did you know you can recover a deleted Git branch?
If you accidentally deleted a local branch, you can bring it back!
git reflog
Find the commit hash where your branch last pointed, then run:
git checkout -b <branch-name> <commit-hash>
Tip: git reflog keeps a record of all recent branch movements – even deleted ones!
GIT: See who changed a specific line
Want to know who last modified a line in a file?
git blame <file>
Perfect for tracking down when and why a change was made.
View your commit history as a graph
Make your commit history visual and easier to follow:
git log --oneline --graph --decorate --all
This command gives you a clean, visual tree of your branches and commits.
GIT: Stash uncommitted changes
Need to switch branches but don’t want to commit yet? This command temporarily saves your work for later:
git stash
Now you can restore your code to the exact state it was in before you stashed it, ready to continue working seamlessly.
git stash pop
The Difference Between == and === in JavaScript
The loose equality operator == in JavaScript automatically converts values to the same type before comparing them.
This can cause unexpected results, so it’s usually better to use the strict equality operator ===
console.log(5 == "5");
// true - because "5" is converted to a number
console.log(5 === "5");
// false - because types are different (number vs string)
Boost Scroll Performance with passive: true
Make scroll or touch listeners more performant – tell the browser you won’t call preventDefault()
window.addEventListener(
'scroll',
onScroll,
{ passive: true }
);
Destructure and Keep the Rest
You can combine destructuring and rest syntax to extract what you need and keep the rest.
const { id, ...info } = { id: 1, name: "Alice", role: "Admin" };
console.log(info); // { name: "Alice", role: "Admin" }
Run an Event Listener Just Once
You can make an event listener run only once – it removes itself automatically after the first trigger.
button.addEventListener(
'click',
handler,
{ once: true }
);
Powyższy zestaw ciekawostek z zakresu programowania to szybka porcja wiedzy w pigułce, dla zabieganych programistów, bez lania wody, bez zbędnej teorii – tylko czyste, skondensowane info w stylu „Czy wiesz, że …”
Dostrzeżesz tu zarówno podstawy, które każdy programista wiedzieć powinien, (przynajmniej w teorii, ale bądźmy szczerzy – pamięć mamy dobrą, ale krótką i bez google albo AI momentami byłoby ciężko), jak i programistyczne „smaczki”, przyprawiające o nerwowy śmiech nawet doświadczonych developerów. Niezależnie, czy jesteś początkującym koderem, doświadczonym devem, czy po prostu lubisz klikać w rzeczy, które wyglądają mądrze – znajdziesz tu coś dla siebie.
Przygotuj się na uśmiech, przebłyski myśli: „aaa, o to chodzi!” oraz stan „ooo, dobrze wiedzieć…”
UWAGA ! Możliwe efekty uboczne: nagłe oświecenie programistyczne oraz niepohamowana chęć dzielenia się wiedzą z każdym napotkanym developerem.