This Week I Learned: 2023W01

Tue Jan 10 2023

Happy new year!

I’m back with TWILs. I missed a few in the end of last year because I was quite busy. Back to work!


Since TS 3.7, TS supports asserts in the return function.

See the documentation here . This is quite advanced and it took me some time to understand how it works (to understand that the asserts keyword does not really assert the condition but pretends the assertion is manually done in the function itself). Still very interesting.

Note Taking - Obsidian

I discovered the existence of Obsidian , the note-taking app. I have to say I’m enthusiastic. As a markdown user (I usually write some notes in vim and save them somewhere on my disk), I really like the output and the fact that I control the data.

This series of Youtube videos is a great introduction to understand the main concepts of Obsidian and why it’s better than other note-taking apps.

The Obsidian app is itself open source and free. You can choose to synchronize your notes by yourself (in a git repository, in a cloud storage, etc.) or use the Obsidian Sync service (which is paid). I have to say Obsidian Sync is quite expensive, but I like the fact that it’s easy to use and that it’s end-to-end encrypted.

Edit: the app is actually not open source… my bad.


In Symfony, you can get the current route name in a controller by using the $_route variable.

See here .


I discovered the Evilginx2 package , which allows one to easily create phishing pages for various services (Google, Facebook, etc.). Interesting to know some script kiddies use so easy-to-use tools nowadays, and that using an OTP code doesn’t protect you from phishing.

Here is a Youtube video showing how it works.


Lua array index starts at 1, not 0.

Neovim - UltiSnips - LuaSnip

LuaSnip is the replacer of UltiSnips for Neovim, using lua. It’s used in some LSP configs. I still have to port my UltiSnips snippets to LuaSnip, but it seems there is a migration guide to do so.

I also finally moved my Neovim config to use LSP, thanks to lsp-zero and this Youtube video from ThePrimeagen . I still have to configure some things but I’m really happy I made that move.


Adding this to your lua config will allow you to move the visual selection with J and K:

vim.api.nvim_set_keymap("v", "J", ":m '>+1<CR>gv=gv", {})
vim.api.nvim_set_keymap("v", "K", ":m '<-2<CR>gv=gv", {})

Also, it reformats the indent while moving. Amazing. Thanks to ThePrimeagen’s video quoted before.

Symfony - Enum - Routing

Starting from Symfony 6.1, you can use PHP backed Enum as route requirements.

See documentation .