Блог пользователя divyansh_0602

Автор divyansh_0602, 4 года назад, По-английски

So I was just scrolling the leaderboard and opening random solutions, just when I came upon a code submitted by tourist and the code contained the time of creation of code.

I guess it is dynamically generated, can someone tell me how it is done?

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by divyansh_0602 (previous revision, new revision, compare).

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I don't think it's a boilerplate code. If you see in his streams, he has a pretty simple setup in which the above comments are previously written (before the actual streams). That means, He probably is writing the time of creation of the file manually.

»
4 года назад, скрыть # |
Rev. 6  
Проголосовать: нравится +11 Проголосовать: не нравится

He uses the Far Manager editor with some script. I don't know how does it work there, but he definitely doesn't write it manually. Similar thing can be done in linux using Vim editor and UltiSnips: https://github.com/SirVer/ultisnips. It works like when you write some key word, for example "temp" for template and press Tab key, it autocompletes everything you want. If you want to see an example, here you can find my UltiSnips config files for both python and cpp: https://github.com/violistt/dotfiles/tree/main/vim/UltiSnips. It's basically linux time formating. If you want to use different time format, here you can find all possible options: https://man7.org/linux/man-pages/man1/time.1.html.